|
@@ -23,22 +23,17 @@ function AddUser(props) {
|
|
|
const staticInfo = useSelector(state => {
|
|
|
return state.staticInfo;
|
|
|
});
|
|
|
+ console.log(type);
|
|
|
+
|
|
|
const { titleList } = staticInfo;
|
|
|
const initialValues = detail
|
|
|
//所属系统
|
|
|
function getHospitalTree() {
|
|
|
- xPost(api.getUserHospitals).then((res) => {
|
|
|
- if (res.data.code === 200) {
|
|
|
- const data = res.data.data.software
|
|
|
- const treeFunc = organizationData(data)
|
|
|
- setTreeFunc(treeFunc)
|
|
|
- } else {
|
|
|
- message.warning(res.data.msg || '获取医院列表失败');
|
|
|
- }
|
|
|
- })
|
|
|
+ const arr = JSON.parse(localStorage.getItem('software'))
|
|
|
+ const treeFunc = organizationData(arr)
|
|
|
+ setTreeFunc(treeFunc)
|
|
|
}
|
|
|
function organizationData(arr) {
|
|
|
-
|
|
|
arr.forEach(item => {
|
|
|
item.value = item.id
|
|
|
item.title = item.name
|
|
@@ -65,8 +60,8 @@ function AddUser(props) {
|
|
|
const formData = form.getFieldValue()
|
|
|
let params = values
|
|
|
params.parentId = formData.parentId
|
|
|
- params.permissions = params.permissions.split(',')
|
|
|
- if (type == 2) {
|
|
|
+ params.permissions = formData.permissions?formData.permissions.split(','):''
|
|
|
+ if (type == 2 || type == 4) {
|
|
|
params.id = id
|
|
|
updateMenu(params)
|
|
|
} else {
|
|
@@ -132,6 +127,7 @@ function AddUser(props) {
|
|
|
<Form.Item
|
|
|
name="parentName"
|
|
|
label="上级菜单"
|
|
|
+ hidden={type == 2 || type == 1}
|
|
|
>
|
|
|
<Input disabled />
|
|
|
</Form.Item>
|