Kaynağa Gözat

添加第一周的页面任务

code4eat 2 yıl önce
ebeveyn
işleme
55f9643c2b

+ 9 - 1
config/config.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2022-01-07 10:04:20
- * @LastEditTime: 2023-03-06 15:01:40
+ * @LastEditTime: 2023-03-09 09:54:36
  * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/config/config.ts
@@ -100,6 +100,10 @@ export default defineConfig({
             //   path: '/platform/setting/reports',
             //   component: '@/pages/platform/setting/reports/index.tsx',
             // },
+            {
+              path: '/platform/setting/departmentMana',
+              component: '@/pages/platform/setting/departmentMana/index.tsx',
+            },
             {
               path: '/platform/setting/pubDicTypeMana',
               component: '@/pages/platform/setting/pubDicTypeMana/index.tsx',
@@ -112,6 +116,10 @@ export default defineConfig({
               path: '/platform/setting/indicatorMana',
               component: '@/pages/platform/setting/indicatorMana/index.tsx',
             },
+            {
+              path: '/platform/setting/paramsMana',
+              component: '@/pages/platform/setting/paramsMana/index.tsx',
+            },
             {
               path: '/platform/setting/reports/0',
               component: '@/pages/platform/setting/reports/index.tsx',

+ 3 - 2
package.json

@@ -29,13 +29,14 @@
     "@ant-design/pro-layout": "^6.38.13",
     "@ant-design/pro-table": "^2.30.8",
     "@monaco-editor/react": "^4.4.5",
+    "antd": "^4.21.6",
+    "axios": "^1.3.4",
     "cross-env": "^7.0.3",
     "password-quality-calculator": "^1.0.4",
     "react": "16.x",
     "react-dev-inspector": "^1.1.1",
     "react-dom": "16.x",
-    "umi": "^3.5.20",
-    "antd":"^4.21.6"
+    "umi": "^3.5.20"
   },
   "devDependencies": {
     "@types/express": "^4.17.13",

+ 109 - 26
src/components/KCUpload/index.tsx

@@ -1,35 +1,118 @@
 /*
- * @Author: your name
- * @Date: 2022-01-18 09:15:26
- * @LastEditTime: 2022-03-07 15:04:21
- * @LastEditors: Please set LastEditors
- * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ * @Author: code4eat awesomedema@gmail.com
+ * @Date: 2022-05-25 14:45:47
+ * @LastEditors: code4eat awesomedema@gmail.com
+ * @LastEditTime: 2023-03-09 15:37:43
  * @FilePath: /KC-MiddlePlatform/src/components/KCUpload/index.tsx
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
+// /*
+//  * @Author: your name
+//  * @Date: 2022-01-18 09:15:26
+//  * @LastEditTime: 2022-03-07 15:04:21
+//  * @LastEditors: Please set LastEditors
+//  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+//  * @FilePath: /KC-MiddlePlatform/src/components/KCUpload/index.tsx
+//  */
+
+// import { ProFormUploadButton } from '@ant-design/pro-form';
+// import React from 'react';
+// import { KCUploadType } from './typings';
+// import './style.less';
+// import { DownloadOutlined } from '@ant-design/icons';
+
+// const KCUpload: React.FC<KCUploadType> = ({ title, fieldProps, ...restProps }) => {
+//   return (
+//     <div className="KCUpload">
+//       <ProFormUploadButton
+//         title={title}
+//         fieldProps={{
+//           customRequest: (resp) => {
+//             const { onSuccess, file } = resp;
+//             onSuccess && onSuccess(file);
+//           },
+//           ...fieldProps,
+//         }}
+//         icon={<DownloadOutlined />}
+//         {...restProps}
+//       />
+
+
+//     </div>
+//   );
+// };
+
+// export default KCUpload;
+
+
+/*
+ * @Author: code4eat awesomedema@gmail.com
+ * @Date: 2023-02-15 16:48:56
+ * @LastEditors: code4eat awesomedema@gmail.com
+ * @LastEditTime: 2023-02-23 15:37:20
+ * @FilePath: /BudgetManaSystem/src/components/BMSUpload/index.tsx
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
+
+
+
+import React, { useState } from 'react';
+import { InboxOutlined } from '@ant-design/icons';
+import type { UploadFile, UploadProps } from 'antd';
+import { Upload } from 'antd';
+
+import './style.less'
+
+const { Dragger } = Upload;
+
+type KCUploadPropsType = {
+  onChange?: () => void;
+  downloadTemplateFile?:()=>void; //模板下载回调
+  newVer?:boolean; //是否为新版本
+} & UploadProps
+
+const KCUpload = (props: KCUploadPropsType) => {
+  const [fileList, setFileList] = useState<UploadFile[]>([]);
+  const { onChange,downloadTemplateFile} = props;
+
+  const config: UploadProps = {
+    action: () => Promise.resolve(''),
+    name: 'file',
+    multiple: false,
+    beforeUpload: (file) => {
+      setFileList([...fileList, file]);
+      return false;
+    },
+    //onChange:onChange?onChange:()=>{},
+    onChange: (fileInfo) => {
+      onChange && onChange(fileInfo);
+    },
+    onDrop(e) {
+      console.log('Dropped files', e.dataTransfer.files);
+    },
+  };
+
+
+  const download = ()=>{
+    downloadTemplateFile&&downloadTemplateFile()
+  }
 
-import { ProFormUploadButton } from '@ant-design/pro-form';
-import React from 'react';
-import { KCUploadType } from './typings';
-import './style.less';
-import { DownloadOutlined } from '@ant-design/icons';
 
-const KCUpload: React.FC<KCUploadType> = ({ title, fieldProps, ...restProps }) => {
   return (
-    <div className="KCUpload">
-      <ProFormUploadButton
-        title={title}
-        fieldProps={{
-          customRequest: (resp) => {
-            const { onSuccess, file } = resp;
-            onSuccess && onSuccess(file);
-          },
-          ...fieldProps,
-        }}
-        icon={<DownloadOutlined />}
-        {...restProps}
-      />
+    <div className='KCUpload' style={{paddingBottom:16}}>
+      <div className='toolBar'>
+           <span>文件下载</span>
+           <span onClick={()=>download()}>模板下载</span>
+      </div>
+      <Dragger {...config} height={140}>
+        <p className="ant-upload-drag-icon" style={{marginBottom:5}}>
+          <InboxOutlined style={{ fontSize: 50, color: '#3376FE' }} />
+        </p>
+        <p className="ant-upload-text">点击或将文件拖拽到这里上传</p>
+
+      </Dragger>
     </div>
-  );
-};
+  )
+}
 
 export default KCUpload;

+ 24 - 0
src/components/KCUpload/style.less

@@ -2,4 +2,28 @@
   .kcmp-ant-form-item {
     margin-bottom: 0 !important;
   }
+
+  .toolBar {
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 16px;
+
+    &>span {
+      display: inline-block;
+      height: 15px;
+      font-size: 14px;
+      font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+      font-weight: 400;
+      color: #17181A;
+      line-height:15px;
+
+      &:last-child {
+           cursor: pointer;
+           color: #3376FE;
+      }
+    }
+  }
+  
 }

+ 4 - 4
src/components/KCUpload/typings.d.ts

@@ -1,8 +1,8 @@
 /*
  * @Author: your name
  * @Date: 2022-01-18 09:16:29
- * @LastEditTime: 2022-01-18 11:33:23
- * @LastEditors: Please set LastEditors
+ * @LastEditTime: 2023-03-09 15:09:53
+ * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/src/components/KCUpload/typings.d.ts
  */
@@ -11,6 +11,6 @@ import type { UploadProps, ButtonProps } from 'antd';
 import { FieldProps } from '@ant-design/pro-form/lib/interface';
 
 interface KCUploadType {
-  title: string;
-  fieldProps?: (FieldProps & UploadProps<any>) | undefined;
+  title?: string;
+  fieldProps?: (FieldProps<any> & UploadProps<any>) | undefined;
 }

+ 3 - 1
src/global.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-12-21 11:05:37
- * @LastEditTime: 2022-07-13 10:49:58
+ * @LastEditTime: 2023-03-09 16:03:36
  * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/src/global.tsx
@@ -22,6 +22,8 @@ export const logoutHandle = async () => {
   localStorage.removeItem('initialState');
   localStorage.removeItem('currentSelectedTab');
   localStorage.removeItem('isChildShowMenu');
+  localStorage.removeItem('selectedKeys');
+  localStorage.removeItem('openKeys');
   // localStorage.removeItem('visitedTabs');
 };
 

+ 326 - 0
src/pages/platform/setting/departmentMana/index.tsx

@@ -0,0 +1,326 @@
+/*
+ * @Author: code4eat awesomedema@gmail.com
+ * @Date: 2023-03-03 11:30:33
+ * @LastEditors: code4eat awesomedema@gmail.com
+ * @LastEditTime: 2023-03-09 15:55:52
+ * @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
+ */
+
+
+
+import { KCInput } from '@/components/KCInput';
+import KCTable from '@/components/kcTable';
+import KCUpload from '@/components/KCUpload';
+import { getAllHosp } from '@/service/hospList';
+import { downloadTemplateReq } from '@/utils';
+import { ModalForm, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-form'
+import { ProColumns } from '@ant-design/pro-table';
+import { message, Popconfirm } from 'antd';
+import FormItem from 'antd/lib/form/FormItem';
+import { useEffect, useState } from 'react'
+import { addData, delData, editData, getData, getDepartmentType, importDepartmentData } from './service';
+
+import './style.less';
+
+
+
+export default function DepartmentMana() {
+
+    const [tableDataFilterParams, set_tableDataFilterParams] = useState<any | undefined>();
+    const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState<string>('');
+    const [reload, set_reload] = useState(false);
+    const [currentEdit, set_currentEdit] = useState<any>(undefined);
+
+    const [types, set_types] = useState([]);
+
+
+
+
+    const columns = [
+        {
+            title: '科室代码',
+            dataIndex: 'code',
+        },
+        {
+            title: '科室名称',
+            dataIndex: 'name',
+        },
+        {
+            title: '院区',
+            dataIndex: 'hospName',
+
+        },
+        {
+            title: '类型',
+            dataIndex: 'type',
+            valueType: 'select',
+            fieldProps: {
+                options: types
+            }
+        },
+        {
+            title: '备注',
+            dataIndex: 'remark',
+
+        },
+        {
+            title: '操作',
+            key: 'option',
+            width: 120,
+            valueType: 'option',
+            render: (_: any, record: any) => {
+                return [
+                    <UpDataActBtn key={'act'} record={record} type='EDIT' />,
+                    <Popconfirm
+                        title="是否确认删除?"
+                        key="del"
+                        onConfirm={() => delTableData(record)}
+                    >
+                        <a>删除</a>
+                    </Popconfirm>
+                ]
+            },
+        },
+
+    ]
+
+
+    const getTableData = async (params: any) => {
+        const resp = await getData(params);
+        set_reload(false);
+        if (resp) {
+            return {
+                data: resp.list,
+                success: true,
+                total: resp.totalCount,
+                pageSize: resp.pageSize,
+                totalPage: resp.totalPage,
+            }
+        }
+        return []
+    }
+
+    const delTableData = async (record: any) => {
+        const resp = await delData(record.dictId);
+        if (resp) {
+            set_reload(true);
+            // message.success('操作成功!');
+        }
+    }
+
+    const updateTable = async (formVal: any, type: 'EDIT' | "ADD") => {
+
+        if (type == 'ADD') {
+            const resp = await addData(formVal);
+            if (resp) {
+                set_reload(true);
+            }
+        }
+
+        if (type == 'EDIT') {
+            const resp = await editData({ ...formVal });
+            if (resp) {
+                set_reload(true);
+            }
+        }
+
+
+    }
+
+    const UpDataActBtn = ({ record, type }: { record: any, type: 'EDIT' | 'ADD' }) => {
+
+        return (
+            <ModalForm
+                title={`${type == 'EDIT' ? '编辑' : '新增'}科室`}
+                width={352}
+                initialValues={type == 'EDIT' ? { ...record } : {}}
+                trigger={
+                    type == 'EDIT' ? <a key="edit">编辑</a> : <span className='add' style={{background:'#3377FF',color:'#fff'}}>新增</span>
+                }
+                onFinish={(val) => {
+                    return updateTable(type == 'EDIT' ? { ...val, id: record.id } : val, type);
+                }}
+            >
+                <ProFormText
+                    name="name"
+                    label="科室名称:"
+                    placeholder="请输入"
+                    rules={[{ required: true, message: '科室名称不能为空!' }]}
+                />
+                <ProFormText
+                    name="code"
+                    label="科室代码:"
+                    placeholder="请输入"
+                    rules={[{ required: true, message: '科室代码不能为空!' }]}
+                />
+                <ProFormSelect
+                    name="type"
+                    label="类型:"
+                    placeholder="请选择类型"
+                    rules={[{ required: true, message: '类型不能为空!' }]}
+                    request={async () => {
+                        return types
+                    }}
+                />
+                <ProFormSelect
+                    name="hospId"
+                    label="院区:"
+                    placeholder="请选择院区"
+                    rules={[{ required: true, message: '院区不能为空!' }]}
+                    request={async () => {
+                        const resp = await getAllHosp({ pageSize: 200, current: 1 });
+                        if (resp) {
+                            const data: any = resp.list?.map((a) => ({
+                                label: a.hospName,
+                                value: a.id
+                            }));
+
+                            return data;
+                        }
+                        return []
+
+                    }}
+                />
+                <ProFormTextArea
+                    name="remark"
+                    label="说明:"
+                    placeholder="请输入"
+
+                />
+            </ModalForm>
+        )
+    }
+
+
+    const tableDataSearchHandle = (paramName: string) => {
+
+
+        set_tableDataFilterParams({
+            ...tableDataFilterParams,
+            [`${paramName}`]: tableDataSearchKeywords
+        })
+    }
+
+
+    const downloadTemplateFileHandle =async () => {
+        await downloadTemplateReq('/gateway/centerSys/sysdepartment/export');
+    }
+
+
+    const importData = ( name: string) => {
+
+        return (
+            <ModalForm
+                title={`导入${name}数据`}
+                width={352}
+                trigger={
+                    <span  key="3">导入</span>
+                }
+                onFinish={async (values) => {
+                    console.log({values});
+                    const { importFile: { fileList } } = values;
+
+                    let formData = new FormData();
+                    formData.append('file', fileList[0].originFileObj);
+                    const resp = await importDepartmentData(formData);
+
+                    if (resp) {
+                    
+                        set_reload(true);
+                        return true;
+                    }
+
+                }}
+            >
+                <FormItem name={'importFile'}>
+                    <KCUpload downloadTemplateFile={()=>downloadTemplateFileHandle()} />
+                </FormItem>
+
+            </ModalForm>
+        )
+    }
+
+
+    const getAllDepartmentType = async () => {
+        const resp = await getDepartmentType();
+        if (resp) {
+            const data: any = resp?.map((a) => ({
+                label: a.name,
+                value: a.code
+            }));
+            set_types(data);
+        }
+    }
+
+
+    useEffect(() => {
+        getAllDepartmentType();
+    }, [])
+
+    return (
+        <div className='DepartmentMana'>
+            <div className='toolBar'>
+                <div className='filter'>
+                    <div className='filterItem' style={{ marginRight: 16 }}>
+                        <span className='label'>科室:</span>
+                        <KCInput placeholder={'请输入科室名称'} style={{ width: 160 }} search allowClear
+                            onChange={(e) => {
+                                set_tableDataSearchKeywords(e.target.value);
+                                if (e.target.value.length == 0) {
+                                    set_tableDataFilterParams({
+                                        ...tableDataFilterParams,
+                                        departName: ''
+                                    });
+                                }
+                            }}
+                            onSearch={() => tableDataSearchHandle('departName')}
+
+                        />
+                    </div>
+                    <div className='filterItem'>
+                        <span className='label'>科室:</span>
+                        {
+                            types.length > 0 && (
+                                <ProFormSelect
+                                    name="type"
+                                    noStyle
+                                    style={{ width: 160 }}
+                                    placeholder="请选择类型"
+                                    rules={[{ required: true, message: '类型不能为空!' }]}
+                                    request={async () => {
+                                        return types
+                                    }}
+                                    fieldProps={{
+                                        onChange: (e) => {
+
+                                            if (e) {
+                                                set_tableDataFilterParams({
+                                                    ...tableDataFilterParams,
+                                                    departType: e
+                                                });
+                                            } else {
+                                                set_tableDataFilterParams({
+                                                    ...tableDataFilterParams,
+                                                    departType: ''
+                                                });
+                                            }
+
+                                        }
+                                    }}
+                                />
+                            )
+                        }
+                    </div>
+                </div>
+                <div className='btnGroup'>
+                    {importData('科室')}
+                    <UpDataActBtn record type='ADD' />
+                </div>
+            </div>
+            <div style={{ marginTop: 16 }}>
+                <KCTable columns={columns as ProColumns[]} reload={reload} rowKey='id' newVer params={tableDataFilterParams} request={(params) => getTableData(params)} />
+            </div>
+        </div>
+    )
+}

+ 112 - 0
src/pages/platform/setting/departmentMana/service.ts

@@ -0,0 +1,112 @@
+/*
+ * @Author: code4eat awesomedema@gmail.com
+ * @Date: 2023-03-03 16:31:27
+ * @LastEditors: code4eat awesomedema@gmail.com
+ * @LastEditTime: 2023-03-09 15:54:24
+ * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/service.ts
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
+
+
+
+import { request } from 'umi';
+
+//获取table列表数据
+
+export type DepartmentDataType = {
+    id:number;
+    hospId:string;
+    code:string;
+    name:string;
+    type:string;
+    remark:string;
+    hospName:string;
+    typeName:string;
+}
+
+
+export const getData = (params?:any) => {
+  return request<{
+       current:number;
+       list:DepartmentDataType[];
+       pageSize:number;
+       totalCount:number;
+       totalPage:number;
+  }>('/centerSys/sysdepartment/getList', {
+    method: 'GET',
+    params:{...params}
+  });
+};
+
+
+//新增表格数据
+export type AddTableDataType = {
+  hospId:number;
+  dictName:string;
+  dictType:string;
+  remark:string
+}
+export const addData = (data:AddTableDataType) => {
+  return request('/centerSys/sysdepartment/add', {
+    method: 'POST',
+    data
+  });
+};
+
+
+
+//编辑表格数据
+export type EditTableDataType = {
+  dictId:number;
+  hospId:number;
+  dictName:string;
+  dictType:string;
+  remark:string
+}
+
+export const editData = (data:EditTableDataType) => {
+  return request('/centerSys/sysdepartment/edit', {
+    method: 'POST',
+    data
+  });
+};
+
+//删除表格操作
+export const delData = (dictId:string) => {
+  return request('/centerSys/sysdepartment/delete', {
+    method: 'POST',
+    params:{dictId}
+  });
+};
+
+
+
+//获取科室类型
+
+export type GetDepartmentType = {
+    code:string;
+    value:string;
+    name:string;
+}
+
+export const getDepartmentType = (params?:any) => {
+    return request<GetDepartmentType[]>('/centerSys/sysdepartment/getDepartType', {
+      method: 'GET',
+    });
+};
+
+
+//科室数据导入
+
+export const importDepartmentData = (data:any) => {
+    return request('/centerSys/sysdepartment/importData', {
+      method: 'POST',
+      data
+    });
+};
+
+
+
+
+
+

+ 55 - 0
src/pages/platform/setting/departmentMana/style.less

@@ -0,0 +1,55 @@
+.DepartmentMana {
+    padding: 16px;
+    background: #FFFFFF;
+    border-radius: 4px;
+  
+    .toolBar {
+      display: flex;
+      flex-direction: row;
+      justify-content: space-between;
+      align-items: center;
+  
+      .filter {
+        display: flex;
+        flex-direction: row;
+        justify-content: flex-start;
+        align-items: center;
+  
+        .filterItem {
+          display: flex;
+          flex-direction: row;
+          justify-content: center;
+          align-items: center;
+        }
+      }
+  
+      .btnGroup {
+        &>span {
+            display: inline-block;
+            text-align: center;
+            padding: 0 12px;
+            height: 24px;
+            line-height: 21px;
+            background: #FAFCFF;
+            border-radius: 4px;
+            cursor: pointer;
+            border: 1px solid #DAE2F2;
+            margin-right: 8px;
+
+            &:last-child {
+                margin-right: 0;
+            }
+        }
+
+        &.disabled {
+            &>span {
+                cursor:not-allowed;
+                color: rgb(0 0 0 / 50%);
+                background-color:#f0f2f5;
+            }
+        }
+    }
+  
+    }
+  }
+  

+ 320 - 0
src/pages/platform/setting/paramsMana/index.tsx

@@ -0,0 +1,320 @@
+/*
+ * @Author: code4eat awesomedema@gmail.com
+ * @Date: 2023-03-03 11:30:33
+ * @LastEditors: code4eat awesomedema@gmail.com
+ * @LastEditTime: 2023-03-08 17:53:25
+ * @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
+ */
+
+
+
+import { KCInput } from '@/components/KCInput';
+import KCTable from '@/components/kcTable';
+import { getAllHosp } from '@/service/hospList';
+import { ModalForm, ProFormCascader, ProFormDigit, ProFormRadio, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect } from '@ant-design/pro-form'
+import { ProColumns } from '@ant-design/pro-table';
+import { message, Popconfirm } from 'antd';
+import React, { useState } from 'react'
+import { addData, delData, editData, getData, getSysLists } from './service';
+
+import './style.less';
+
+
+
+export default function ParamsMana() {
+
+    const [tableDataFilterParams, set_tableDataFilterParams] = useState<any | undefined>();
+    const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState<string>('');
+    const [reload, set_reload] = useState(false);
+    const [currentEdit, set_currentEdit] = useState<any>(undefined);
+
+
+
+
+    const columns = [
+        {
+            title: '参数名称',
+            dataIndex: 'name',
+
+        },
+        {
+            title: '参数说明',
+            dataIndex: 'description',
+        },
+        {
+            title: '参数值',
+            dataIndex: 'value',
+        },
+        {
+            title: '院区',
+            dataIndex: 'hospName',
+
+        },
+        {
+            title: '系统',
+            dataIndex: 'systemName',
+
+        },
+        {
+            title: '启用',
+            dataIndex: 'status',
+            render: (_: any, record: any) => {
+                return <span style={{ color: record == 1?'#00BF8F':'red' }}>{record == 1 ? '启用' : '禁用'}</span>
+            }
+        },
+        {
+            title: '操作',
+            key: 'option',
+            width: 120,
+            valueType: 'option',
+            render: (_: any, record: any) => {
+                return [
+                    //<a key='copy'>复制</a>,
+                    <UpDataActBtn key={'act'} record={record} type='EDIT' />,
+                    <Popconfirm
+                        title="是否确认删除?"
+                        key="del"
+                        onConfirm={() => delTableData(record)}
+                    >
+                        <a>删除</a>
+                    </Popconfirm>
+                ]
+            },
+        },
+
+    ]
+
+
+    const getTableData = async (params: any) => {
+        const resp = await getData(params);
+        set_reload(false);
+        if (resp) {
+            return {
+                data: resp.list,
+                success: true,
+                total: resp.totalCount,
+                pageSize: resp.pageSize,
+                totalPage: resp.totalPage,
+            }
+        }
+        return []
+    }
+
+    const delTableData = async (record: any) => {
+        const resp = await delData(record.id);
+        if (resp) {
+            set_reload(true);
+            // message.success('操作成功!');
+        }
+    }
+
+    const updateTable = async (formVal: any, type: 'EDIT' | "ADD") => {
+        const {systemId} = formVal;
+        if (type == 'ADD') {
+            const resp = await addData({...formVal,systemId:systemId[systemId.length -1],systemPath:systemId.join(',')});
+            if (resp) {
+                set_reload(true);
+            }
+        }
+        if (type == 'EDIT') {
+            const resp = await editData({ ...formVal,systemId:systemId[systemId.length -1],systemPath:systemId.join(',')});
+            if (resp) {
+                set_reload(true);
+            }
+        }
+
+
+    }
+
+    const UpDataActBtn = ({ record, type }: { record: any, type: 'EDIT' | 'ADD' }) => {
+
+        return (
+            <ModalForm
+                title={`${type == 'EDIT' ? '编辑' : '新增'}参数`}
+                width={352}
+                initialValues={type == 'EDIT' ? { ...record,systemId:record.systemPath?record.systemPath.split(','):[] } : {}}
+                trigger={
+                    type == 'EDIT' ? <a key="edit" >编辑</a> : <span className='add'>新增</span>
+                }
+                onFinish={(val) => {
+                    return updateTable(type == 'ADD'?val:{...record,...val}, type);  //编辑时将id返回去
+                }}
+            >
+                <ProFormText
+                    name="name"
+                    label="参数名称:"
+                    placeholder="请输入"
+                    rules={[{ required: true, message: '参数名称不能为空!' }]}
+                />
+                <ProFormText
+                    name="description"
+                    label="描述:"
+                    placeholder="请输入"
+                    rules={[{ required: true, message: '参数描述不能为空!' }]}
+                />
+                <ProFormDigit label="参数值" name="value" rules={[{ required: true, message: '参数值不能为空!' }]} />
+                <ProFormSelect
+                    name="hospId"
+                    label="院区:"
+                    placeholder="请选择院区"
+                    rules={[{ required: true, message: '院区不能为空!' }]} 
+                    request={async () => {
+                        const resp = await getAllHosp({ pageSize: 200, current: 1 });
+                        if (resp) {
+                            const data: any = resp.list?.map((a) => ({
+                                label: a.hospName,
+                                value: a.id
+                            }));
+
+                            return data;
+                        }
+                        return []
+
+                    }}
+
+                />
+                <ProFormCascader
+                    name='systemId'
+                    label="系统:"
+                    rules={[{ required: true, message: '系统不能为空!' }]} 
+                    placeholder="请选择"
+                    request={async () => {
+                        const resp = await getSysLists();
+                        if (resp) {
+                            return resp
+                        }
+                        return []
+
+                    }}
+                    fieldProps={{
+                        fieldNames: {
+                            label: 'name',
+                            value: 'code'
+                        },
+                    }}
+                />
+                <ProFormRadio.Group
+                    name="status"
+                    label="启用:"
+                    fieldProps={{
+                        buttonStyle: 'solid'
+                    }}
+                    options={[
+                        {
+                            label: '是',
+                            value: 1,
+                        },
+                        {
+                            label: '否',
+                            value: 0,
+                        },
+                    ]}
+                    rules={[{ required: true, message: '启用不能为空!' }]}
+                />
+
+            </ModalForm>
+        )
+    }
+
+    const editHandle = (record: any) => {
+
+    }
+
+    const tableDataSearchHandle = (paramName: string) => {
+
+
+        set_tableDataFilterParams({
+            ...tableDataFilterParams,
+            [`${paramName}`]: tableDataSearchKeywords
+        })
+    }
+
+    return (
+        <div className='PubDicTypeMana'>
+            <div className='toolBar'>
+                <div className='filter'>
+                    <div className='filterItem'>
+                        <span className='label'>适用院区:</span>
+                        <ProFormSelect
+                            noStyle
+                            allowClear
+                            placeholder="请选择"
+                            style={{ width: 160, marginRight: 16 }}
+                            request={async () => {
+                                const resp = await getAllHosp({ pageSize: 200, current: 1 });
+                                if (resp) {
+                                    const data: any = resp.list?.map((a) => ({
+                                        label: a.hospName,
+                                        value: a.id
+                                    }));
+
+                                    return [
+                                        {
+                                            label: '所有院区', value: '0'
+                                        }, ...data
+                                    ];
+                                }
+                                return []
+
+                            }}
+                            fieldProps={{
+                                onChange(value, option) {
+                                    set_tableDataFilterParams({ ...tableDataFilterParams, hospId: value })
+                                },
+                            }}
+                        />
+                    </div>
+                    <div className='filterItem' style={{ marginRight: 16 }}>
+                        <span className='label'>系统名称:</span>
+                        <ProFormCascader
+                            noStyle
+                            allowClear
+                            width={160}
+                            placeholder="请选择"
+                            request={async () => {
+                                const resp = await getSysLists();
+                                if (resp) {
+                                    return resp
+                                }
+                                return []
+
+                            }}
+                            fieldProps={{
+                                fieldNames: {
+                                    label: 'name',
+                                    value: 'code'
+                                },
+                                onChange(value: any, option: any) {
+                                    set_tableDataFilterParams({ ...tableDataFilterParams, systemId: value ? value[0] : '' })
+                                },
+                            }}
+                        />
+                    </div>
+                    <div className='filterItem'>
+                        <span className='label'>检索:</span>
+                        <KCInput placeholder={'请输入参数名称'} style={{ width: 160 }} search allowClear
+                            onChange={(e) => {
+                                set_tableDataSearchKeywords(e.target.value);
+                                if (e.target.value.length == 0) {
+                                    set_tableDataFilterParams({
+                                        ...tableDataFilterParams,
+                                        parameterName: ''
+                                    });
+                                }
+                            }}
+                            onSearch={() => tableDataSearchHandle('parameterName')}
+
+                        />
+                    </div>
+                </div>
+                <div className='btnGroup'>
+                    <UpDataActBtn record type='ADD' />
+                </div>
+            </div>
+            <div style={{ marginTop: 16 }}>
+                <KCTable columns={columns as ProColumns[]} reload={reload} rowKey='id' newVer params={tableDataFilterParams} request={(params) => getTableData(params)} />
+            </div>
+        </div>
+    )
+}

+ 113 - 0
src/pages/platform/setting/paramsMana/service.ts

@@ -0,0 +1,113 @@
+/*
+ * @Author: code4eat awesomedema@gmail.com
+ * @Date: 2023-03-03 16:31:27
+ * @LastEditors: code4eat awesomedema@gmail.com
+ * @LastEditTime: 2023-03-08 16:58:00
+ * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/service.ts
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
+
+
+
+import { request } from 'umi';
+
+//获取table列表数据
+
+export type PubDicTypeData = {
+  id:number;
+  name:string;
+  description:string;
+  value:string;
+  unit:string;
+  hospId:string;
+  hospName:string;
+  systemId:string;
+  systemName:string;
+  status:number;
+  systemPath:string;
+}
+
+
+export const getData = (params:{
+  systemId?:number;
+  hospId?:number;
+  parameterName?:string;
+
+}) => {
+  return request<{
+       current:number;
+       list:PubDicTypeData[];
+       pageSize:number;
+       totalCount:number;
+       totalPage:number;
+  }>('/centerSys/parameter/getList', {
+    method: 'GET',
+    params:{...params}
+  });
+};
+
+
+//获取所有系统列表
+export const getSysLists = () => {
+  return request('/centerSys/menu/getSystemList', {
+    method: 'GET',
+  });
+};
+
+
+
+//新增表格数据
+export type AddTableData = {
+  name:string;
+  description:string;
+  hospId:string;
+  hospName:string;
+  status:number;
+  systemId:string;
+  value:string;
+  unit:string;
+}
+export const addData = (data:AddTableData) => {
+  return request('/centerSys/parameter/add', {
+    method: 'POST',
+    data
+  });
+};
+
+
+
+//编辑表格数据
+export type EditTableDataType = {
+  name:string;
+  description:string;
+  hospId:string;
+  hospName:string;
+  status:number;
+  systemId:string;
+  value:string;
+  unit:string;
+  id:number;
+}
+
+export const editData = (data:EditTableDataType) => {
+  return request('/centerSys/parameter/edit', {
+    method: 'POST',
+    data
+  });
+};
+
+//删除表格操作
+export const delData = (id:number) => {
+  return request('/centerSys/parameter/delete', {
+    method: 'POST',
+    params:{id}
+  });
+};
+
+
+
+
+
+
+
+

+ 0 - 0
src/pages/platform/setting/paramsMana/style.less


+ 13 - 22
src/pages/platform/setting/pubDicMana/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-03-07 16:52:55
+ * @LastEditTime: 2023-03-08 17:44:07
  * @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
  */
@@ -17,7 +17,7 @@ import { ProColumns } from '@ant-design/pro-table';
 import { message, Popconfirm } from 'antd';
 import { useEffect, useState } from 'react';
 import { getData, PubDicTypeData } from '../pubDicTypeMana/service';
-import { addPubDicRelaTbaleData, editPubDicRelaTbaleData, getPubDicRelaTbaleData } from './service';
+import { addPubDicRelaTbaleData, delData, editPubDicRelaTbaleData, getPubDicRelaTbaleData } from './service';
 
 
 import './style.less';
@@ -40,23 +40,19 @@ const PubDicMana = () => {
     const columns = [
         {
             title: '项目名称',
-            align: 'center',
             dataIndex: 'name',
 
         },
         {
             title: '项目代码',
-            align: 'center',
             dataIndex: 'code',
         },
         {
             title: '项目值',
-            align: 'center',
             dataIndex: 'value',
         },
         {
             title: '默认',
-            align: 'center',
             dataIndex: 'data.0.dictDefault',
             render: (_: any, record: number) => {
                 return record == 1 ? '是' : '否'
@@ -65,19 +61,16 @@ const PubDicMana = () => {
         },
         {
             title: '序号',
-            align: 'center',
             dataIndex: 'dictSort',
 
         },
         {
             title: '适用院区',
-            align: 'center',
             dataIndex: 'hospName',
 
         },
         {
             title: '操作',
-            align: 'center',
             key: 'option',
             width: 120,
             valueType: 'option',
@@ -105,11 +98,11 @@ const PubDicMana = () => {
             set_reload(false);
             if (resp) {
                 return {
-                    data: resp,
+                    data: resp.list,
                     success: true,
-                    // total: resp.totalCount,
-                    // pageSize: resp.pageSize,
-                    // totalPage: resp.totalPage,
+                    total: resp.totalCount,
+                    pageSize: resp.pageSize,
+                    totalPage: resp.totalPage,
                 }
             }
         }
@@ -125,17 +118,15 @@ const PubDicMana = () => {
     }
 
     const delTableData = async (record: any) => {
-        //   const resp = await delData(record.dictId);
-        //   if(resp){
-        //     set_reload(true);
-        //     message.success('操作成功!');
-        //   }
+          const resp = await delData(record.dictDataId);
+          if(resp){
+            set_reload(true);
+          }
     }
 
     const updateTable = async (formVal: any, type: 'EDIT' | "ADD") => {
         if (type == 'EDIT') {
-            const {dictDataId} = currentEdit;
-            const resp = await editPubDicRelaTbaleData({...formVal,dictDataId});
+            const resp = await editPubDicRelaTbaleData({...formVal});
             if (resp) {
                 set_reload(true);
             }
@@ -151,7 +142,7 @@ const PubDicMana = () => {
     }
 
     const UpDataActBtn = ({ record, type }: { record: any, type: 'EDIT' | 'ADD' }) => {
-        set_currentEdit(record);
+       
         return (
             <ModalForm
                 title={`${type == 'EDIT' ? '编辑' : '新增'}公用字典(职称)`}
@@ -161,7 +152,7 @@ const PubDicMana = () => {
                     type == 'EDIT' ? <a key="edit" >编辑</a> : <span className='add'>新增</span>
                 }
                 onFinish={(val) => {
-                    return updateTable(val, type);
+                    return updateTable(type == 'EDIT'?{...val,dictDataId:record.dictDataId}:val, type);
                 }}
             >
                 <ProFormText

+ 10 - 1
src/pages/platform/setting/pubDicMana/service.ts

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-07 11:12:10
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-03-07 15:20:00
+ * @LastEditTime: 2023-03-08 17:04:57
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicMana/service.ts
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -70,3 +70,12 @@ export const editPubDicRelaTbaleData = (data:EditPubDicRelaTbaleDataType) => {
       data
     });
 };
+
+
+//删除表格操作
+export const delData = (dictDataId:string) => {
+    return request('/centerSys/sysdictdata/deleteData', {
+      method: 'POST',
+      params:{dictDataId}
+    });
+  };

+ 5 - 5
src/pages/platform/setting/pubDicMana/style.less

@@ -1,13 +1,12 @@
 .PubDicMana {
   width: 100%;
-  display: flex;
-  flex-direction: row;
-  justify-content: space-between;
+  overflow: hidden;
 
   .left {
+    float: left;
     border-radius: 4px;
     width: 220px;
-    height: 100%;
+    height:calc(100vh - 80px);
     overflow: scroll;
     margin-right: 16px;
     padding: 16px;
@@ -43,7 +42,8 @@
   }
 
   .right {
-    width: calc(100% - 220px);
+    float: left;
+    width: calc(100% - 236px);
     padding: 16px;
     border-radius: 4px;
     background: #FFFFFF;

+ 9 - 14
src/pages/platform/setting/pubDicTypeMana/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-03-07 16:34:16
+ * @LastEditTime: 2023-03-09 15:57:36
  * @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
  */
@@ -35,29 +35,24 @@ export default function PubDicTypeMana() {
     const columns = [
         {
             title: '类型名称',
-            align: 'center',
             dataIndex: 'dictName',
 
         },
         {
             title: '类型代码',
-            align: 'center',
             dataIndex: 'dictType',
         },
         {
             title: '说明',
-            align: 'center',
             dataIndex: 'remark',
         },
-        {
-            title: '院区',
-            align: 'center',
-            dataIndex: 'hospName',
+        // {
+        //     title: '院区',
+        //     dataIndex: 'hospName',
 
-        },
+        // },
         {
             title: '操作',
-            align: 'center',
             key: 'option',
             width: 120,
             valueType: 'option',
@@ -104,14 +99,14 @@ export default function PubDicTypeMana() {
     const updateTable = async (formVal: any, type: 'EDIT' | "ADD") => {
        
         if (type == 'ADD') {
-            const resp = await addData(formVal);
+            const resp = await addData({...formVal,hospId:0});
             if (resp) {
                 set_reload(true);
             }
         }
         if (type == 'EDIT') {
             const {dictId} = currentEdit;
-            const resp = await editData({...formVal,dictId});
+            const resp = await editData({...formVal,dictId,hospId:0});
             if (resp) {
                 set_reload(true);
             }
@@ -134,7 +129,7 @@ export default function PubDicTypeMana() {
                     return updateTable(val, type);
                 }}
             >
-                <ProFormSelect
+                {/* <ProFormSelect
                     name="hospId"
                     label="院区:"
                     disabled={type == 'EDIT'}
@@ -156,7 +151,7 @@ export default function PubDicTypeMana() {
                     fieldProps={{
 
                     }}
-                />
+                /> */}
                 <ProFormText
                     name="dictName"
                     label="类型名称:"

+ 46 - 2
src/utils.ts

@@ -1,12 +1,15 @@
 /*
  * @Author: your name
  * @Date: 2022-01-13 17:09:05
- * @LastEditTime: 2022-03-03 15:02:41
- * @LastEditors: Please set LastEditors
+ * @LastEditTime: 2023-03-09 15:44:36
+ * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/src/utils.js
  */
 
+
+import axios from 'axios';
+
 export const randomString = (length: number) => {
   const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_=-';
   let result = '';
@@ -39,3 +42,44 @@ export const getValsFromTree = (data: TreeItemType[], key: string) => {
 };
 
 export const searchTree = (treeData: TreeItemType[]) => {};
+
+
+
+export const downloadTemplateReq = (path:string) => {
+
+  const userData = localStorage.getItem('userData');
+  const { token = '' } = JSON.parse(userData as any);
+
+  axios({
+      method: 'get',
+      url: path,
+      responseType: 'blob',
+      headers: { token },
+  })
+      .then(function (response:any) {
+          //console.log({ 'chunk': response });
+          const filename = decodeURI(response.headers["content-disposition"]);
+          const objectUrl = URL.createObjectURL(
+              new Blob([response.data], {
+                  type: 'application/vnd.ms-excel',
+              })
+          )
+          const link = document.createElement('a')
+          // 设置导出的文件名称
+          link.download = `${filename}` + '.xls'
+          link.style.display = 'none'
+          link.href = objectUrl
+          link.click()
+          document.body.appendChild(link)
+
+      });
+
+
+
+}
+
+
+
+
+
+