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
dd52e920
Commit
dd52e920
authored
Nov 20, 2020
by
Maofei94
Browse files
Options
Browse Files
Download
Plain Diff
merge: merge
parents
317391c8
96d89c11
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
99 additions
and
18 deletions
+99
-18
ItemCard.jsx
src/components/CheckGroup/ItemCard.jsx
+3
-1
index.jsx
src/components/CheckGroup/index.jsx
+12
-5
index.tsx
src/components/Upload/index.tsx
+2
-2
index.js
src/pages/user/login/index.js
+1
-1
UserManage.js
src/pages/userCenter/UserManage.js
+70
-4
RoleManage.jsx
src/pages/userCenter/roleManage/RoleManage.jsx
+1
-0
SiteManage.jsx
src/pages/userCenter/siteManage/SiteManage.jsx
+2
-3
api.js
src/services/userCenter/userManage/api.js
+6
-0
index.js
src/utils/request/index.js
+2
-2
No files found.
src/components/CheckGroup/ItemCard.jsx
View file @
dd52e920
...
...
@@ -26,7 +26,9 @@ const ListCardItem = props => {
useEffect
(()
=>
{
if
(
isGroup
)
{
const
keys
=
item
.
children
.
map
(
child
=>
checkChildrenByCondition
(
child
,
c
=>
getId
(
c
),
'map'
))
.
map
(
child
=>
checkChildrenByCondition
(
child
,
c
=>
getId
(
c
),
true
,
'map'
),
)
.
flat
(
Infinity
);
setChildrenKeys
(
keys
);
}
else
{
...
...
src/components/CheckGroup/index.jsx
View file @
dd52e920
...
...
@@ -10,14 +10,21 @@ export const getId = item =>
item
.
userID
||
item
.
roleID
||
item
.
stationID
||
item
.
id
;
export
const
checkIsGroup
=
node
=>
[
'widgetGroup'
].
includes
(
node
?.
type
||
node
)
&&
node
.
children
?.
length
>
0
;
export
const
checkChildrenByCondition
=
(
item
,
fn
,
tag
=
'every'
)
=>
{
// 递归遍历节点的方法
export
const
checkChildrenByCondition
=
(
item
,
fn
,
withGroup
=
true
,
method
=
'every'
,
)
=>
{
if
(
!
checkIsGroup
(
item
))
{
return
fn
(
item
);
}
return
[
getId
(
item
),
...
item
.
children
[
tag
](
t
=>
checkChildrenByCondition
(
t
,
fn
,
tag
)),
];
const
childrenResults
=
item
.
children
[
method
](
t
=>
checkChildrenByCondition
(
t
,
fn
,
withGroup
,
method
),
);
return
withGroup
?
[
fn
(
item
),
...
childrenResults
]
:
[...
childrenResults
];
};
const
ListCard
=
props
=>
{
...
...
src/components/Upload/index.tsx
View file @
dd52e920
...
...
@@ -90,10 +90,10 @@ class PicturesWall extends React.Component<PicturesWallType> {
uid
:
uuid
(
8
,
16
),
name
:
'熊猫运维中台系统'
,
status
:
'done'
,
url
:
this
.
getImageUrl
(
this
.
state
.
curSelectedImg
)
,
url
:
this
.
state
.
curSelectedImg
,
},
];
this
.
props
.
onChange
&&
this
.
props
.
onChange
(
fileList
);
this
.
props
.
onChange
&&
this
.
props
.
onChange
(
this
.
props
.
maxLen
===
1
?
fileList
[
0
].
url
:
fileList
.
map
(
f
=>
f
.
url
)
);
this
.
setState
({
fileList
,
wallModalVisible
:
false
});
};
...
...
src/pages/user/login/index.js
View file @
dd52e920
...
...
@@ -39,7 +39,7 @@ const Login = props => {
msg
,
}
=
result
;
if
(
pass
===
true
)
{
localStorage
.
setItem
(
'token'
,
token
?.
access_token
);
localStorage
.
setItem
(
'token'
,
token
?.
access_token
||
''
);
setUserMode
(
userMode
);
if
(
userMode
===
USER_MODE
.
ADMIN
||
userMode
===
USER_MODE
.
SUPER
)
{
const
authority
=
[
AUTHORITY
.
LOGIN
,
AUTHORITY
[
userMode
]];
...
...
src/pages/userCenter/UserManage.js
View file @
dd52e920
...
...
@@ -51,6 +51,7 @@ import {
deleteOrg
as
postDeleteOrg
,
updateUserPassword
,
setUserRelation
,
setUserRelations
,
multiDeleteUsers
,
}
from
'@/services/userCenter/userManage/api'
;
import
classnames
from
'classnames'
;
...
...
@@ -97,6 +98,7 @@ const UserManage = () => {
const
[
orgIDs
,
setOrgIDs
]
=
useState
(
''
);
// 批量操作的机构
const
[
multiDelete
,
setMultiDelete
]
=
useState
(
false
);
// 是否批量删除用户
const
[
multiChangeOrgs
,
setMultiChangeOrgs
]
=
useState
(
false
);
// 是否批量更改机构
const
[
multiRelateRoles
,
setMultiRelateRoles
]
=
useState
(
false
);
// 是否批量更改机构
const
[
rolelist
,
setRolelist
]
=
useState
([]);
// 角色列表
const
[
stationlist
,
setStationlist
]
=
useState
([]);
// 站点列表
...
...
@@ -279,7 +281,7 @@ const UserManage = () => {
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
console
.
log
(
selectedRowKeys
.
toString
());
console
.
log
(
selectedRows
.
map
(
item
=>
item
.
OUID
).
toString
());
setUserIDs
(
selectedRowKeys
.
toString
());
setUserIDs
(
selectedRowKeys
.
toString
());
// 数组转字符串,逗号连接
setOrgIDs
(
selectedRows
.
map
(
item
=>
item
.
OUID
).
toString
());
// 选中行数大于1时设置批量操作可行
if
(
selectedRows
.
length
>
1
)
{
...
...
@@ -451,7 +453,9 @@ const UserManage = () => {
/** ***用户批量操作****** */
// 用户关联
const
relateRoles
=
()
=>
{
getEmptyRoleList
();
setRoleVisible
(
true
);
setMultiRelateRoles
(
true
);
};
// 更改机构
const
changeOrgs
=
()
=>
{
...
...
@@ -667,6 +671,29 @@ const UserManage = () => {
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
=
()
=>
{
setUserRelation
(
...
...
@@ -698,6 +725,38 @@ const UserManage = () => {
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
=
()
=>
addToOrg
(
currentUser
.
userID
,
currentUser
.
OUID
,
newOrgID
)
...
...
@@ -727,6 +786,10 @@ const UserManage = () => {
if
(
res
.
code
===
0
)
{
setChangeOrgVisible
(
false
);
// 跳转到新组织机构下的用户表
const
temp
=
orgIDs
.
split
(
','
);
// 批量更改机构成功后设置老的orgIDs为全部是newOrgID的数组,并转字符串
setOrgIDs
(
temp
.
map
(()
=>
newOrgID
).
toString
());
// console.log(temp.map(() => newOrgID).toString());
onSelect
([
newOrgID
]);
notification
.
success
({
message
:
'提交成功'
,
...
...
@@ -1144,8 +1207,11 @@ const UserManage = () => {
<
Modal
title
=
"用户关联"
visible
=
{
roleVisible
}
onOk
=
{
submitRole
}
onCancel
=
{()
=>
setRoleVisible
(
false
)}
onOk
=
{
multiRelateRoles
?
submitRoles
:
submitRole
}
onCancel
=
{()
=>
{
setRoleVisible
(
false
);
setMultiRelateRoles
(
false
);
}}
okText
=
"确认"
cancelText
=
"取消"
width
=
"960px"
...
...
@@ -1272,7 +1338,7 @@ const UserManage = () => {
},
]}
>
<
Input
placeholder
=
"请输入手机号码"
/>
<
Input
placeholder
=
"请输入手机号码"
autoComplete
=
"off"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"email"
...
...
src/pages/userCenter/roleManage/RoleManage.jsx
View file @
dd52e920
...
...
@@ -136,6 +136,7 @@ const SiteManage = () => {
checkChildrenByCondition
(
l
,
it
=>
(
it
.
isChecked
?
[
getId
(
it
)]
:
[]),
true
,
'map'
,
).
flat
(
Infinity
),
)
...
...
src/pages/userCenter/siteManage/SiteManage.jsx
View file @
dd52e920
...
...
@@ -102,13 +102,12 @@ const SiteManage = () => {
setValueList
(
finalList
.
map
(
l
=>
l
.
children
.
map
(
item
=>
checkChildrenByCondition
(
item
,
l
,
it
=>
(
it
.
isChecked
?
[
getId
(
it
)]
:
[]),
true
,
'map'
,
).
flat
(
Infinity
),
),
)
.
flat
(
Infinity
)
.
filter
(
Boolean
),
...
...
src/services/userCenter/userManage/api.js
View file @
dd52e920
...
...
@@ -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
||
''
,
});
src/utils/request/index.js
View file @
dd52e920
...
...
@@ -24,11 +24,11 @@ const getMatchedConfig = requestConfig => {
return
null
;
}
};
axios
.
defaults
.
withCredentials
=
fals
e
axios
.
defaults
.
withCredentials
=
tru
e
axios
.
interceptors
.
request
.
use
(
function
(
request
){
const
token
=
localStorage
.
getItem
(
'token'
)
if
(
token
){
request
.
headers
.
token
=
token
request
.
headers
.
Authorization
=
'Bearer '
+
token
}
return
request
},
function
(
error
)
{
...
...
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