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
3ca83472
Commit
3ca83472
authored
Sep 07, 2022
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化事件关联权限功能
parent
e3e71d8b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
12 deletions
+82
-12
AddUserModal.jsx
src/pages/userCenter/userManage/AddUserModal.jsx
+70
-8
RelateRoleModal.jsx
src/pages/userCenter/userManage/RelateRoleModal.jsx
+11
-3
UserManage.jsx
src/pages/userCenter/userManage/UserManage.jsx
+1
-1
No files found.
src/pages/userCenter/userManage/AddUserModal.jsx
View file @
3ca83472
import
React
,
{
useEffect
}
from
'react'
;
import
{
Modal
,
Form
,
Input
,
notification
,
message
}
from
'antd'
;
import
{
addUser
}
from
'@/services/userManage/api'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Modal
,
Form
,
Input
,
notification
,
message
,
TreeSelect
}
from
'antd'
;
import
{
addUser
,
GetUserRelationListNew
}
from
'@/services/userManage/api'
;
import
{
ok
}
from
'../../../assets/images/icons/ok.svg'
;
const
{
SHOW_CHILD
}
=
TreeSelect
;
const
AddUserModal
=
props
=>
{
const
{
visible
,
orgID
,
onCancel
,
updateTrees1
,
orgTitle1
,
onSelect
}
=
props
;
...
...
@@ -12,11 +13,56 @@ const AddUserModal = props => {
const
isEmail
=
new
RegExp
(
/^
[
a-zA-Z0-9
]
+
([
-_.
][
a-zA-Z0-9
]
+
)
*@
[
a-zA-Z0-9
]
+
([
-_.
][
a-zA-Z0-9
]
+
)
*
\.[
a-z
]{2,}
$/
,
);
// 邮箱
const
[
value
,
setValue
]
=
useState
([
'0-1-1'
]);
const
[
treeData
,
setTreeData
]
=
useState
([]);
const
onChange
=
newValue
=>
{
console
.
log
(
'onChange '
,
value
);
setValue
(
newValue
);
};
useEffect
(()
=>
{
addUserForm
.
resetFields
();
console
.
log
(
orgID
);
},
[
orgID
]);
if
(
visible
)
{
addUserForm
.
resetFields
();
getEmptyRoleList
();
}
},
[
orgID
,
visible
]);
// 获取全部未勾选站点列表
const
getEmptyRoleList
=
()
=>
{
GetUserRelationListNew
({
userID
:
0
})
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
let
aa
=
{};
console
.
log
(
res
.
data
.
stationList
);
res
.
data
.
stationList
.
map
(
i
=>
{
aa
.
title
=
i
.
visibleTitle
;
aa
.
value
=
i
.
visibleValue
;
aa
.
key
=
i
.
visibleValue
;
aa
.
children
=
[];
i
.
stationList
.
map
(
j
=>
{
let
bb
=
{};
bb
.
title
=
j
.
stationName
;
bb
.
value
=
j
.
stationID
;
bb
.
key
=
j
.
stationID
;
aa
.
children
.
push
(
bb
);
});
});
console
.
log
(
aa
);
let
data
=
[];
data
.
push
(
aa
);
setTreeData
(
data
);
}
else
{
notification
.
error
({
message
:
'获取失败'
,
description
:
res
.
msg
,
});
}
})
.
catch
(
err
=>
{
message
.
error
(
err
);
});
};
// 提交-添加用户
const
submitAddUser
=
()
=>
{
...
...
@@ -25,6 +71,8 @@ const AddUserModal = props => {
const
password
=
addUserForm
.
getFieldValue
(
'password'
)
||
''
;
const
phone
=
addUserForm
.
getFieldValue
(
'phone'
)
||
''
;
const
email
=
addUserForm
.
getFieldValue
(
'email'
)
||
''
;
const
stationList
=
addUserForm
.
getFieldValue
(
'stationList'
).
toString
()
||
''
;
console
.
log
(
stationList
);
// 正则验证
if
(
loginName
===
''
)
{
notification
.
error
({
...
...
@@ -70,7 +118,7 @@ const AddUserModal = props => {
(
phone
===
''
||
isPhone
.
test
(
phone
))
&&
(
email
===
''
||
isEmail
.
test
(
email
))
)
{
addUser
({
OUID
:
orgID
.
id
,
loginName
,
userName
,
password
,
phone
,
email
})
addUser
({
OUID
:
orgID
.
id
,
loginName
,
userName
,
password
,
phone
,
email
,
stationList
})
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
addUserForm
.
resetFields
();
...
...
@@ -81,7 +129,6 @@ const AddUserModal = props => {
});
updateTrees1
(
orgID
.
id
);
onSelect
([
`
${
orgID
.
id
}
`
]);
// 重新获取用户表
}
else
{
notification
.
error
({
...
...
@@ -102,6 +149,18 @@ const AddUserModal = props => {
</
span
>
);
const
tProps
=
{
treeData
,
value
,
onChange
,
treeCheckable
:
true
,
showCheckedStrategy
:
SHOW_CHILD
,
placeholder
:
'请选择关联站点'
,
style
:
{
width
:
'100%'
,
},
};
return
(
<
Modal
title=
{
title
}
...
...
@@ -186,6 +245,9 @@ const AddUserModal = props => {
>
<
Input
placeholder=
"请输入电子邮箱"
autoComplete=
"off"
/>
</
Form
.
Item
>
{
/* <Form.Item name="stationList" label="关联站点" rules={[{ required: true }]}>
<TreeSelect {...tProps} showSearch treeDefaultExpandAll />
</Form.Item> */
}
</
Form
>
</
Modal
>
);
...
...
src/pages/userCenter/userManage/RelateRoleModal.jsx
View file @
3ca83472
...
...
@@ -24,6 +24,7 @@ const RelateRoleModal = props => {
const
[
roleValueList
,
setRoleValueList
]
=
useState
({});
// 勾选的角色列表
const
[
stationValueList
,
setStationValueList
]
=
useState
({});
// 勾选的站点列表
const
authority
=
localStorage
.
getItem
(
'panda-oms-authority'
);
const
[
activeKey
,
setActiveKey
]
=
useState
(
'1'
);
const
getRoleValueCallback
=
useCallback
((
value
,
index
)
=>
{
console
.
log
(
value
);
...
...
@@ -41,6 +42,9 @@ const RelateRoleModal = props => {
},
[]);
useEffect
(()
=>
{
if
(
!
visible
)
{
setActiveKey
(
'1'
);
}
console
.
log
(
currentUser
);
console
.
log
(
multiRoleList
);
console
.
log
(
multistationList
);
...
...
@@ -127,13 +131,17 @@ const RelateRoleModal = props => {
const
title1
=
(
<
span
>
<
span
>
关联
角色
关联
权限
<
span
style=
{
{
fontWeight
:
'bold'
,
color
:
'rgb(24, 144, 255)'
}
}
>
【
{
currentUser
.
userName
}
】
</
span
>
</
span
>
</
span
>
);
const
onChange
=
e
=>
{
console
.
log
(
e
);
setActiveKey
(
e
);
};
if
(
mult
==
'Yes'
)
{
return
(
<
Modal
...
...
@@ -148,7 +156,7 @@ const RelateRoleModal = props => {
width=
"500px"
>
<
Spin
spinning=
{
loading
}
tip=
"loading"
>
<
Tabs
defaultActiveKey=
"1"
style=
{
{
marginTop
:
'-16px'
}
}
>
<
Tabs
activeKey=
{
activeKey
}
onChange=
{
onChange
}
style=
{
{
marginTop
:
'-16px'
}
}
>
<
TabPane
tab=
"角色"
key=
"1"
>
{
visible
&&
rolelist
.
map
((
role
,
index
)
=>
(
...
...
@@ -195,7 +203,7 @@ const RelateRoleModal = props => {
width=
"500px"
>
<
Spin
spinning=
{
loading
}
tip=
"loading"
>
<
Tabs
defaultActiveKey=
"1"
style=
{
{
marginTop
:
'-16px'
}
}
>
<
Tabs
activeKey=
{
activeKey
}
onChange=
{
onChange
}
style=
{
{
marginTop
:
'-16px'
}
}
>
<
TabPane
tab=
"角色"
key=
"1"
>
{
visible
&&
rolelist
.
map
((
role
,
index
)
=>
(
...
...
src/pages/userCenter/userManage/UserManage.jsx
View file @
3ca83472
...
...
@@ -251,7 +251,7 @@ const UserManage = () => {
align
:
'center'
,
render
:
record
=>
(
<
Space
size=
"middle"
>
<
Tooltip
title=
"关联
角色
"
>
<
Tooltip
title=
"关联
权限
"
>
<
IdcardOutlined
onClick=
{
()
=>
relateRole
(
record
)
}
style=
{
{
fontSize
:
'20px'
,
color
:
'#1890FF'
}
}
...
...
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