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
ac0652d0
Commit
ac0652d0
authored
Nov 13, 2020
by
Maofei94
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 人员选择
parent
b1d50659
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
181 additions
and
61 deletions
+181
-61
ItemCard.jsx
src/components/CheckGroup/ItemCard.jsx
+17
-17
index.jsx
src/components/CheckGroup/index.jsx
+9
-4
SiteConfig.jsx
src/pages/mobileConfig/SiteConfig.jsx
+1
-1
LeftPart.jsx
src/pages/mobileConfig/menuconfig/LeftPart.jsx
+0
-0
LeftPart.less
src/pages/mobileConfig/menuconfig/LeftPart.less
+69
-0
MenuConfig.jsx
src/pages/mobileConfig/menuconfig/MenuConfig.jsx
+2
-1
RoleManage.jsx
src/pages/userCenter/roleManage/RoleManage.jsx
+74
-37
api.js
src/services/userCenter/RoleManage/api.js
+9
-1
No files found.
src/components/CheckGroup/ItemCard.jsx
View file @
ac0652d0
...
...
@@ -8,10 +8,12 @@ const ListCardItem = props => {
const
{
getValueCallback
,
itemid
,
userList
,
// userList,
Child
,
OUName
,
searchWord
,
Child
,
children
,
text
,
}
=
props
;
const
[
indeterminate
,
setIndeterminate
]
=
useState
(
false
);
const
[
childValues
,
setChildValues
]
=
useState
({});
...
...
@@ -23,20 +25,18 @@ const ListCardItem = props => {
useEffect
(()
=>
{
let
arr
=
[];
userList
.
map
((
item
,
index
)
=>
{
children
.
map
((
item
,
index
)
=>
{
let
obj
=
{
...
item
};
obj
.
label
=
(
<
span
className=
{
searchWord
&&
obj
.
userName
.
includes
(
searchWord
)
?
styles
.
isSearch
:
''
searchWord
&&
obj
.
text
.
includes
(
searchWord
)
?
styles
.
isSearch
:
''
}
>
{
obj
.
userName
||
obj
.
roleName
||
obj
.
stationName
}
{
obj
.
text
}
</
span
>
);
obj
.
value
=
obj
.
userID
||
obj
.
roleID
||
obj
.
stationID
;
obj
.
value
=
obj
.
userID
||
obj
.
roleID
||
obj
.
stationID
||
obj
.
id
;
arr
.
push
(
obj
);
});
setDefaultList
(
arr
);
...
...
@@ -44,19 +44,19 @@ const ListCardItem = props => {
useEffect
(()
=>
{
let
arr2
=
[];
userList
.
map
((
item
,
index
)
=>
{
children
.
map
((
item
,
index
)
=>
{
if
(
item
.
isChecked
)
{
arr2
.
push
(
item
.
userID
||
item
.
roleID
||
item
.
stationID
);
arr2
.
push
(
item
.
userID
||
item
.
roleID
||
item
.
stationID
||
item
.
id
);
}
});
// eslint-disable-next-line no-unused-expressions
getValueCallback
&&
getValueCallback
(
arr2
,
itemid
);
const
all
=
userList
.
every
(
u
=>
u
.
isChecked
);
setIndeterminate
(
!
all
&&
userList
.
some
(
u
=>
u
.
isChecked
));
const
all
=
children
.
every
(
u
=>
u
.
isChecked
);
setIndeterminate
(
!
all
&&
children
.
some
(
u
=>
u
.
isChecked
));
setAllChecked
(
all
);
setCheckList
(
arr2
);
},
[
userList
]);
},
[
children
]);
const
handleAllChecked
=
e
=>
{
const
{
checked
}
=
e
.
target
;
...
...
@@ -82,9 +82,6 @@ const ListCardItem = props => {
getValueCallback
(
e
,
itemid
);
}
};
if
(
defaultList
.
length
===
0
)
{
return
null
;
}
const
handleChildValueCallback
=
(
arr
,
childIndex
)
=>
{
childValues
[
childIndex
]
=
arr
;
...
...
@@ -105,6 +102,9 @@ const ListCardItem = props => {
/>
));
if
(
defaultList
.
length
===
0
)
{
return
null
;
}
return
(
<>
<
div
className=
{
`${styles.divBox}`
}
>
...
...
@@ -116,7 +116,7 @@ const ListCardItem = props => {
handleAllChecked
(
e
);
}
}
>
{
OUName
}
{
text
}
</
Checkbox
>
</
div
>
<
div
style=
{
{
width
:
'100%'
}
}
className=
{
styles
.
checkdiv
}
>
...
...
src/components/CheckGroup/index.jsx
View file @
ac0652d0
...
...
@@ -24,10 +24,15 @@ const ListCard = props => {
title
:
'默认组'
,
id
:
''
,
};
// /Cityinterface/rest/services/OMS.svc/P_GetUserByStation
//
// /Cityinterface/rest/services/OMS.svc/U_GetUserListForBatchOper
get
(
'/Cityinterface/rest/services/OMS.svc/
P_GetUserByStation
'
,
{
get
(
'/Cityinterface/rest/services/OMS.svc/
W4_GetMenuByRoleWithLevel
'
,
{
// OUID:ouid||'',
stationID
:
ouid
||
''
,
// stationID: ouid || '',
roleID
:
ouid
,
subSystemValue
:
'city'
,
subSystemName
:
'city'
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
})
...
...
@@ -35,8 +40,8 @@ const ListCard = props => {
setLoading
(
false
);
const
list
=
[];
// eslint-disable-next-line no-unused-expressions
res
&&
res
.
forEach
(
item
=>
{
res
.
success
&&
res
.
root
.
forEach
(
item
=>
{
list
.
push
({
...
defaultConfig
,
...
item
});
});
setdataList
(
list
);
...
...
src/pages/mobileConfig/SiteConfig.jsx
View file @
ac0652d0
...
...
@@ -101,7 +101,7 @@ const SiteConfig = props => {
</
Item
>
<
Item
label=
"系统图标预览:"
>
<
PicturesWall
maxLen=
{
3
}
/>
<
PicturesWall
/>
</
Item
>
<
Item
label=
"登陆页面:"
...
...
src/pages/mobileConfig/menuconfig/LeftPart.jsx
0 → 100644
View file @
ac0652d0
This diff is collapsed.
Click to expand it.
src/pages/mobileConfig/menuconfig/LeftPart.less
0 → 100644
View file @
ac0652d0
.contentContainer{
// min-height: calc(100vh - 194px);
display: flex;
.menuContainer{
min-width: 300px;
border:1px solid #abaeb1;
min-height:calc(100vh - 300px);
overflow-y:auto;
.ant-tree-list{
padding: 10px;
height:calc(100vh - 300px);
.ant-tree-switcher{
line-height: 1;
color:#1890FF;
}
.ant-tree-iconEle{
line-height: 1.2;
color:#1890FF;
}
}
}
.previewContainer{
margin-left: 12px;
flex: 1;
float: left;
// background: white;
.ant-table-pagination-right{
padding-right: 12px;
}
}
.ant-tree-treenode{
width: 100% !important;
.ant-tree-node-content-wrapper{
display: inline-block;
width: 100%;
}
.iconWraper1{
float: right;
span{
display: none;
}
}
}
.ant-tree-treenode:hover{
.iconWraper1>span{
margin-left: 12px;
font-size: 18px;
display: inline-block;
}
}
}
.redText{
color: red;
cursor: pointer;
}
// .ant-modal-root{
// .ant-tree-switcher{
// line-height: 1;
// color:#1890FF;
// }
// }
// .menuContainer{
// width: 300px;
// padding: 10px;
// background: #1890FF;
// }
\ No newline at end of file
src/pages/mobileConfig/menuconfig/MenuConfig.jsx
View file @
ac0652d0
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
ProCard
from
'@ant-design/pro-card'
;
import
AddForm
from
'./AddForm'
;
import
LeftPart
from
'./LeftPart'
;
const
MenuConfig
=
props
=>
{
const
[
flag
,
setFlag
]
=
useState
(
1
);
return
(
<
ProCard
split=
"vertical"
>
<
ProCard
colSpan=
"400px"
>
<
div
style=
{
{
height
:
'60px'
,
backgroundColor
:
'red'
}
}
>
a
</
div
>
<
LeftPart
/
>
</
ProCard
>
<
ProCard
>
<
AddForm
/>
...
...
src/pages/userCenter/roleManage/RoleManage.jsx
View file @
ac0652d0
...
...
@@ -5,11 +5,13 @@ import { PageContainer, GridContent } from '@ant-design/pro-layout';
import
{
getWebModuleTree
,
chooseUserToStation
,
getUserRelationList
,
setMenuToRole
,
}
from
'@/services/userCenter/roleManage/api'
;
import
ListCard
from
'@/pages/orgnazation/ListCard'
;
import
ListCard
from
'@/components/CheckGroup'
;
// import ListCard from '@/pages/orgnazation/ListCard';
import
qs
from
'qs'
;
import
styles
from
'@/pages/userCenter/roleManage/RoleManage.less'
;
import
{
version
}
from
'less'
;
import
AddModal
from
'./AddModal'
;
import
DelModal
from
'./DelModal'
;
import
EditModal
from
'./EditModal'
;
...
...
@@ -39,31 +41,43 @@ const SiteManage = () => {
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
);
getWebModuleTree
({
userMode
:
'super'
,
select
:
''
,
getUserRelationList
({
userID
:
82
,
_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
]);
}).
then
(
res
=>
{
let
arr
=
res
.
roleList
;
let
arr2
=
transTree2
(
arr
);
console
.
log
(
arr2
,
'arr2'
);
setTreeData
(
arr2
);
});
},
[]);
const
Title
=
props
=>
{
const
{
text
}
=
props
;
console
.
log
(
props
);
...
...
@@ -111,25 +125,46 @@ const SiteManage = () => {
setEditVisible
(
true
);
};
// 树形数据转换
const
transTree
=
val
=>
{
console
.
log
(
val
);
// 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
=>
{
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
;
console
.
log
(
arr
,
'arr'
);
let
arr2
=
arr
.
map
((
item
,
index
)
=>
{
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
.
children
=
item
.
roleList
;
return
item
;
});
return
arr2
;
};
// 获取搜索框的值
const
handleSearch
=
value
=>
{
setSearchWord
(
value
);
};
const
handleChange
=
e
=>
{
const
{
value
}
=
e
.
target
;
setSearchWord
(
value
);
};
const
confirmModal
=
e
=>
{
setModalVisible
(
false
);
setFlag
(
flag
+
1
);
...
...
@@ -147,10 +182,10 @@ const SiteManage = () => {
};
const
handleCommit
=
value
=>
{
let
arr
=
Object
.
values
(
subList
);
chooseUserToStation
(
setMenuToRole
(
qs
.
stringify
({
userList
:
String
(
arr
.
flat
())
,
stationID
:
ouid
,
roleID
:
ouid
,
menuNameList
:
String
(
arr
.
flat
())
,
}),
{
headers
:
{
...
...
@@ -193,6 +228,7 @@ const SiteManage = () => {
showIcon
onSelect=
{
e
=>
handleTreeSelect
(
e
)
}
treeData=
{
treeData
}
blockNode
/>
</
Spin
>
<
AddModal
...
...
@@ -223,6 +259,7 @@ const SiteManage = () => {
allowClear
placeholder=
{
placeholder
}
onSearch=
{
handleSearch
}
onChange=
{
handleChange
}
enterButton
/>
</
Col
>
...
...
src/services/userCenter/RoleManage/api.js
View file @
ac0652d0
...
...
@@ -24,4 +24,12 @@ export const chooseUserToStation = (params, options) =>
// 获取所有角色信息
export
const
getUserRelationList
=
params
=>
get
(
'Cityinterface/rest/services/OMS.svc/W4_GetUserRelationList'
,
params
);
get
(
'/Cityinterface/rest/services/OMS.svc/W4_GetUserRelationList'
,
params
);
// 角色管理保存选择
export
const
setMenuToRole
=
(
params
,
options
)
=>
post
(
'/Cityinterface/rest/services/OMS.svc/P_SetMenuToRole?_version: 9999'
,
params
,
options
,
);
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