فهرست منبع

Merge remote-tracking branch 'origin/dev' into dev

zhouna 3 سال پیش
والد
کامیت
b34401d254

+ 5 - 0
src/common/common.less

@@ -185,4 +185,9 @@ body{
     vertical-align: middle;
     text-align: center;
   }
+}
+.user{
+  .ant-form-item{
+    margin-bottom: 15px;
+  }
 }

+ 1 - 1
src/components/BlockLossManage/index.js

@@ -308,7 +308,7 @@ function BlockLossManage() {
                 </div>
                 <Table
                     columns={columns}
-                    scroll={{ y: 'calc(100vh - 400px)' }}
+                    scroll={{ y: 'calc(100vh - 470px)' }}
                     dataSource={blockList}
                     rowKey={record => record.id}
                     pagination={{

+ 2 - 2
src/components/FieldProblem/index.js

@@ -49,7 +49,7 @@ function FieldProblem() {
     function getColumnResultNumber() {
         post(api.getColumnResultNumber, { hospitalId: getCookie('hospitalId') }).then((res) => {
             if (res.data.code === 200) {
-                const data = res.data.data;
+                const data = res.data.data || [];
                 setProbleData(data)
             }
         })
@@ -263,7 +263,7 @@ function FieldProblem() {
                 </div>
                 <Table
                     columns={columns}
-                    scroll={{ y: 'calc(100vh - 400px)' }}
+                    scroll={{ y: 'calc(100vh - 470px)' }}
                     dataSource={logList}
                     rowKey={record => record.id}
                     pagination={{

+ 21 - 9
src/components/FieldRules/addRules.js

@@ -60,7 +60,7 @@ function ContentForm(props) {
     const [colList, setColList] = useState([]);//字段名称
     const [list, setList] = useState([]);
     const [isChange, seIsChange] = useState(true);
-    const { type,detail } = useContext(FiledContext);
+    const { type, detail } = useContext(FiledContext);
     const { back, form, cancel } = props;
     const initialValues = detail
     const vilidateRules = {
@@ -89,7 +89,7 @@ function ContentForm(props) {
                 });
                 setTableList(columnList);
                 setList(data)
-                if(type == 2){
+                if (type == 2) {
                     data.forEach((item, i) => {
                         detail.columnList.forEach(it => {
                             if (item.getTableNameDTO.tableCname == it.tableCname) {
@@ -97,7 +97,7 @@ function ContentForm(props) {
                                 setColList([...colList])
                             }
                         });
-        
+
                     });
                 }
             }
@@ -109,6 +109,14 @@ function ContentForm(props) {
         seIsChange(false)
         setColList([...colList])
     }
+    function colchange(value, options){
+        const formData = form.getFieldsValue();
+        let columnList = formData.columnList;
+        columnList[options.index].id = options.key
+        form.setFieldsValue({
+            columnList: columnList
+        });
+    }
     //表字段添加
     function modifyData(i) {
         const formData = form.getFieldsValue();
@@ -163,15 +171,16 @@ function ContentForm(props) {
     }
     function addColumnVerify() {
         const formData = form.getFieldsValue();
+        console.log(formData);
         let arr = []
         let url
         formData.standardValueList.forEach(it => {
             arr.push(it.tit)
         });
         formData.standardValueList = arr
-        if(type == 1){
+        if (type == 1) {
             url = api.addColumnVerify
-        }else{
+        } else {
             url = api.updateColumnVerify
             // formData.id = detail.columnId
         }
@@ -245,23 +254,26 @@ function ContentForm(props) {
                                         </div>
                                         <div className='item-box'>
                                             <Form.Item label="字段名称(中文)" rules={[{ required: true }]} style={{ width: '50%' }} name={['columnList', i, 'columnCname']} labelAlign="right">
-                                                <Select allowClear style={{ width: 160 }} placeholder="请选择" disabled={isChange}>
+                                                <Select allowClear onChange={colchange} style={{ width: 160 }} placeholder="请选择" disabled={isChange}>
                                                     {colList.map((item) => {
                                                         return (
-                                                            <Option value={item.columnCname} key={item.columnCname}>{item.columnCname}</Option>
+                                                            <Option value={item.columnCname} key={item.id} index={i}>{item.columnCname}</Option>
                                                         )
                                                     })}
                                                 </Select>
                                             </Form.Item>
                                             <Form.Item label="字段名称(英文)" rules={[{ required: true }]} name={['columnList', i, 'columnEname']} labelAlign="right">
-                                                <Select allowClear style={{ width: 160 }} placeholder="请选择" disabled={isChange}>
+                                                <Select allowClear onChange={colchange} style={{ width: 160 }} placeholder="请选择" disabled={isChange}>
                                                     {colList.map((item) => {
                                                         return (
-                                                            <Option value={item.columnEname} key={item.columnEname}>{item.columnEname}</Option>
+                                                            <Option value={item.columnEname} key={item.id} index={i}>{item.columnEname}</Option>
                                                         )
                                                     })}
                                                 </Select>
                                             </Form.Item>
+                                            <Form.Item hidden={true} name={['columnList', i, 'id']} noStyle>
+                                                <Input />
+                                            </Form.Item>
                                         </div>
                                     </div>
                                     <img onClick={() => modifyData(i)} src={i == 0 ? add : del} />

+ 4 - 2
src/components/FieldRules/index.js

@@ -137,7 +137,8 @@ function FieldRules() {
                     columnCname: undefined,
                     columnEname: undefined,
                     ableCname: undefined,
-                    tableEname: undefined
+                    tableEname: undefined,
+                    id:undefined
                 }],
                 standardValueList: [{
                     tit: ''
@@ -162,6 +163,7 @@ function FieldRules() {
                         columnEname: data.columnEname,
                         tableCname: data.tableCname,
                         tableEname: data.tableEname,
+                        id:data.id
                     }],
                     standardValueList: [{
                         tit: data.standardvalue,
@@ -343,7 +345,7 @@ function FieldRules() {
                     <h2 className="table-title">字段校验规则维护</h2>
                     <Space size="middle">
                         <Button type="primary" icon={<PlusOutlined />} onClick={() => showModal(1)}>新增</Button>
-                        <Button type="primary" icon={<DeleteOutlined />} onClick={() => showDelModal(true)} danger>删除</Button>
+                        <Button type="primary" onClick={() => showDelModal(true)} danger>删除</Button>
                     </Space>
 
                 </div>

+ 1 - 1
src/components/RegularManage/addRegular.js

@@ -36,7 +36,7 @@ function EditBlock(props) {
     }
 
     function cancel() {
-        props.userChange()
+        props.cancel()
     }
     return (
         <>

+ 24 - 9
src/components/RegularManage/index.js

@@ -16,7 +16,8 @@ function RegularManage() {
     }, []);
     const [regularList, setRegularList] = useState([]);
     const [total, setTotal] = useState(0);
-    const [title, setTitle] = useState(0);
+    const [title, setTitle] = useState();
+    const [tip, setTip] = useState();
     const [type, setType] = useState(0);//1新增 2修改
     const [visible, setVisible] = useState(false);
     const [delvisible, setDelVisible] = useState(false);
@@ -73,10 +74,12 @@ function RegularManage() {
         setType(type)
         setRegularDetail(record)
     }
-    function cancel() { }
+    function cancel() {
+        setVisible(false)
+    }
     function userChange() {
         setVisible(false)
-        getRegularPage();
+        getRegularPage()
     }
     function onSizeChange(current, pageSize) {
         params.current = current
@@ -98,6 +101,18 @@ function RegularManage() {
         onChange: onSelectChange,
     };
     function onSelectChange(selectedRowKeys) {
+        let arr = []
+        selectedRowKeys.forEach(it => {
+            arr.push(it.split('-')[1])
+        });
+        if (arr.indexOf('1') > 0) {
+            console.log(123);
+            setTip('正则式关联字段校验规则,删除后将取消关联且无法恢复,确认删除这' + selectedRowKeys.length + '条正则式?')
+        } else {
+            console.log(456);
+            setTip('正则式删除后将无法恢复,确认删除这' + selectedRowKeys.length + '条正则式?')
+        }
+
         setSelectedRowKeys(selectedRowKeys);
     };
     const onFinish = (value) => {
@@ -162,8 +177,8 @@ function RegularManage() {
                 <div className="table-header">
                     <h2 className="table-title">正则式维护</h2>
                     <Space size="middle">
-                        <Button type="primary" icon={<PlusOutlined />} onClick={() => showModal('新增正则式', 1,{})}>新增</Button>
-                        <Button type="primary" icon={<DeleteOutlined />} onClick={() => showDelModal(true)} danger>删除</Button>
+                        <Button type="primary" icon={<PlusOutlined />} onClick={() => showModal('新增正则式', 1, {})}>新增</Button>
+                        <Button type="primary" onClick={() => showDelModal(true)} danger>删除</Button>
                     </Space>
 
                 </div>
@@ -173,7 +188,7 @@ function RegularManage() {
                     rowSelection={rowSelection}
                     scroll={{ y: 'calc(100vh - 380px)' }}
                     dataSource={regularList}
-                    rowKey={record => record.id}
+                    rowKey={record => record.id + '-' + record.relation}
                     pagination={{
                         pageSize: size,
                         size: 'small',
@@ -199,14 +214,14 @@ function RegularManage() {
                     forceRender={true}
                 >
                     <RegularContext.Provider value={{ regularDetail, type }}>
-                        <AddRegular userChange={userChange} />
+                        <AddRegular userChange={userChange} cancel={cancel} />
                     </RegularContext.Provider>
 
                 </Modal>
                 : ''}
 
             <Modal
-                title="删除职务职称变更记录"
+                title="删除正则式"
                 okText='确定'
                 cancelText='取消'
                 width={400}
@@ -215,7 +230,7 @@ function RegularManage() {
                 /*confirmLoading={confirmLoading}*/
                 onCancel={() => showDelModal(false)}
             >
-                <p>字段校验规则删除后将无法恢复,确认删除这{selectedRowKeys.length}条变更记录?</p>
+                <p>{tip}</p>
             </Modal>
         </div >
     )

+ 51 - 46
src/components/UserManager/addUser.js

@@ -1,7 +1,7 @@
 import React, {
   useState, useEffect, useContext
 } from 'react';
-import {  Form, Input, Select, Button, Switch, TreeSelect, message, Space } from 'antd';
+import { Form, Input, Select, Button, Switch, TreeSelect, message, Space } from 'antd';
 import apiObj from '@api/index';
 import { organizationData } from '@utils/index'
 import UserContext from './user-context';
@@ -28,7 +28,7 @@ function AddUser(props) {
   });
   const { titleList } = staticInfo;
   const initialValues = formData;
-  console.log(initialValues);
+  const hospitalName = formData.hospitalName ? formData.hospitalName.join(","):[]
   let addHospitalTreeVOs = {
     depts: [],
     hospitals: [],
@@ -61,8 +61,6 @@ function AddUser(props) {
     xPost(api.getCreateRoles, params).then((res) => {
       if (res.data.code === 200) {
         const data = res.data.data;
-        console.log(data);
-        
         let arr = JSON.parse(JSON.stringify(data).replace(/name/g, 'title').replace(/id/g, 'value'))
         setTreeRloe(arr)
       }
@@ -171,7 +169,7 @@ function AddUser(props) {
     })
   }
   function cancel() {
-    props.userChange()
+    props.cancel()
   }
 
   return (
@@ -183,6 +181,7 @@ function AddUser(props) {
         name="register"
         onFinish={onFinish}
         initialValues={initialValues}
+        className='user'
       >
         <Form.Item
           name="username"
@@ -197,7 +196,7 @@ function AddUser(props) {
           {type == 3 ?
             <span>{initialValues.username}</span>
             :
-            <Input placeholder="用户名是组织中唯一标识,请勿重复" autoComplete='off'/>
+            <Input placeholder="用户名是组织中唯一标识,请勿重复" autoComplete='off' />
           }
 
         </Form.Item>
@@ -214,7 +213,7 @@ function AddUser(props) {
           {type == 3 ?
             <span>{initialValues.mobilePhone}</span>
             :
-            <Input placeholder="请输入手机号码" autoComplete='off'/>
+            <Input placeholder="请输入手机号码" autoComplete='off' />
           }
 
         </Form.Item>
@@ -225,7 +224,7 @@ function AddUser(props) {
             {
               required: true,
               message: '8-12位大小写字母、数字、特殊字符',
-            }, 
+            },
             {
               min: 8,
               message: '密码不能少于8个字符',
@@ -238,7 +237,7 @@ function AddUser(props) {
           {type == 3 ?
             <span>{initialValues.password}</span>
             :
-            <Input.Password placeholder="8-12位大小写字母、数字、特殊字符" autoComplete='off' disabled={type == 2?true:false}/>
+            <Input.Password placeholder="8-12位大小写字母、数字、特殊字符" autoComplete='off' disabled={type == 2 ? true : false} />
           }
         </Form.Item>
         <Form.Item
@@ -263,7 +262,7 @@ function AddUser(props) {
           {type == 3 ?
             <span>{initialValues.password}</span>
             :
-            <Input.Password placeholder="8-12位大小写字母、数字、特殊字符" autoComplete='off' disabled={type == 2?true:false}/>
+            <Input.Password placeholder="8-12位大小写字母、数字、特殊字符" autoComplete='off' disabled={type == 2 ? true : false} />
           }
         </Form.Item>
         <Form.Item
@@ -274,7 +273,7 @@ function AddUser(props) {
           {type == 3 ?
             <span>{initialValues.name}</span>
             :
-            <Input placeholder="请输入姓名" autoComplete='off'/>
+            <Input placeholder="请输入姓名" autoComplete='off' />
           }
 
         </Form.Item>
@@ -285,7 +284,7 @@ function AddUser(props) {
           {type == 3 ?
             <span>{initialValues.idcard}</span>
             :
-            <Input placeholder="请输入身份证号码" autoComplete='off'/>
+            <Input placeholder="请输入身份证号码" autoComplete='off' />
           }
 
         </Form.Item>
@@ -294,34 +293,40 @@ function AddUser(props) {
           label="所属组织"
           rules={[{ required: true, message: '请选择所属组织' }]}
         >
-          <TreeSelect
-            showSearch={false}
-            treeData={treeData}
-            onChange={onChange}
-            maxTagCount={1}
-            treeCheckable
-            showCheckedStrategy={SHOW_PARENT}
-            placeholder="请选择"
-            style={{ width: '100%' }}
-          />
+
+          {type == 3 ?
+            <span>{hospitalName}</span>
+            :
+            <TreeSelect
+              showSearch={false}
+              treeData={treeData}
+              onChange={onChange}
+              maxTagCount={1}
+              treeCheckable
+              showCheckedStrategy={SHOW_PARENT}
+              placeholder="请选择"
+              style={{ width: '100%' }}
+            />
+          }
+
         </Form.Item>
-		<Form.Item
-			name="titleId"
-			label="医疗组"
-		>
-		  {type == 3 ?
-			  <span>{initialValues.idcard}</span>
-			  :
-			  <Select placeholder="请选择">
-				{titleList.map((item) => {
-				  return (
-					  <Option value={item.name} key={item.name}>{item.val}</Option>
-				  )
-				})}
-			  </Select>
-		  }
+        <Form.Item
+          name="titleId"
+          label="医疗组"
+        >
+          {type == 3 ?
+            <span>{initialValues.idcard}</span>
+            :
+            <Select placeholder="请选择">
+              {titleList.map((item, i) => {
+                return (
+                  <Option value={item.name} key={i}>{item.val}</Option>
+                )
+              })}
+            </Select>
+          }
 
-		</Form.Item>
+        </Form.Item>
         <Form.Item
           name="titleId"
           label="职称"
@@ -330,9 +335,9 @@ function AddUser(props) {
             <span>{initialValues.idcard}</span>
             :
             <Select placeholder="请选择职称">
-              {titleList.map((item) => {
+              {titleList.map((item, i) => {
                 return (
-                  <Option value={item.name} key={item.name}>{item.val}</Option>
+                  <Option value={item.name} key={i}>{item.val}</Option>
                 )
               })}
             </Select>
@@ -346,7 +351,7 @@ function AddUser(props) {
           {type == 3 ?
             <span>{initialValues.jobNo}</span>
             :
-            <Input placeholder="请输入工号" autoComplete='off'/>
+            <Input placeholder="请输入工号" autoComplete='off' />
           }
 
         </Form.Item>
@@ -359,7 +364,7 @@ function AddUser(props) {
             <div>
               {roleList.map((it, i) => {
                 return (
-                  <span key={it.id}>{it.roleName}、</span>
+                  <span key={i}>{it.roleName}、</span>
                 );
               })}
             </div>
@@ -383,7 +388,7 @@ function AddUser(props) {
           {type == 3 ?
             <span>{initialValues.orderNo}</span>
             :
-            <Input placeholder="大于0的整数" autoComplete='off'/>
+            <Input placeholder="大于0的整数" autoComplete='off' />
           }
 
         </Form.Item>
@@ -405,7 +410,7 @@ function AddUser(props) {
             <Space size="middle">
               <Button type="primary" onClick={e => cancel()}>
                 返回
-            </Button>
+              </Button>
             </Space>
           </Form.Item>
           :
@@ -413,10 +418,10 @@ function AddUser(props) {
             <Space size="middle">
               <Button htmlType="button" onClick={e => cancel()}>
                 取消
-            </Button>
+              </Button>
               <Button type="primary" htmlType="submit">
                 保存
-            </Button>
+              </Button>
             </Space>
           </Form.Item>}
 

+ 24 - 2
src/components/UserManager/index.js

@@ -7,6 +7,7 @@ import { useSelector } from 'react-redux'
 import apiObj from '@api/index';
 import UserContext from './user-context';
 import { getValueFromEvent } from '@utils/index'
+import { logDOM } from '@testing-library/react';
 
 const { post, api, xPost } = apiObj;
 const { Option } = Select;
@@ -41,6 +42,7 @@ function UserManager() {
     return state.staticInfo;
   });
   let list = []
+  let listName = []
   let data = {
     pages: 1,
     current: 1,
@@ -94,7 +96,9 @@ function UserManager() {
           roles: roles,
           orderNo: data.orderNo,
           status: data.status,
+          hospitalName:getHospitalsName(data.hospitals)
         }
+        console.log(arr);
         setRoleList(data.roles)
         setFormData(arr)
       }
@@ -115,7 +119,6 @@ function UserManager() {
       }
       if (item.type != 0 && item.relation == 1) {
         list.push(item.value)
-        console.log(list)
       }
       if (item.children) {
         getHospitals(item.children)
@@ -123,6 +126,25 @@ function UserManager() {
     })
     return list
   }
+  // 处理组织结构数据回显
+  function getHospitalsName(arr) {
+    arr.forEach((item, i, array) => {
+      if (!item.children && item.depts) {
+        item.depts.forEach(it => {
+          if (it.relation == 1) {
+            listName.push(it.deptName)
+          }
+        })
+      }
+      if (item.type != 0 && item.relation == 1) {
+        listName.push(item.hospitalName)
+      }
+      if (item.children) {
+        getHospitalsName(item.children)
+      }
+    })
+    return listName
+  }
   // 禁用/启用接口
   function disableUser(userId, status) {
     const param = { userId: userId, status: status };
@@ -357,7 +379,7 @@ function UserManager() {
           forceRender={true}
         >
           <UserContext.Provider value={{ userId, type, formData, roleList }}>
-            <AddUser userChange={userChange} />
+            <AddUser userChange={userChange} cancel={cancel} />
           </UserContext.Provider>
 
         </Modal>