{
dispatch(createUser(values.contract)).then(res => {
if (res.success) {
setModalVisible(false);
- dispatch(getDepUser(depSelectedKeys[0]));
+ dispatch(getDepMessage());
}
});
}
@@ -125,6 +129,18 @@ const UserManage = (props) => {
}
}
+ //打开部门弹窗
+ const openDepModal = (type, record) => {
+ setDepModalVisible(true)
+ setDepModalType(type)
+ if (type == 'edit') {
+ setDepModalRecord(record);
+ } else {
+ setModalRecord(null);
+ }
+
+ }
+
//删除用户
const delUsers = (ids, type) => {
dispatch(delUser(ids)).then(res => {
@@ -144,7 +160,53 @@ const UserManage = (props) => {
}
});
}
+ //部门新增及编辑
+ const onDepConfirm = (data) => {
+ if (depModalType == 'edit') {
+ dispatch(updateDep(data)).then(res => {
+ if (res.success) {
+ setDepModalVisible(false);
+ dispatch(getDepMessage());
+ }
+ });
+ } else {
+ dispatch(createDep(data)).then(res => {
+ if (res.success) {
+ setDepModalVisible(false);
+ dispatch(getDepMessage());
+ }
+ });
+ }
+
+ }
+ // 删除部门
+ const delDepartment = (id) => {
+ dispatch(delDep(id)).then(res => {
+ dispatch(getDepMessage())
+ });
+ }
+ const renderTree = (item, id) => {
+ return
+
+ {item.name}
+
+
+ {
+ depSelectedKeys == id ? <>
+
{
+ setDepModalRecord(item)
+ setDepModalVisible(true)
+ setDepModalType('edit')
+ }} />
+ { delDepartment(id) }}>
+
+
+ > : null
+ }
+
+
+ }
return (
@@ -155,7 +217,7 @@ const UserManage = (props) => {
type="primary"
key="primary"
style={{ marginLeft: 50 }}
- onClick={() => openModal('create')}
+ onClick={() => openDepModal('create')}
>新建部门
{
depMessage.length ?
@@ -164,19 +226,33 @@ const UserManage = (props) => {
defaultExpandedKeys={[depMessage[0].id]}
selectedKeys={depSelectedKeys}
onSelect={(selectedKeys, e) => {
+
if (e.selected) {
setDepSelectedKeys(selectedKeys)
dispatch(getDepUser(selectedKeys[0]))
}
}}
- treeData={depMessage}
- fieldNames={{
- title: 'name',
- key: 'id',
- children: 'subordinate'
- }}
style={{ paddingTop: 20 }}
- /> : ''
+ >
+ {
+ depMessage?.map((s, index) => {
+ return
+ {
+ s.subordinate.map(k => {
+ return { setIShowIcon(k.id) }} onMouseOut={() => { setIShowIcon(null) }}>
+ {
+ k.subordinate.map(i => {
+ return { setIShowIcon(i.id) }} onMouseOut={() => { setIShowIcon(null) }}>
+
+ })
+ }
+
+ })
+ }
+
+ })
+ }
+ : ''
}
@@ -234,6 +310,14 @@ const UserManage = (props) => {
onVisibleChange={setPwdModalVisible}
onConfirm={onPwdConfirm} /> : ''}
+ {depModalVisible ? : ''}
+
+
+
@@ -254,4 +338,4 @@ function mapStateToProps(state) {
};
}
-export default connect(mapStateToProps)(UserManage);
\ No newline at end of file
+export default connect(mapStateToProps)(UserManage);
diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js
index 1f6a90bf..96b86ae0 100644
--- a/web/client/src/utils/webapi.js
+++ b/web/client/src/utils/webapi.js
@@ -9,7 +9,7 @@ export const ApiTable = {
//组织管理-用户管理-部门
getDepMessage: 'department',
- createMessage: 'department',
+ createDepMessage: 'department',
updateDepMessage: 'department',
delDepMessage: 'department/{depId}',
//组织管理-用户管理-用户
@@ -18,7 +18,7 @@ export const ApiTable = {
updateUser: 'department/user/{userId}',
delUser: 'department/user/{userIds}',
- resetPwd: '/organization/department/user/resetPwd/{id}',
+ resetPwd: 'department/user/{userId}/password',
//用户权限