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
73f63636
Commit
73f63636
authored
Jan 12, 2021
by
tianfen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pref: 站点管理更新
parent
2ba6d3a7
Pipeline
#22248
skipped with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
107 deletions
+126
-107
SiteManage.jsx
src/pages/userCenter/siteManage/SiteManage.jsx
+115
-99
SiteManage.less
src/pages/userCenter/siteManage/SiteManage.less
+11
-8
No files found.
src/pages/userCenter/siteManage/SiteManage.jsx
View file @
73f63636
...
@@ -25,6 +25,7 @@ import {
...
@@ -25,6 +25,7 @@ import {
getWebModuleTree
,
getWebModuleTree
,
chooseUserToStation
,
chooseUserToStation
,
getAllGroup
,
getAllGroup
,
getUserByStation
,
getStationUserList
,
getStationUserList
,
groupUserPagingList
,
groupUserPagingList
,
}
from
'@/services/userCenter/siteManage/api'
;
}
from
'@/services/userCenter/siteManage/api'
;
...
@@ -47,8 +48,7 @@ const placeholder = '请输入机构名称';
...
@@ -47,8 +48,7 @@ const placeholder = '请输入机构名称';
const
SiteManage
=
props
=>
{
const
SiteManage
=
props
=>
{
const
{
userMode
}
=
props
;
const
{
userMode
}
=
props
;
const
[
treeData
,
setTreeData
]
=
useState
([]);
// 树结构数据
const
[
treeData
,
setTreeData
]
=
useState
([]);
// 树结构数据
const
[
currentStation
,
setCurrentStation
]
=
useState
({});
// 当前选中站点
const
[
currentStation
,
setCurrentStation
]
=
useState
(
''
);
// 当前选中站点
// const [searchWord, setSearchWord] = useState(''); // 关键字
const
[
visibleParams
,
setvisibleParams
]
=
useState
({
const
[
visibleParams
,
setvisibleParams
]
=
useState
({
modalVisible
:
false
,
// 新增弹窗
modalVisible
:
false
,
// 新增弹窗
delVisible
:
false
,
// 删除弹窗
delVisible
:
false
,
// 删除弹窗
...
@@ -61,9 +61,11 @@ const SiteManage = props => {
...
@@ -61,9 +61,11 @@ const SiteManage = props => {
const
[
flag
,
setFlag
]
=
useState
(
1
);
const
[
flag
,
setFlag
]
=
useState
(
1
);
const
[
dataList
,
setdataList
]
=
useState
([]);
const
[
dataList
,
setdataList
]
=
useState
([]);
const
[
mulu
,
setMulu
]
=
useState
(
true
);
const
[
mulu
,
setMulu
]
=
useState
(
true
);
const
[
selectList
,
setSelectList
]
=
useState
([]);
const
[
selectList
,
setSelectList
]
=
useState
([]);
// 选择列表数据
const
[
total
,
setTotal
]
=
useState
(
0
);
// 分页总数
const
[
total
,
setTotal
]
=
useState
(
0
);
// 分页总数
const
[
page
,
setPage
]
=
useState
({
pageNum
:
1
,
pageSize
:
5
});
const
[
page
,
setPage
]
=
useState
({
pageNum
:
1
,
pageSize
:
5
});
const
[
update
,
setUpdate
]
=
useState
(
1
);
const
[
update1
,
setUpdate1
]
=
useState
(
1
);
// 侧边栏站点
// 侧边栏站点
useEffect
(()
=>
{
useEffect
(()
=>
{
handleShowModal
(
'spinLoading'
,
true
);
handleShowModal
(
'spinLoading'
,
true
);
...
@@ -106,12 +108,46 @@ const SiteManage = props => {
...
@@ -106,12 +108,46 @@ const SiteManage = props => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
currentStation
.
stationID
)
return
;
if
(
!
currentStation
.
stationID
)
return
;
handleShowModal
(
'loading'
,
true
);
handleShowModal
(
'loading'
,
true
);
// setSelectList(lodash.cloneDeep([]));
getList
();
getList
();
},
[
currentStation
]);
},
[
update
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
getList
();
if
(
!
currentStation
.
stationID
)
return
;
},
[
page
.
pageNum
]);
getAllcheckList
();
},
[
currentStation
,
update1
]);
const
getAllcheckList
=
async
()
=>
{
let
res
=
await
getUserByStation
({
stationID
:
currentStation
.
stationID
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
});
if
(
res
.
length
>
0
)
{
// 还原从后台返回的数据 选中的列表
let
list
=
[];
// console.log(res);
res
.
forEach
(
item
=>
{
if
(
item
.
userList
.
length
>
0
)
{
item
.
userList
.
forEach
(
value
=>
{
// console.log(value);
if
(
value
.
isChecked
&&
list
.
findIndex
(
v
=>
+
v
.
GroupId
===
+
item
.
OUID
&&
+
v
.
userID
===
+
value
.
userID
,
)
===
-
1
)
{
list
.
push
({
GroupId
:
+
item
.
OUID
,
GroupName
:
item
.
OUName
,
userName
:
value
.
userName
,
userID
:
value
.
userID
,
});
}
});
}
});
setSelectList
(
lodash
.
cloneDeep
(
list
));
setUpdate
(
update
+
1
);
}
};
const
getList
=
name
=>
{
const
getList
=
name
=>
{
let
params
=
{
let
params
=
{
stationId
:
+
currentStation
.
stationID
||
''
,
stationId
:
+
currentStation
.
stationID
||
''
,
...
@@ -122,6 +158,7 @@ const SiteManage = props => {
...
@@ -122,6 +158,7 @@ const SiteManage = props => {
groupUserPagingList
(
params
).
then
(
res
=>
{
groupUserPagingList
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
let
{
list
}
=
res
.
data
;
let
{
list
}
=
res
.
data
;
// 还原选择的数据
if
(
selectList
.
length
>
0
)
{
if
(
selectList
.
length
>
0
)
{
selectList
.
forEach
(
item
=>
{
selectList
.
forEach
(
item
=>
{
list
.
forEach
((
value
,
index
)
=>
{
list
.
forEach
((
value
,
index
)
=>
{
...
@@ -152,29 +189,7 @@ const SiteManage = props => {
...
@@ -152,29 +189,7 @@ const SiteManage = props => {
};
};
// 获取搜索框的值
// 获取搜索框的值
const
handleSearch
=
value
=>
{
const
handleSearch
=
value
=>
{
console
.
log
(
value
);
getList
(
value
);
getList
(
value
);
// if (value) {
// dataList.forEach(item => {
// item.color = item.GroupName.indexOf(value) > -1 ? '#f00' : '#333';
// });
// setdataList(lodash.cloneDeep(dataList));
// setSearchWord(value);
// }
};
// 搜索框点击进行锚点链接跳转
const
handleChange
=
value
=>
{
if
(
value
)
{
// let index = dataList.findIndex(item => item.GroupId === value);
// dataList.forEach(item => {
// item.color = '#333';
// });
// dataList[index].color = '#f00';
// setdataList(lodash.cloneDeep(dataList));
// let anchorElement = document.getElementById(`siteId${value}`);
// anchorElement.scrollIntoView();
}
};
};
const
confirmModal
=
e
=>
{
const
confirmModal
=
e
=>
{
handleShowModal
(
'modalVisible'
,
false
);
handleShowModal
(
'modalVisible'
,
false
);
...
@@ -196,6 +211,7 @@ const SiteManage = props => {
...
@@ -196,6 +211,7 @@ const SiteManage = props => {
<
List
.
Item
<
List
.
Item
onClick=
{
()
=>
{
onClick=
{
()
=>
{
setSelectList
(
lodash
.
cloneDeep
([]));
setSelectList
(
lodash
.
cloneDeep
([]));
setPage
({
pageNum
:
1
,
pageSize
:
5
});
setCurrentStation
(
t
);
setCurrentStation
(
t
);
}
}
}
}
key=
{
t
.
id
}
key=
{
t
.
id
}
...
@@ -209,7 +225,6 @@ const SiteManage = props => {
...
@@ -209,7 +225,6 @@ const SiteManage = props => {
));
));
const
handleChangeCollpase
=
(
groupId
,
isShow
)
=>
{
const
handleChangeCollpase
=
(
groupId
,
isShow
)
=>
{
let
index
=
dataList
.
findIndex
(
item
=>
item
.
GroupId
===
groupId
);
let
index
=
dataList
.
findIndex
(
item
=>
item
.
GroupId
===
groupId
);
// dataList[index].isShow = !isShow;
if
(
dataList
[
index
].
children
&&
dataList
[
index
].
children
.
length
>
0
)
{
if
(
dataList
[
index
].
children
&&
dataList
[
index
].
children
.
length
>
0
)
{
setdataList
(
lodash
.
cloneDeep
(
dataList
));
setdataList
(
lodash
.
cloneDeep
(
dataList
));
return
;
return
;
...
@@ -240,7 +255,6 @@ const SiteManage = props => {
...
@@ -240,7 +255,6 @@ const SiteManage = props => {
GroupName
:
dataList
[
index
].
GroupName
,
GroupName
:
dataList
[
index
].
GroupName
,
userName
:
item
.
userName
,
userName
:
item
.
userName
,
userID
:
item
.
userID
,
userID
:
item
.
userID
,
isChecked
:
dataList
[
index
].
isChecked
,
});
});
}
}
}
}
...
@@ -262,13 +276,12 @@ const SiteManage = props => {
...
@@ -262,13 +276,12 @@ const SiteManage = props => {
item
.
GroupId
===
dataList
[
index
].
GroupId
,
item
.
GroupId
===
dataList
[
index
].
GroupId
,
);
);
dataList
[
index
].
isChecked
=
checked
;
dataList
[
index
].
isChecked
=
checked
;
if
(
hasIndex
===
-
1
)
{
if
(
e
.
target
.
checked
&&
hasIndex
===
-
1
)
{
selectList
.
push
({
selectList
.
push
({
GroupId
:
dataList
[
index
].
GroupId
,
GroupId
:
dataList
[
index
].
GroupId
,
GroupName
:
dataList
[
index
].
GroupName
,
GroupName
:
dataList
[
index
].
GroupName
,
userName
:
dataList
[
index
].
Users
[
vIndex
].
userName
,
userName
:
dataList
[
index
].
Users
[
vIndex
].
userName
,
userID
:
dataList
[
index
].
Users
[
vIndex
].
userID
,
userID
:
dataList
[
index
].
Users
[
vIndex
].
userID
,
isChecked
:
dataList
[
index
].
isChecked
,
});
});
}
else
{
}
else
{
selectList
.
splice
(
hasIndex
,
1
);
selectList
.
splice
(
hasIndex
,
1
);
...
@@ -289,7 +302,6 @@ const SiteManage = props => {
...
@@ -289,7 +302,6 @@ const SiteManage = props => {
dataList
[
outerIndex
].
Users
[
innerIndex
].
isChecked
=
false
;
dataList
[
outerIndex
].
Users
[
innerIndex
].
isChecked
=
false
;
dataList
[
outerIndex
].
isChecked
=
isAllChecked
(
outerIndex
);
dataList
[
outerIndex
].
isChecked
=
isAllChecked
(
outerIndex
);
}
}
selectList
.
splice
(
index
,
1
);
selectList
.
splice
(
index
,
1
);
setSelectList
(
lodash
.
cloneDeep
(
selectList
));
setSelectList
(
lodash
.
cloneDeep
(
selectList
));
setdataList
(
lodash
.
cloneDeep
(
dataList
));
setdataList
(
lodash
.
cloneDeep
(
dataList
));
...
@@ -301,13 +313,14 @@ const SiteManage = props => {
...
@@ -301,13 +313,14 @@ const SiteManage = props => {
let
obj
=
{};
let
obj
=
{};
selectList
.
forEach
(
item
=>
{
selectList
.
forEach
(
item
=>
{
if
(
obj
[
item
.
GroupId
])
{
if
(
obj
[
item
.
GroupId
])
{
obj
[
item
.
GroupId
]
=
item
.
isChecked
obj
[
item
.
GroupId
].
push
(
item
.
userID
);
?
[...
obj
[
item
.
GroupId
],
item
.
userID
,
item
.
GroupId
]
:
[...
obj
[
item
.
GroupId
],
item
.
userID
];
}
else
{
}
else
{
obj
[
item
.
GroupId
]
=
item
.
isChecked
obj
[
item
.
GroupId
]
=
[
item
.
userID
];
?
[
item
.
userID
,
item
.
GroupId
]
}
:
[
item
.
userID
];
});
dataList
.
forEach
(
item
=>
{
if
(
obj
[
item
.
GroupId
]
&&
item
.
Users
.
length
===
obj
[
item
.
GroupId
].
length
)
{
obj
[
item
.
GroupId
].
push
(
item
.
GroupId
);
}
}
});
});
result
=
Object
.
values
(
obj
);
result
=
Object
.
values
(
obj
);
...
@@ -333,7 +346,7 @@ const SiteManage = props => {
...
@@ -333,7 +346,7 @@ const SiteManage = props => {
if
(
res
.
success
)
{
if
(
res
.
success
)
{
setSelectList
([]);
setSelectList
([]);
getList
(
);
setUpdate1
(
update1
+
1
);
notification
.
success
({
notification
.
success
({
message
:
'提示'
,
message
:
'提示'
,
duration
:
3
,
duration
:
3
,
...
@@ -355,6 +368,7 @@ const SiteManage = props => {
...
@@ -355,6 +368,7 @@ const SiteManage = props => {
// 分页
// 分页
const
handleChangePage
=
(
pageNum
,
pageSize
)
=>
{
const
handleChangePage
=
(
pageNum
,
pageSize
)
=>
{
setPage
({
pageNum
,
pageSize
});
setPage
({
pageNum
,
pageSize
});
setUpdate
(
update
+
1
);
};
};
return
(
return
(
<
PageContainer
>
<
PageContainer
>
...
@@ -452,7 +466,7 @@ const SiteManage = props => {
...
@@ -452,7 +466,7 @@ const SiteManage = props => {
allowClear
allowClear
placeholder=
{
placeholder
}
placeholder=
{
placeholder
}
onSearch=
{
handleSearch
}
onSearch=
{
handleSearch
}
onChange=
{
handleChange
}
//
onChange={handleChange}
enterButton
enterButton
/>
/>
</
Col
>
</
Col
>
...
@@ -494,64 +508,66 @@ const SiteManage = props => {
...
@@ -494,64 +508,66 @@ const SiteManage = props => {
</
Col
>
</
Col
>
</
Row
>
</
Row
>
</
Card
>
</
Card
>
<
Card
<
div
style=
{
{
background
:
'#fff'
}
}
>
className=
{
classnames
({
<
Card
[
styles
.
boxH
]:
mulu
,
className=
{
classnames
({
[
styles
.
cardBoxR
]:
true
,
[
styles
.
boxH
]:
mulu
,
})
}
[
styles
.
cardBoxR
]:
true
,
>
})
}
{
/* <Checkbox className={styles.siteAll}>全选/反选</Checkbox> */
}
>
<
Spin
spinning=
{
visibleParams
.
loading
}
>
{
/* <Checkbox className={styles.siteAll}>全选/反选</Checkbox> */
}
{
dataList
.
map
((
item
,
index
)
=>
(
<
Spin
spinning=
{
visibleParams
.
loading
}
>
<
Panels
{
dataList
.
map
((
item
,
index
)
=>
(
{
...
item
}
<
Panels
index=
{
index
}
{
...
item
}
key=
{
item
.
GroupId
}
index=
{
index
}
handleChangeCollpase=
{
handleChangeCollpase
}
key=
{
item
.
GroupId
}
handleChangeAll=
{
handleChangeAll
}
handleChangeCollpase=
{
handleChangeCollpase
}
handleChangeSignel=
{
handleChangeSignel
}
handleChangeAll=
{
handleChangeAll
}
/>
handleChangeSignel=
{
handleChangeSignel
}
))
}
</
Spin
>
{
dataList
.
length
>
0
?
(
<>
<
div
style=
{
{
textAlign
:
'right'
}
}
>
<
Pagination
size=
"small"
total=
{
total
}
current=
{
page
.
pageNum
}
defaultPageSize=
"5"
onChange=
{
handleChangePage
}
pageSizeOptions=
{
[
'5'
]
}
/>
/>
</
div
>
))
}
<
p
>
已选择列表:
</
p
>
</
Spin
>
<
div
className=
{
styles
.
siteSelectList
}
>
{
dataList
.
length
>
0
?
(
<
ul
className=
{
styles
.
siteSelectUl
}
>
<>
{
selectList
.
map
((
item
,
index
)
=>
(
<
div
style=
{
{
textAlign
:
'right'
}
}
>
<
li
<
Pagination
key=
{
`${item.userName}${item.GroupId}`
}
size=
"small"
onClick=
{
()
=>
handleDel
(
index
)
}
total=
{
total
}
>
current=
{
page
.
pageNum
}
{
`${item.userName}(${item.GroupName})`
}
defaultPageSize=
"5"
</
li
>
onChange=
{
handleChangePage
}
))
}
pageSizeOptions=
{
[
'5'
]
}
</
ul
>
/>
</
div
>
</
div
>
<
div
className=
{
styles
.
siteBtn
}
>
<
p
>
已选择列表:
</
p
>
<
Button
<
div
className=
{
styles
.
siteSelectList
}
>
type=
"primary"
<
ul
className=
{
styles
.
siteSelectUl
}
>
className=
{
styles
.
siteCommit
}
{
selectList
.
map
((
item
,
index
)
=>
(
onClick=
{
handleCommitBtn
}
<
li
>
key=
{
`${item.userName}${item.GroupId}${index}`
}
提交
onClick=
{
()
=>
handleDel
(
index
)
}
</
Button
>
>
</
div
>
{
`${item.userName}(${item.GroupName})`
}
</>
</
li
>
)
:
(
))
}
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
</
ul
>
)
}
</
div
>
</
Card
>
</>
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
)
}
</
Card
>
<
div
className=
{
styles
.
siteBtn
}
>
<
Button
type=
"primary"
className=
{
styles
.
siteCommit
}
onClick=
{
handleCommitBtn
}
>
提交
</
Button
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
{
/* </Col>
{
/* </Col>
...
...
src/pages/userCenter/siteManage/SiteManage.less
View file @
73f63636
...
@@ -29,8 +29,8 @@
...
@@ -29,8 +29,8 @@
border-bottom: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
}
.cardBoxR{
.cardBoxR{
min-height: calc(100vh -
158
px);
min-height: calc(100vh -
200
px);
max-height: calc(100vh -
158
px);
max-height: calc(100vh -
200
px);
min-width: 600px;
min-width: 600px;
overflow-y: scroll;
overflow-y: scroll;
}
}
...
@@ -104,7 +104,8 @@
...
@@ -104,7 +104,8 @@
}
}
.siteList{
.siteList{
width:199px;
width:199px;
margin:0 0 15px 0
// margin:0 0 15px 0;
padding:0 0 15px 0;
}
}
.sitePanel{
.sitePanel{
margin: 0 0 10px 0;
margin: 0 0 10px 0;
...
@@ -139,7 +140,7 @@
...
@@ -139,7 +140,7 @@
color:#f00
color:#f00
}
}
.siteCommit{
.siteCommit{
margin
-top: 20px
;
margin
: 10px 0
;
}
}
.siteSelectList{
.siteSelectList{
border:1px solid #f5f5f5;
border:1px solid #f5f5f5;
...
@@ -168,8 +169,9 @@
...
@@ -168,8 +169,9 @@
}
}
}
}
.siteBtn{
.siteBtn{
width:70.5vw;
width:98%;
text-align: right;
display: flex;
position: fixed;
flex-direction: row;
bottom: 20px;
align-items: center;
justify-content: flex-end;
}
}
\ No newline at end of file
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