Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
975f5d33
Commit
975f5d33
authored
Nov 20, 2020
by
张烨
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://g.civnet.cn:8443/test/maintenance
parents
02a9c759
8bd2d251
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
4 deletions
+76
-4
UserManage.js
src/pages/userCenter/UserManage.js
+70
-4
api.js
src/services/userCenter/userManage/api.js
+6
-0
No files found.
src/pages/userCenter/UserManage.js
View file @
975f5d33
...
@@ -51,6 +51,7 @@ import {
...
@@ -51,6 +51,7 @@ import {
deleteOrg
as
postDeleteOrg
,
deleteOrg
as
postDeleteOrg
,
updateUserPassword
,
updateUserPassword
,
setUserRelation
,
setUserRelation
,
setUserRelations
,
multiDeleteUsers
,
multiDeleteUsers
,
}
from
'@/services/userCenter/userManage/api'
;
}
from
'@/services/userCenter/userManage/api'
;
import
classnames
from
'classnames'
;
import
classnames
from
'classnames'
;
...
@@ -97,6 +98,7 @@ const UserManage = () => {
...
@@ -97,6 +98,7 @@ const UserManage = () => {
const
[
orgIDs
,
setOrgIDs
]
=
useState
(
''
);
// 批量操作的机构
const
[
orgIDs
,
setOrgIDs
]
=
useState
(
''
);
// 批量操作的机构
const
[
multiDelete
,
setMultiDelete
]
=
useState
(
false
);
// 是否批量删除用户
const
[
multiDelete
,
setMultiDelete
]
=
useState
(
false
);
// 是否批量删除用户
const
[
multiChangeOrgs
,
setMultiChangeOrgs
]
=
useState
(
false
);
// 是否批量更改机构
const
[
multiChangeOrgs
,
setMultiChangeOrgs
]
=
useState
(
false
);
// 是否批量更改机构
const
[
multiRelateRoles
,
setMultiRelateRoles
]
=
useState
(
false
);
// 是否批量更改机构
const
[
rolelist
,
setRolelist
]
=
useState
([]);
// 角色列表
const
[
rolelist
,
setRolelist
]
=
useState
([]);
// 角色列表
const
[
stationlist
,
setStationlist
]
=
useState
([]);
// 站点列表
const
[
stationlist
,
setStationlist
]
=
useState
([]);
// 站点列表
...
@@ -279,7 +281,7 @@ const UserManage = () => {
...
@@ -279,7 +281,7 @@ const UserManage = () => {
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
console
.
log
(
selectedRowKeys
.
toString
());
console
.
log
(
selectedRowKeys
.
toString
());
console
.
log
(
selectedRows
.
map
(
item
=>
item
.
OUID
).
toString
());
console
.
log
(
selectedRows
.
map
(
item
=>
item
.
OUID
).
toString
());
setUserIDs
(
selectedRowKeys
.
toString
());
setUserIDs
(
selectedRowKeys
.
toString
());
// 数组转字符串,逗号连接
setOrgIDs
(
selectedRows
.
map
(
item
=>
item
.
OUID
).
toString
());
setOrgIDs
(
selectedRows
.
map
(
item
=>
item
.
OUID
).
toString
());
// 选中行数大于1时设置批量操作可行
// 选中行数大于1时设置批量操作可行
if
(
selectedRows
.
length
>
1
)
{
if
(
selectedRows
.
length
>
1
)
{
...
@@ -451,7 +453,9 @@ const UserManage = () => {
...
@@ -451,7 +453,9 @@ const UserManage = () => {
/** ***用户批量操作****** */
/** ***用户批量操作****** */
// 用户关联
// 用户关联
const
relateRoles
=
()
=>
{
const
relateRoles
=
()
=>
{
getEmptyRoleList
();
setRoleVisible
(
true
);
setRoleVisible
(
true
);
setMultiRelateRoles
(
true
);
};
};
// 更改机构
// 更改机构
const
changeOrgs
=
()
=>
{
const
changeOrgs
=
()
=>
{
...
@@ -667,6 +671,29 @@ const UserManage = () => {
...
@@ -667,6 +671,29 @@ const UserManage = () => {
message
.
error
(
err
);
message
.
error
(
err
);
});
});
};
};
// 获取全部未勾选的角色列表与站点列表
const
getEmptyRoleList
=
()
=>
{
setLoading
(
true
);
getUserRelationList
(
''
)
.
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
roleList
&&
res
.
roleList
.
length
>
0
)
{
const
{
roleList
,
stationList
}
=
res
;
setRolelist
(
roleList
);
setStationlist
(
stationList
);
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
setLoading
(
false
);
setTableLoading
(
false
);
message
.
error
(
err
);
});
};
// 提交-关联角色
// 提交-关联角色
const
submitRole
=
()
=>
{
const
submitRole
=
()
=>
{
setUserRelation
(
setUserRelation
(
...
@@ -698,6 +725,38 @@ const UserManage = () => {
...
@@ -698,6 +725,38 @@ const UserManage = () => {
message
.
error
(
err
);
message
.
error
(
err
);
});
});
};
};
// 提交-批量关联角色
const
submitRoles
=
()
=>
{
setUserRelations
(
userIDs
,
Object
.
keys
(
roleValueList
)
.
map
(
k
=>
roleValueList
[
k
])
.
flat
()
.
toString
(),
Object
.
keys
(
stationValueList
)
.
map
(
k
=>
stationValueList
[
k
])
.
flat
()
.
toString
(),
)
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setRoleVisible
(
false
);
// 跳转到组织
onSelect
([
currentSelectOrg
]);
notification
.
success
({
message
:
'提交成功'
,
});
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
'角色不能为空'
,
});
}
})
.
catch
(
err
=>
{
message
.
error
(
err
);
});
};
// 提交-更改机构
// 提交-更改机构
const
submitChangeOrg
=
()
=>
const
submitChangeOrg
=
()
=>
addToOrg
(
currentUser
.
userID
,
currentUser
.
OUID
,
newOrgID
)
addToOrg
(
currentUser
.
userID
,
currentUser
.
OUID
,
newOrgID
)
...
@@ -727,6 +786,10 @@ const UserManage = () => {
...
@@ -727,6 +786,10 @@ const UserManage = () => {
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
setChangeOrgVisible
(
false
);
setChangeOrgVisible
(
false
);
// 跳转到新组织机构下的用户表
// 跳转到新组织机构下的用户表
const
temp
=
orgIDs
.
split
(
','
);
// 批量更改机构成功后设置老的orgIDs为全部是newOrgID的数组,并转字符串
setOrgIDs
(
temp
.
map
(()
=>
newOrgID
).
toString
());
// console.log(temp.map(() => newOrgID).toString());
onSelect
([
newOrgID
]);
onSelect
([
newOrgID
]);
notification
.
success
({
notification
.
success
({
message
:
'提交成功'
,
message
:
'提交成功'
,
...
@@ -1144,8 +1207,11 @@ const UserManage = () => {
...
@@ -1144,8 +1207,11 @@ const UserManage = () => {
<
Modal
<
Modal
title
=
"用户关联"
title
=
"用户关联"
visible
=
{
roleVisible
}
visible
=
{
roleVisible
}
onOk
=
{
submitRole
}
onOk
=
{
multiRelateRoles
?
submitRoles
:
submitRole
}
onCancel
=
{()
=>
setRoleVisible
(
false
)}
onCancel
=
{()
=>
{
setRoleVisible
(
false
);
setMultiRelateRoles
(
false
);
}}
okText
=
"确认"
okText
=
"确认"
cancelText
=
"取消"
cancelText
=
"取消"
width
=
"960px"
width
=
"960px"
...
@@ -1272,7 +1338,7 @@ const UserManage = () => {
...
@@ -1272,7 +1338,7 @@ const UserManage = () => {
},
},
]}
]}
>
>
<
Input
placeholder
=
"请输入手机号码"
/>
<
Input
placeholder
=
"请输入手机号码"
autoComplete
=
"off"
/>
<
/Form.Item
>
<
/Form.Item
>
<
Form
.
Item
<
Form
.
Item
name
=
"email"
name
=
"email"
...
...
src/services/userCenter/userManage/api.js
View file @
975f5d33
...
@@ -176,3 +176,9 @@ export const setUserRelation = (userID, roleList = [], stationList) =>
...
@@ -176,3 +176,9 @@ export const setUserRelation = (userID, roleList = [], stationList) =>
},
},
},
},
);
);
export
const
setUserRelations
=
(
userIDs
,
roleList
,
stationList
)
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/SetUserRoleMap`
,
{
userIds
:
userIDs
,
roleIds
:
roleList
||
''
,
stationList
:
stationList
||
''
,
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment