|
@@ -2,7 +2,7 @@
|
|
|
* @Author: code4eat awesomedema@gmail.com
|
|
* @Author: code4eat awesomedema@gmail.com
|
|
|
* @Date: 2023-03-03 11:30:33
|
|
* @Date: 2023-03-03 11:30:33
|
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
|
- * @LastEditTime: 2023-09-27 17:04:16
|
|
|
|
|
|
|
+ * @LastEditTime: 2023-10-08 09:49:09
|
|
|
* @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
|
|
* @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
|
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
*/
|
|
*/
|
|
@@ -14,13 +14,13 @@
|
|
|
|
|
|
|
|
import { createFromIconfontCN } from '@ant-design/icons';
|
|
import { createFromIconfontCN } from '@ant-design/icons';
|
|
|
|
|
|
|
|
-import { ActionType, ProFormSelect } from '@ant-design/pro-components';
|
|
|
|
|
|
|
+import { ActionType, ProFormInstance, ProFormSelect } from '@ant-design/pro-components';
|
|
|
import { ModalForm, ProFormDigit, ProFormText, ProFormTextArea } from '@ant-design/pro-form'
|
|
import { ModalForm, ProFormDigit, ProFormText, ProFormTextArea } from '@ant-design/pro-form'
|
|
|
import { ProColumns } from '@ant-design/pro-table';
|
|
import { ProColumns } from '@ant-design/pro-table';
|
|
|
import { Input, message, Popconfirm } from 'antd';
|
|
import { Input, message, Popconfirm } from 'antd';
|
|
|
import { useEffect, useRef, useState } from 'react'
|
|
import { useEffect, useRef, useState } from 'react'
|
|
|
|
|
|
|
|
-import { addData, delData, editData, getData } from './service';
|
|
|
|
|
|
|
+import { addData, delData, editData, getColorFromDic, getData } from './service';
|
|
|
|
|
|
|
|
import './style.less';
|
|
import './style.less';
|
|
|
|
|
|
|
@@ -48,11 +48,12 @@ export default function DicClassfication() {
|
|
|
const [tableDataFilterParams, set_tableDataFilterParams] = useState<any | undefined>();
|
|
const [tableDataFilterParams, set_tableDataFilterParams] = useState<any | undefined>();
|
|
|
const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState<string>('');
|
|
const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState<string>('');
|
|
|
const tableRef = useRef<ActionType>();
|
|
const tableRef = useRef<ActionType>();
|
|
|
|
|
+ const modalFormRef = useRef<ProFormInstance>();
|
|
|
|
|
|
|
|
const columns: ProColumns[] = [
|
|
const columns: ProColumns[] = [
|
|
|
|
|
|
|
|
{
|
|
{
|
|
|
- title: 'Id',
|
|
|
|
|
|
|
+ title: 'ID',
|
|
|
dataIndex: 'id',
|
|
dataIndex: 'id',
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -135,21 +136,21 @@ export default function DicClassfication() {
|
|
|
if (type == 'ADD') {
|
|
if (type == 'ADD') {
|
|
|
const currentHosp = localStorage.getItem('currentSelectedSubHop');
|
|
const currentHosp = localStorage.getItem('currentSelectedSubHop');
|
|
|
const currentUser = localStorage.getItem('userData');
|
|
const currentUser = localStorage.getItem('userData');
|
|
|
- if(currentHosp&¤tUser){
|
|
|
|
|
- const {id} = JSON.parse(currentHosp);
|
|
|
|
|
- const {userId} = JSON.parse(currentUser);
|
|
|
|
|
|
|
+ if (currentHosp && currentUser) {
|
|
|
|
|
+ const { id } = JSON.parse(currentHosp);
|
|
|
|
|
+ const { userId } = JSON.parse(currentUser);
|
|
|
const result = {
|
|
const result = {
|
|
|
- hiId:id,
|
|
|
|
|
- code:formVal.code,
|
|
|
|
|
- name:formVal.name,
|
|
|
|
|
- resultType:formVal.resultType,
|
|
|
|
|
- defaultFlag:formVal.defaultFlag,
|
|
|
|
|
- sort:formVal.sort,
|
|
|
|
|
- delFlag:'',
|
|
|
|
|
- createUser:userId,
|
|
|
|
|
- createTime:new Date().getTime(),
|
|
|
|
|
- color:formVal.color
|
|
|
|
|
-
|
|
|
|
|
|
|
+ hiId: id,
|
|
|
|
|
+ code: formVal.code,
|
|
|
|
|
+ name: formVal.name,
|
|
|
|
|
+ resultType: formVal.resultType,
|
|
|
|
|
+ defaultFlag: formVal.defaultFlag,
|
|
|
|
|
+ sort: formVal.sort,
|
|
|
|
|
+ delFlag: '',
|
|
|
|
|
+ createUser: userId,
|
|
|
|
|
+ createTime: new Date().getTime(),
|
|
|
|
|
+ color: formVal.color
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
const resp = await addData({ ...formVal });
|
|
const resp = await addData({ ...formVal });
|
|
|
if (resp) {
|
|
if (resp) {
|
|
@@ -157,10 +158,10 @@ export default function DicClassfication() {
|
|
|
message.success('操作成功!');
|
|
message.success('操作成功!');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
if (type == 'EDIT') {
|
|
if (type == 'EDIT') {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const resp = await editData({ ...formVal });
|
|
const resp = await editData({ ...formVal });
|
|
|
if (resp) {
|
|
if (resp) {
|
|
|
tableRef.current?.reload();
|
|
tableRef.current?.reload();
|
|
@@ -173,14 +174,16 @@ export default function DicClassfication() {
|
|
|
|
|
|
|
|
const UpDataActBtn = ({ record, type }: { record: any, type: 'EDIT' | 'ADD' }) => {
|
|
const UpDataActBtn = ({ record, type }: { record: any, type: 'EDIT' | 'ADD' }) => {
|
|
|
|
|
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<ModalForm
|
|
<ModalForm
|
|
|
title={`${type == 'EDIT' ? '编辑' : '新增'}定性选项`}
|
|
title={`${type == 'EDIT' ? '编辑' : '新增'}定性选项`}
|
|
|
width={352}
|
|
width={352}
|
|
|
- initialValues={type == 'EDIT' ? { ...record } : {}}
|
|
|
|
|
|
|
+ initialValues={type == 'EDIT' ? { ...record} : {}}
|
|
|
trigger={
|
|
trigger={
|
|
|
type == 'EDIT' ? <a key="edit" >编辑</a> : <span className='add'>新增</span>
|
|
type == 'EDIT' ? <a key="edit" >编辑</a> : <span className='add'>新增</span>
|
|
|
}
|
|
}
|
|
|
|
|
+ formRef={modalFormRef}
|
|
|
onFinish={(val) => {
|
|
onFinish={(val) => {
|
|
|
return updateTable(type == 'EDIT' ? { ...record, ...val } : { ...val }, type);
|
|
return updateTable(type == 'EDIT' ? { ...record, ...val } : { ...val }, type);
|
|
|
}}
|
|
}}
|
|
@@ -206,15 +209,15 @@ export default function DicClassfication() {
|
|
|
|
|
|
|
|
return resultTypeList
|
|
return resultTypeList
|
|
|
}}
|
|
}}
|
|
|
- rules={[{ required: true, message: '类型不能为空!' }]}
|
|
|
|
|
|
|
+ rules={[{ required: true, message: '类型不能为空!' }]}
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<ProFormSelect label='是否默认:' name='defaultFlag'
|
|
<ProFormSelect label='是否默认:' name='defaultFlag'
|
|
|
request={async () => {
|
|
request={async () => {
|
|
|
- return [
|
|
|
|
|
- {label:'是',value:1},
|
|
|
|
|
- {label:'否',value:0}
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ return [
|
|
|
|
|
+ { label: '是', value: 1 },
|
|
|
|
|
+ { label: '否', value: 0 }
|
|
|
|
|
+ ]
|
|
|
}}
|
|
}}
|
|
|
/>
|
|
/>
|
|
|
<ProFormDigit
|
|
<ProFormDigit
|
|
@@ -222,10 +225,32 @@ export default function DicClassfication() {
|
|
|
label="排序序号:"
|
|
label="排序序号:"
|
|
|
placeholder="请输入"
|
|
placeholder="请输入"
|
|
|
/>
|
|
/>
|
|
|
- <ProFormText
|
|
|
|
|
- name="color"
|
|
|
|
|
- label="默认颜色:"
|
|
|
|
|
- placeholder="请输入,不需要#号"
|
|
|
|
|
|
|
+ <ProFormSelect label='默认颜色:' name='color'
|
|
|
|
|
+ request={ async () => {
|
|
|
|
|
+ const currentSys = localStorage.getItem('currentSelectedTab');
|
|
|
|
|
+ if(currentSys){
|
|
|
|
|
+ const {systemId} = JSON.parse(currentSys);
|
|
|
|
|
+ const resp = await getColorFromDic({ dictType: "COLOR_TYPE",systemId:systemId });
|
|
|
|
|
+
|
|
|
|
|
+ if (resp && resp.length > 0) {
|
|
|
|
|
+ const list = resp[0].dataVoList.map((a:any)=>{
|
|
|
|
|
+ if(type == 'ADD'&&a.defaultValue){
|
|
|
|
|
+ modalFormRef.current?.setFieldValue('color',a.value);
|
|
|
|
|
+ }
|
|
|
|
|
+ return {
|
|
|
|
|
+ label:<span style={{background:`#${a.value}`,color:'#fff',width:20,height:15,display:'inline-block',position:'relative',top:1}}>{}</span>,
|
|
|
|
|
+ value: a.value
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return list
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return []
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }}
|
|
|
/>
|
|
/>
|
|
|
</ModalForm>
|
|
</ModalForm>
|
|
|
)
|
|
)
|
|
@@ -265,7 +290,6 @@ export default function DicClassfication() {
|
|
|
}
|
|
}
|
|
|
}}
|
|
}}
|
|
|
onPressEnter={(e) => {
|
|
onPressEnter={(e) => {
|
|
|
-
|
|
|
|
|
set_tableDataFilterParams({
|
|
set_tableDataFilterParams({
|
|
|
...tableDataFilterParams,
|
|
...tableDataFilterParams,
|
|
|
filter: (e.target as HTMLInputElement).value
|
|
filter: (e.target as HTMLInputElement).value
|
|
@@ -286,10 +310,10 @@ export default function DicClassfication() {
|
|
|
}}
|
|
}}
|
|
|
fieldProps={{
|
|
fieldProps={{
|
|
|
onChange(value, option) {
|
|
onChange(value, option) {
|
|
|
- set_tableDataFilterParams({ ...tableDataFilterParams, resultType: value })
|
|
|
|
|
|
|
+ set_tableDataFilterParams({ ...tableDataFilterParams, resultType: value })
|
|
|
},
|
|
},
|
|
|
}}
|
|
}}
|
|
|
- />
|
|
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div className='btnGroup'>
|
|
<div className='btnGroup'>
|