Commit 2ddc42bf authored by 张烨's avatar 张烨

fix: fix org operation bugs

parent e1f52db7
......@@ -45,6 +45,8 @@ import {
deleteUser as postDeleteUser,
setUserState as postSetUserState,
editUser as postEditUser,
submitAddOrg as postAddOrg,
deleteOrg as postDeleteOrg,
updateUserPassword,
setUserRelation,
} from '@/services/userCenter/userManage/api';
......@@ -256,8 +258,7 @@ const UserManage = () => {
};
};
// 获取用户机构树
useEffect(() => {
const updateTrees = () =>
getUserTree(-1, -1)
.then(res => {
setTreeLoading(false);
......@@ -275,6 +276,10 @@ const UserManage = () => {
setTreeLoading(false);
message.error(err);
});
// 获取用户机构树
useEffect(() => {
updateTrees();
}, []);
// 获取当前机构下所有用户
......@@ -350,11 +355,13 @@ const UserManage = () => {
setRoleVisible(true);
setCurrentUser(record);
};
const changeOrg = record => {
setChangeOrgVisible(true);
setTreeData2(treeData1);
setCurrentUser(record);
};
const changePassword = record => {
setPasswordVisible(true);
passwordForm.setFieldsValue({
......@@ -362,6 +369,7 @@ const UserManage = () => {
});
setCurrentUser(record);
};
const editUser = record => {
// console.log(record);
setEditUserVisible(true);
......@@ -373,14 +381,17 @@ const UserManage = () => {
});
setCurrentUser(record);
};
const freezeUser = record => {
setFreezeUserVisible(true);
setCurrentUser(record);
};
const deleteUser = record => {
setDeleteUserVisible(true);
setCurrentUser(record);
};
// 查找用户
const submitSearchUser = () => {
getUserByKey(searchUserForm.getFieldValue('key'))
......@@ -400,6 +411,7 @@ const UserManage = () => {
message.error(err);
});
};
// 提交-添加用户
const submitAddUser = () => {
postAddUser({
......@@ -429,9 +441,10 @@ const UserManage = () => {
message.error(err);
});
};
// 提交-添加下级机构
const submitAddOrg = () => {
submitAddOrg(
postAddOrg(
orgID,
addOrgForm.getFieldValue('OUName'),
addOrgForm.getFieldValue('desrciption') || '',
......@@ -444,7 +457,7 @@ const UserManage = () => {
message: '提交成功',
});
// 重新获取机构树与用户表
getUserTree(-1, -1).then(() => {
updateTrees().then(() => {
// 只能是字符串,数字没有选择效果
onSelect([`${res.OUID}`]);
});
......@@ -459,6 +472,7 @@ const UserManage = () => {
message.error(err);
});
};
// 提交-编辑当前机构
const submitEditOrg = () =>
editOrgInfo(
......@@ -486,8 +500,10 @@ const UserManage = () => {
.catch(err => {
message.error(err);
});
// 提交删除机构
const submitDeleteOrg = () =>
deleteOrg(orgID)
postDeleteOrg(orgID)
.then(res => {
if (res.success) {
setDeleteOrgVisible(false);
......@@ -495,7 +511,7 @@ const UserManage = () => {
message: '提交成功',
});
// 重新获取机构树与用户表
getUserTree(-1, -1);
updateTrees();
} else {
notification.error({
message: '提交失败',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment