|
@@ -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>}
|
|
|
|