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
82945d47
Commit
82945d47
authored
Nov 16, 2020
by
Maofei94
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 角色管理
parent
2aae7b09
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
500 additions
and
222 deletions
+500
-222
CurrentSolution.less
src/pages/database/CurrentSolution.less
+2
-2
InitDataBase.jsx
src/pages/database/InitDataBase.jsx
+2
-2
AddModal.jsx
src/pages/userCenter/roleManage/AddModal.jsx
+78
-13
DelModal.jsx
src/pages/userCenter/roleManage/DelModal.jsx
+10
-6
EditGroup.jsx
src/pages/userCenter/roleManage/EditGroup.jsx
+71
-0
EditModal.jsx
src/pages/userCenter/roleManage/EditModal.jsx
+87
-21
RoleManage.jsx
src/pages/userCenter/roleManage/RoleManage.jsx
+205
-167
RoleManage.less
src/pages/userCenter/roleManage/RoleManage.less
+10
-2
AddModal.jsx
src/pages/userCenter/siteManage/AddModal.jsx
+1
-1
DelModal.jsx
src/pages/userCenter/siteManage/DelModal.jsx
+1
-1
EditModal.jsx
src/pages/userCenter/siteManage/EditModal.jsx
+1
-1
SiteManage.less
src/pages/userCenter/siteManage/SiteManage.less
+7
-1
api.js
src/services/userCenter/RoleManage/api.js
+25
-5
No files found.
src/pages/database/CurrentSolution.less
View file @
82945d47
.divbox{
display: flex;
display: flex
!important
;
align-items: center;
}
.cardbox{
...
...
@@ -7,7 +7,7 @@
}
.btnBox{
margin-top: 40px;
display: flex;
display: flex
!important
;
justify-content: center;
align-items: center;
}
...
...
src/pages/database/InitDataBase.jsx
View file @
82945d47
...
...
@@ -224,7 +224,7 @@ const InitDataBase = props => {
setCardLoading
(
false
);
if
(
res
.
GetMe
===
true
)
{
notification
.
success
({
message
:
'
通知
'
,
message
:
'
提示
'
,
duration
:
3
,
description
:
'连接成功'
,
});
...
...
@@ -257,7 +257,7 @@ const InitDataBase = props => {
setOption
(
res
.
root
);
}
else
{
notification
.
error
({
message
:
'
通知
'
,
message
:
'
提示
'
,
duration
:
15
,
description
:
res
.
message
,
});
...
...
src/pages/userCenter/roleManage/AddModal.jsx
View file @
82945d47
import
React
,
{
useState
}
from
'react'
;
import
{
Form
,
Input
,
notification
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Input
,
notification
,
Select
}
from
'antd'
;
import
SiteModal
from
'@/components/Modal/SiteModa'
;
import
{
add
Station
}
from
'@/services/userCenter/sit
eManage/api'
;
import
{
add
Role
,
getRoleGroup
}
from
'@/services/userCenter/rol
eManage/api'
;
const
{
Item
}
=
Form
;
const
{
Option
}
=
Select
;
const
AddModal
=
props
=>
{
const
[
form
]
=
Form
.
useForm
();
const
[
formLayout
,
setFormLayout
]
=
useState
(
'horizontal'
);
const
[
groupList
,
setGroupList
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
{
confirmModal
}
=
props
;
const
{
confirmModal
,
itemObj
}
=
props
;
useEffect
(()
=>
{
itemObj
.
groupflag
&&
form
.
setFieldsValue
({
group
:
itemObj
.
groupflag
,
});
return
()
=>
{
form
.
resetFields
();
};
},
[
itemObj
]);
const
onSubmit
=
()
=>
{
form
.
validateFields
()
.
then
(
res
=>
{
console
.
log
(
res
,
'res'
);
setLoading
(
true
);
add
Station
({
stationName
:
res
.
station
Name
,
add
Role
({
roleName
:
res
.
role
Name
,
description
:
res
.
description
,
group
:
res
.
group
,
subSystemValue
:
itemObj
.
subSystemValue
||
itemObj
.
visibleValue
||
''
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
})
...
...
@@ -25,7 +38,7 @@ const AddModal = props => {
if
(
res
.
success
)
{
form
.
resetFields
();
notification
.
success
({
message
:
'
通知
'
,
message
:
'
提示
'
,
duration
:
3
,
description
:
'新增成功'
,
});
...
...
@@ -33,7 +46,7 @@ const AddModal = props => {
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
duration
:
15
,
description
:
res
.
message
,
});
}
...
...
@@ -51,6 +64,38 @@ const AddModal = props => {
console
.
error
(
err
);
});
};
const
onChange
=
value
=>
{
console
.
log
(
value
);
const
{
length
}
=
value
;
form
.
setFieldsValue
({
group
:
value
[
length
-
1
],
});
};
// 获取分组列表
const
selectFocus
=
e
=>
{
setGroupList
([]);
getRoleGroup
({
_version
:
9999
,
_dc
:
Date
.
now
(),
subSystemValue
:
itemObj
.
subSystemValue
||
itemObj
.
visibleValue
||
''
,
subSystemName
:
itemObj
.
subSystemValue
||
itemObj
.
visibleValue
||
''
,
})
.
then
(
res
=>
{
if
(
res
)
{
setGroupList
(
res
);
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
15
,
description
:
res
.
message
,
});
setGroupList
([]);
}
})
.
catch
(
err
=>
{
console
.
error
(
err
);
});
};
const
onFinish
=
value
=>
{};
return
(
...
...
@@ -58,11 +103,11 @@ const AddModal = props => {
{
...
props
}
title=
"新增角色"
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
style=
{
{
top
:
200
,
borderRadius
:
'20px'
}
}
style=
{
{
top
:
100
}
}
width=
"600px"
destroyOnClose
cancelText=
"取消"
okText=
"确认
选择
"
okText=
"确认"
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
...
...
@@ -74,7 +119,7 @@ const AddModal = props => {
>
<
Item
label=
"角色名称"
name=
"
station
Name"
name=
"
role
Name"
rules=
{
[
{
required
:
true
,
...
...
@@ -84,7 +129,27 @@ const AddModal = props => {
>
<
Input
placeholder=
"请输入角色名称"
/>
</
Item
>
<
Item
label=
"角色类别"
>
all
</
Item
>
<
Item
label=
"角色类别"
name=
"subSystemValue"
>
{
itemObj
.
subSystemValue
||
itemObj
.
visibleValue
}
</
Item
>
<
Item
label=
"角色分组"
name=
"group"
>
<
Select
mode=
"tags"
placeholder=
"请选择分组"
onFocus=
{
()
=>
{
selectFocus
();
}
}
onChange=
{
e
=>
{
onChange
(
e
);
}
}
>
{
groupList
.
map
((
item
,
index
)
=>
(
<
Option
value=
{
item
.
value
}
key=
{
index
}
>
{
item
.
text
}
</
Option
>
))
}
</
Select
>
</
Item
>
<
Item
label=
"角色描述"
name=
"description"
>
<
Input
placeholder=
"请输入角色描述"
/>
</
Item
>
...
...
src/pages/userCenter/roleManage/DelModal.jsx
View file @
82945d47
import
React
,
{
useState
}
from
'react'
;
import
{
notification
}
from
'antd'
;
import
SiteModal
from
'@/components/Modal/SiteModa'
;
import
{
delete
Station
}
from
'@/services/userCenter/sit
eManage/api'
;
import
{
delete
Role
}
from
'@/services/userCenter/rol
eManage/api'
;
const
DelModal
=
props
=>
{
const
{
confirmModal
,
stationId
}
=
props
;
const
{
confirmModal
,
itemObj
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
onSubmit
=
props
=>
{
setLoading
(
true
);
delete
Station
({
stationID
:
stationId
,
delete
Role
({
roleID
:
itemObj
.
roleID
||
''
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
})
...
...
@@ -47,11 +47,15 @@ const DelModal = props => {
width=
"400px"
destroyOnClose
cancelText=
"取消"
okText=
"确认
删除
"
okText=
"确认"
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
是否删除该角色?
是否删除角色
<
span
style=
{
{
color
:
'red'
}
}
>
{
itemObj
.
roleName
&&
itemObj
.
roleName
}
</
span
>
?
</
SiteModal
>
);
};
...
...
src/pages/userCenter/roleManage/EditGroup.jsx
0 → 100644
View file @
82945d47
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
notification
,
Form
,
Input
}
from
'antd'
;
import
SiteModal
from
'@/components/Modal/SiteModa'
;
import
{
setRoleGroupName
}
from
'@/services/userCenter/roleManage/api'
;
const
{
Item
}
=
Form
;
const
EditGroup
=
props
=>
{
const
{
confirmModal
,
itemObj
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
useEffect
(()
=>
{
console
.
log
(
itemObj
.
groupflag
,
'flag'
);
form
.
setFieldsValue
({
newName
:
itemObj
.
groupflag
,
});
},
[
itemObj
]);
const
onSubmit
=
props
=>
{
setLoading
(
true
);
setRoleGroupName
({
subSystemValue
:
itemObj
.
visibleValue
||
itemObj
.
subSystemValue
,
oldName
:
itemObj
.
groupflag
,
newName
:
form
.
getFieldsValue
().
newName
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
})
.
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
success
)
{
form
.
resetFields
();
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'修改成功'
,
});
confirmModal
();
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
15
,
description
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
setLoading
(
false
);
});
};
return
(
<
SiteModal
{
...
props
}
title=
"编辑分组名称"
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'50px'
}
}
style=
{
{
top
:
200
}
}
width=
"600px"
destroyOnClose
cancelText=
"取消"
okText=
"确认"
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
<
Form
form=
{
form
}
wrapperCol=
{
{
span
:
20
}
}
>
<
Item
label=
"分组名称"
name=
"newName"
>
<
Input
placeholder=
"请输入分组名称"
/>
</
Item
>
</
Form
>
</
SiteModal
>
);
};
export
default
EditGroup
;
src/pages/userCenter/roleManage/EditModal.jsx
View file @
82945d47
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Form
,
Input
,
notification
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Input
,
notification
,
Select
}
from
'antd'
;
import
SiteModal
from
'@/components/Modal/SiteModa'
;
import
{
edit
Station
}
from
'@/services/userCenter/sit
eManage/api'
;
import
{
edit
Role
,
getRoleGroup
}
from
'@/services/userCenter/rol
eManage/api'
;
const
{
Item
}
=
Form
;
const
EditModal
=
props
=>
{
const
{
Option
}
=
Select
;
const
AddModal
=
props
=>
{
const
[
form
]
=
Form
.
useForm
();
const
[
formLayout
,
setFormLayout
]
=
useState
(
'horizontal'
);
const
[
groupList
,
setGroupList
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
flag
=
useRef
();
const
{
confirmModal
,
stationObj
}
=
props
;
const
{
confirmModal
,
itemObj
}
=
props
;
console
.
log
(
itemObj
,
'itemObj'
);
useEffect
(()
=>
{
form
.
setFieldsValue
({
roleName
:
itemObj
.
roleName
,
description
:
itemObj
.
description
,
group
:
itemObj
.
group
,
subSystemValue
:
itemObj
.
subSystemValue
,
});
},
[
itemObj
]);
const
onSubmit
=
()
=>
{
form
.
validateFields
()
.
then
(
res
=>
{
console
.
log
(
res
,
'res'
);
setLoading
(
true
);
flag
.
current
=
res
;
editStation
({
stationName
:
res
.
station
Name
,
editRole
({
roleID
:
itemObj
.
roleID
,
roleName
:
res
.
role
Name
,
description
:
res
.
description
,
stationID
:
stationObj
.
stationID
,
group
:
res
.
group
,
subSystemValue
:
itemObj
.
subSystemValue
||
itemObj
.
visibleValue
||
''
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
})
...
...
@@ -27,7 +40,7 @@ const EditModal = props => {
if
(
res
.
success
)
{
form
.
resetFields
();
notification
.
success
({
message
:
'
通知
'
,
message
:
'
提示
'
,
duration
:
3
,
description
:
'编辑成功'
,
});
...
...
@@ -53,29 +66,62 @@ const EditModal = props => {
console
.
error
(
err
);
});
};
useEffect
(()
=>
{
const
onChange
=
value
=>
{
console
.
log
(
value
);
const
{
length
}
=
value
;
form
.
setFieldsValue
({
stationName
:
stationObj
.
text
,
description
:
stationObj
.
description
,
group
:
value
[
length
-
1
],
});
},
[
stationObj
]);
};
// 获取分组列表
const
selectFocus
=
e
=>
{
setGroupList
([]);
getRoleGroup
({
_version
:
9999
,
_dc
:
Date
.
now
(),
subSystemValue
:
itemObj
.
subSystemValue
||
itemObj
.
visibleValue
||
''
,
subSystemName
:
itemObj
.
subSystemValue
||
itemObj
.
visibleValue
||
''
,
})
.
then
(
res
=>
{
if
(
res
)
{
setGroupList
(
res
);
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
15
,
description
:
res
.
message
,
});
setGroupList
([]);
}
})
.
catch
(
err
=>
{
console
.
error
(
err
);
});
};
const
onFinish
=
value
=>
{};
return
(
<
SiteModal
{
...
props
}
title=
"编辑角色"
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
style=
{
{
top
:
200
,
borderRadius
:
'20px'
}
}
style=
{
{
top
:
100
}
}
width=
"600px"
destroyOnClose
cancelText=
"取消"
okText=
"确认
编辑
"
okText=
"确认"
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
<
Form
form=
{
form
}
layout=
{
formLayout
}
labelCol=
{
{
span
:
4
}
}
>
<
Form
form=
{
form
}
layout=
{
formLayout
}
onFinish=
{
onFinish
}
labelCol=
{
{
span
:
4
}
}
>
<
Item
label=
"角色名称"
name=
"
station
Name"
name=
"
role
Name"
rules=
{
[
{
required
:
true
,
...
...
@@ -85,7 +131,27 @@ const EditModal = props => {
>
<
Input
placeholder=
"请输入角色名称"
/>
</
Item
>
<
Item
label=
"角色类别"
>
all
</
Item
>
<
Item
label=
"角色类别"
name=
"subSystemValue"
>
{
itemObj
.
subSystemValue
||
itemObj
.
visibleValue
}
</
Item
>
<
Item
label=
"角色分组"
name=
"group"
>
<
Select
mode=
"tags"
placeholder=
"请选择分组"
onFocus=
{
()
=>
{
selectFocus
();
}
}
onChange=
{
e
=>
{
onChange
(
e
);
}
}
>
{
groupList
.
map
((
item
,
index
)
=>
(
<
Option
value=
{
item
.
value
}
key=
{
index
}
>
{
item
.
text
}
</
Option
>
))
}
</
Select
>
</
Item
>
<
Item
label=
"角色描述"
name=
"description"
>
<
Input
placeholder=
"请输入角色描述"
/>
</
Item
>
...
...
@@ -94,4 +160,4 @@ const EditModal = props => {
);
};
export
default
Edit
Modal
;
export
default
Add
Modal
;
src/pages/userCenter/roleManage/RoleManage.jsx
View file @
82945d47
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Row
,
Col
,
Tree
,
Card
,
Input
,
Tooltip
,
Spin
,
notification
}
from
'antd'
;
import
{
FileAddTwoTone
,
EditTwoTone
,
DeleteTwoTone
}
from
'@ant-design/icons'
;
import
{
Row
,
Col
,
Tree
,
Card
,
Input
,
Spin
,
notification
,
Button
,
Space
,
}
from
'antd'
;
import
{
PageContainer
,
GridContent
}
from
'@ant-design/pro-layout'
;
import
{
getWebModuleTree
,
chooseUserToStation
,
getUserRelationList
,
setMenuToRole
,
getRoleGroupList
,
}
from
'@/services/userCenter/roleManage/api'
;
import
ListCard
from
'@/components/CheckGroup'
;
// import ListCard from '@/pages/orgnazation/ListCard';
...
...
@@ -15,8 +24,9 @@ import styles from '@/pages/userCenter/roleManage/RoleManage.less';
import
AddModal
from
'./AddModal'
;
import
DelModal
from
'./DelModal'
;
import
EditModal
from
'./EditModal'
;
import
EditGroup
from
'./EditGroup'
;
const
{
Search
}
=
Input
;
const
placeholder
=
'请输入
人员姓名
'
;
const
placeholder
=
'请输入
功能名称
'
;
const
SiteManage
=
()
=>
{
const
[
treeData
,
setTreeData
]
=
useState
([]);
const
[
searchWord
,
setSearchWord
]
=
useState
(
''
);
...
...
@@ -24,140 +34,107 @@ const SiteManage = () => {
const
[
saveTreeId
,
setSaveTreeId
]
=
useState
(
''
);
// 保存点击回调的ird
const
[
modalVisible
,
setModalVisible
]
=
useState
(
false
);
// 新增弹窗
const
[
flag
,
setFlag
]
=
useState
(
1
);
const
[
stationId
,
setStationId
]
=
useState
(
''
);
// 选择的站点
const
[
stationObj
,
setStationObj
]
=
useState
({});
// 选择的站点
const
[
itemObj
,
setItemObj
]
=
useState
({});
// 选择的角色item
const
[
delVisible
,
setDelVisible
]
=
useState
(
false
);
// 删除弹窗
const
[
editVisible
,
setEditVisible
]
=
useState
(
false
);
// 修改弹窗
const
[
subList
,
setSubList
]
=
useState
([]);
// 选中的数组
const
[
spinLoading
,
setSpinLoading
]
=
useState
(
false
);
const
[
currentSelectId
,
setCurrentSelectId
]
=
useState
([]);
// 选中的树节点
const
[
groupVisible
,
setGroupVisible
]
=
useState
(
false
);
// 分组编辑弹窗
// 点击树的回调
const
handleTreeSelect
=
e
=>
{
console
.
log
(
e
);
const
handleTreeSelect
=
(
e
,
treenode
)
=>
{
const
{
node
}
=
treenode
;
setItemObj
(
node
);
console
.
log
(
e
,
node
,
'node'
);
let
id
=
e
[
0
];
if
(
id
)
{
setCurrentSelectId
(
id
);
setSaveTreeId
(
id
);
setOuid
(
id
);
}
else
{
setOuid
(
saveTreeId
);
}
};
// useEffect(() => {
// setSpinLoading(true);
// getWebModuleTree({
// userMode: 'super',
// select: '',
// _version: 9999,
// _dc: Date.now(),
// node: -2,
// })
// .then(res => {
// setSpinLoading(false);
// let arr = [];
// if (res) {
// arr.push(res.find(item => item.id === 'Web4StationRoot'));
// console.log(arr, 'arr');
// }
// let arr2 = transTree(arr);
// setTreeData(arr2);
// })
// .catch(err => {
// setSpinLoading(false);
// console.error(err);
// });
// }, [flag]);
useEffect
(()
=>
{
setSpinLoading
(
true
);
getUserRelationList
({
userID
:
82
,
_version
:
9999
,
_dc
:
Date
.
now
(),
}).
then
(
res
=>
{
getRoleGroupList
({
userID
:
1
}).
then
(
res
=>
{
console
.
log
(
res
,
'res'
);
setSpinLoading
(
false
);
let
arr
=
res
.
roleList
;
let
arr2
=
transTree2
(
arr
);
console
.
log
(
arr2
,
'arr2'
);
setTreeData
(
arr2
);
if
(
res
.
code
===
0
)
{
const
{
roleList
}
=
res
.
data
;
let
arr
=
transTree
(
roleList
);
setTreeData
(
arr
);
}
});
},
[]);
const
Title
=
props
=>
{
const
{
text
}
=
props
;
console
.
log
(
props
);
return
(
<
div
className=
{
styles
.
treeTitle
}
>
{
text
}
<
div
className=
{
styles
.
titleBox
}
>
<
Tooltip
title=
"新增角色"
>
<
FileAddTwoTone
onClick=
{
()
=>
{
handleAdd
(
props
);
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"编辑角色"
>
<
EditTwoTone
onClick=
{
()
=>
{
handleEdit
(
props
);
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"删除角色"
>
<
DeleteTwoTone
onClick=
{
()
=>
{
handleDel
(
props
);
}
}
/>
</
Tooltip
>
</
div
>
</
div
>
);
};
},
[
flag
]);
// useEffect(() => {
// setSpinLoading(true);
// getUserRelationList({
// userID: 82,
// _version: 9999,
// _dc: Date.now(),
// }).then(res => {
// setSpinLoading(false);
// let arr = res.roleList;
// let arr2 = transTree2(arr);
// setTreeData(arr2);
// });
// }, []);
const
handleAdd
=
e
=>
{
console
.
log
(
e
);
setModalVisible
(
true
);
};
// 角色删除
const
handleDel
=
e
=>
{
setStationId
(
e
.
stationID
);
setDelVisible
(
true
);
};
// 编辑角色
const
handleEdit
=
e
=>
{
setStationObj
(
e
);
setEditVisible
(
true
);
};
// 树形数据转换
// const transTree = val => {
// console.log(val);
// let arr = val;
// return arr.map((item, index) => {
// item.title = Title(item) || item.text;
// item.key = item.stationID || '';
// let obj = {};
// if (Array.isArray(item.children) && item.children.length > 0) {
// transTree(item.children);
// obj = item;
// return obj;
// }
// return item;
// });
// };
const
transTree2
=
val
=>
{
// 分组编辑
const
groupEdit
=
()
=>
{
setGroupVisible
(
true
);
};
// 树形数据转换;
const
transTree
=
val
=>
{
let
arr
=
val
;
console
.
log
(
arr
,
'arr'
);
let
arr2
=
arr
.
map
((
item
,
index
)
=>
{
item
.
title
=
item
.
visibleTitle
;
item
.
key
=
item
.
visibleValue
;
let
arr2
=
arr
.
map
(
item
=>
{
if
(
item
.
child
&&
item
.
child
.
length
>
0
)
{
item
.
child
.
forEach
(
itemC
=>
{
item
.
roleList
.
unshift
(
itemC
);
});
}
return
item
;
});
let
arr3
=
arr2
.
map
(
item
=>
{
item
.
title
=
item
.
visibleTitle
||
''
;
item
.
key
=
item
.
visibleValue
||
''
;
if
(
item
.
roleList
&&
item
.
roleList
.
length
>
0
)
{
item
.
roleList
.
map
(
child
=>
{
child
.
title
=
child
.
roleName
;
child
.
key
=
child
.
roleID
;
item
.
roleList
.
map
(
itemRole
=>
{
if
(
itemRole
.
roleList
)
{
itemRole
.
title
=
itemRole
.
visibleTitle
||
''
;
itemRole
.
key
=
itemRole
.
visibleTitle
||
''
;
itemRole
.
groupflag
=
itemRole
.
visibleTitle
;
itemRole
.
roleList
.
map
(
i
=>
{
i
.
title
=
i
.
roleName
;
i
.
key
=
i
.
roleID
;
i
.
subSystemValue
=
item
.
visibleValue
;
i
.
group
=
itemRole
.
visibleTitle
;
});
itemRole
.
children
=
itemRole
.
roleList
;
}
else
{
itemRole
.
title
=
itemRole
.
roleName
;
itemRole
.
key
=
itemRole
.
roleID
;
itemRole
.
subSystemValue
=
item
.
visibleValue
;
}
return
itemRole
;
});
}
item
.
children
=
item
.
roleList
;
return
item
;
});
return
arr
2
;
return
arr
3
;
};
// 获取搜索框的值
const
handleSearch
=
value
=>
{
...
...
@@ -167,17 +144,29 @@ const SiteManage = () => {
const
{
value
}
=
e
.
target
;
setSearchWord
(
value
);
};
// 确认回调
const
confirmModal
=
e
=>
{
setModalVisible
(
false
);
setFlag
(
flag
+
1
);
setItemObj
(
''
);
};
// 删除弹窗回调
const
delModal
=
()
=>
{
setDelVisible
(
false
);
setFlag
(
flag
+
1
);
setItemObj
(
''
);
};
// 编辑弹窗回调
const
editModal
=
()
=>
{
setEditVisible
(
false
);
setFlag
(
flag
+
1
);
setItemObj
(
''
);
};
// 分组编辑回调
const
groupModal
=
()
=>
{
setGroupVisible
(
false
);
setFlag
(
flag
+
1
);
setItemObj
(
''
);
};
const
valueCallback
=
valueObj
=>
{
setSubList
(
valueObj
);
...
...
@@ -205,7 +194,7 @@ const SiteManage = () => {
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
duration
:
15
,
description
:
res
.
message
,
});
}
...
...
@@ -216,72 +205,121 @@ const SiteManage = () => {
};
return
(
<
PageContainer
>
<
GridContent
>
<
Row
gutter=
{
12
}
>
<
Col
lg=
{
6
}
md=
{
24
}
>
<
Card
className=
{
styles
.
cardBox
}
>
<
Spin
tip=
"loading...."
spinning=
{
spinLoading
}
style=
{
{
marginTop
:
'20px'
}
}
>
<
Tree
showLine=
{
{
showLeafIcon
:
false
}
}
showIcon
onSelect=
{
e
=>
handleTreeSelect
(
e
)
}
treeData=
{
treeData
}
blockNode
autoExpandParent
defaultExpandAll
/>
</
Spin
>
<
AddModal
visible=
{
modalVisible
}
onCancel=
{
()
=>
setModalVisible
(
false
)
}
confirmModal=
{
confirmModal
}
/>
<
DelModal
visible=
{
delVisible
}
stationId=
{
stationId
}
onCancel=
{
()
=>
setDelVisible
(
false
)
}
confirmModal=
{
delModal
}
{
/* <GridContent> */
}
<
Row
gutter=
{
12
}
>
<
Col
lg=
{
6
}
>
<
Card
className=
{
styles
.
cardBox
}
>
<
Spin
tip=
"loading...."
spinning=
{
spinLoading
}
style=
{
{
marginTop
:
'20px'
}
}
>
<
Tree
showLine=
{
{
showLeafIcon
:
false
}
}
showIcon
// onSelect={(e, node) => handleTreeSelect(e, node)}
onSelect=
{
handleTreeSelect
}
treeData=
{
treeData
}
// selectedKeys={[currentSelectId]}
blockNode
defaultExpandAll
/>
<
EditModal
visible=
{
editVisible
}
stationObj=
{
stationObj
}
onCancel=
{
()
=>
setEditVisible
(
false
)
}
confirmModal=
{
editModal
}
/>
</
Card
>
</
Col
>
<
Col
lg=
{
18
}
>
<
Card
style=
{
{
marginBottom
:
'10px'
}
}
>
<
Row
align=
"middle"
>
<
Col
span=
{
1
}
>
搜索
</
Col
>
<
Col
span=
{
8
}
>
<
Search
allowClear
placeholder=
{
placeholder
}
onSearch=
{
handleSearch
}
onChange=
{
handleChange
}
enterButton
/>
</
Col
>
</
Row
>
</
Card
>
<
Card
className=
{
styles
.
cardBoxR
}
>
{
ouid
&&
(
<
ListCard
ouid=
{
ouid
}
searchWord=
{
searchWord
}
valueCallback=
{
valueCallback
}
onCommit=
{
handleCommit
}
{
/* <Tree></Tree> */
}
</
Spin
>
<
AddModal
visible=
{
modalVisible
}
onCancel=
{
()
=>
setModalVisible
(
false
)
}
itemObj=
{
itemObj
}
confirmModal=
{
confirmModal
}
/>
<
DelModal
visible=
{
delVisible
}
itemObj=
{
itemObj
}
onCancel=
{
()
=>
setDelVisible
(
false
)
}
confirmModal=
{
delModal
}
/>
<
EditModal
visible=
{
editVisible
}
itemObj=
{
itemObj
}
onCancel=
{
()
=>
setEditVisible
(
false
)
}
confirmModal=
{
editModal
}
/>
<
EditGroup
visible=
{
groupVisible
}
itemObj=
{
itemObj
}
onCancel=
{
()
=>
setGroupVisible
(
false
)
}
confirmModal=
{
groupModal
}
/>
</
Card
>
</
Col
>
<
Col
lg=
{
18
}
>
<
Card
style=
{
{
marginBottom
:
'10px'
}
}
>
<
Row
align=
"middle"
>
<
Col
span=
{
1
}
>
搜索
</
Col
>
<
Col
span=
{
8
}
>
<
Search
allowClear
placeholder=
{
placeholder
}
onSearch=
{
handleSearch
}
onChange=
{
handleChange
}
enterButton
/>
)
}
</
Card
>
</
Col
>
</
Row
>
</
GridContent
>
</
Col
>
<
Col
span=
{
3
}
/>
<
Col
span=
{
8
}
>
<
Space
size=
"large"
>
<
Button
type=
"primary"
onClick=
{
()
=>
{
handleAdd
();
}
}
>
新增角色
</
Button
>
<
Button
type=
"primary"
disabled=
{
!
itemObj
.
roleID
}
onClick=
{
()
=>
{
handleEdit
();
}
}
>
编辑角色
</
Button
>
<
Button
danger
onClick=
{
()
=>
{
handleDel
();
}
}
disabled=
{
!
itemObj
.
roleID
}
>
删除角色
</
Button
>
<
Button
type=
"primary"
onClick=
{
()
=>
{
groupEdit
();
}
}
disabled=
{
!
itemObj
.
groupflag
}
>
编辑分组
</
Button
>
</
Space
>
</
Col
>
</
Row
>
</
Card
>
<
Card
className=
{
styles
.
cardBoxR
}
>
{
ouid
&&
(
<
ListCard
ouid=
{
ouid
}
searchWord=
{
searchWord
}
valueCallback=
{
valueCallback
}
onCommit=
{
handleCommit
}
/>
)
}
</
Card
>
</
Col
>
</
Row
>
{
/* </GridContent> */
}
</
PageContainer
>
);
};
...
...
src/pages/userCenter/roleManage/RoleManage.less
View file @
82945d47
.cardBox{
min-height: calc(100vh - 200px);
max-height: calc(100vh - 200px);
overflow-y: scroll;
//
max-height: calc(100vh - 200px);
//
overflow-y: scroll;
}
.ant-tree-node-content-wrapper-open{
display: flex;
...
...
@@ -29,4 +29,11 @@
min-height: calc(100vh - 292px);
max-height: calc(100vh - 292px);
overflow-y: scroll;
}
:global{
.ant-tree-switcher{
display: flex;
align-items: center;
color:#1890FF;
}
}
\ No newline at end of file
src/pages/userCenter/siteManage/AddModal.jsx
View file @
82945d47
...
...
@@ -62,7 +62,7 @@ const AddModal = props => {
width=
"600px"
destroyOnClose
cancelText=
"取消"
okText=
"确认
选择
"
okText=
"确认"
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
...
...
src/pages/userCenter/siteManage/DelModal.jsx
View file @
82945d47
...
...
@@ -47,7 +47,7 @@ const DelModal = props => {
width=
"400px"
destroyOnClose
cancelText=
"取消"
okText=
"确认
删除
"
okText=
"确认"
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
...
...
src/pages/userCenter/siteManage/EditModal.jsx
View file @
82945d47
...
...
@@ -68,7 +68,7 @@ const EditModal = props => {
width=
"600px"
destroyOnClose
cancelText=
"取消"
okText=
"确认
编辑
"
okText=
"确认"
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
...
...
src/pages/userCenter/siteManage/SiteManage.less
View file @
82945d47
...
...
@@ -30,7 +30,12 @@
.listItem{
padding-left: 5px;
cursor: pointer;
font-size: 16px;
}
.listItem:hover{
background-color: #f8f8f8 ;
}
.selected{
background-color: #bae7ff;
font-weight: bold;
background-color: #bae7ff!important;
}
\ No newline at end of file
src/services/userCenter/RoleManage/api.js
View file @
82945d47
import
{
get
,
post
}
from
'@/services/index'
;
// 获取站点信息
export
const
getWebModuleTree
=
params
=>
get
(
'/Cityinterface/rest/services/OMS.svc/W4_GetWeb4ModuleTree'
,
params
);
import
{
get
,
post
,
PUBLISH_SERVICE
}
from
'@/services/index'
;
// 新增站点
export
const
addStation
=
params
=>
...
...
@@ -33,3 +29,27 @@ export const setMenuToRole = (params, options) =>
params
,
options
,
);
/**
* @角色管理
*/
// 获取角色树
export
const
getRoleGroupList
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/RoleGroupList`
,
params
);
// 新增角色
export
const
addRole
=
params
=>
get
(
`/Cityinterface/rest/services/OMS.svc/P_AddRole`
,
params
);
// 获取分组列表
export
const
getRoleGroup
=
params
=>
get
(
`/Cityinterface/rest/services/OMS.svc/P_GetRoleGroup`
,
params
);
// 编辑角色
export
const
editRole
=
params
=>
get
(
'/Cityinterface/rest/services/OMS.svc/P_EditRole'
,
params
);
// 删除角色
export
const
deleteRole
=
params
=>
get
(
'/Cityinterface/rest/services/OMS.svc/P_DeleteRole'
,
params
);
// 编辑分组名称
export
const
setRoleGroupName
=
params
=>
get
(
'/Cityinterface/rest/services/OMS.svc/P_SetRoleGroupName'
,
params
);
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