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
39a277af
Commit
39a277af
authored
Jan 20, 2022
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '重构站点管理勾选站点人员模块'
parent
7b02121e
Pipeline
#43210
skipped with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
177 additions
and
150 deletions
+177
-150
AddModal.jsx
src/pages/bsmanager/workOrder/incident/AddModal.jsx
+5
-1
ProxyConfig.jsx
...es/platformCenter/hostmanager/proxyConfig/ProxyConfig.jsx
+17
-17
index.jsx
src/pages/platformCenter/videoManager/index.jsx
+7
-20
SiteManage.jsx
src/pages/userCenter/siteManage/SiteManage.jsx
+138
-112
api.js
src/services/siteManage/api.js
+10
-0
No files found.
src/pages/bsmanager/workOrder/incident/AddModal.jsx
View file @
39a277af
...
...
@@ -1272,7 +1272,11 @@ const AddModal = props => {
},
]
}
>
<
Input
value=
{
prefixName
}
placeholder=
"请输入编码前缀"
/>
<
Input
value=
{
prefixName
}
placeholder=
"请输入编码前缀"
style=
{
{
marginLeft
:
'-3px'
}
}
/>
</
Item
>
</
Col
>
<
Col
span=
{
24
}
>
...
...
src/pages/platformCenter/hostmanager/proxyConfig/ProxyConfig.jsx
View file @
39a277af
...
...
@@ -59,7 +59,7 @@ const ProxyConfig = () => {
OperateStopNginx
();
}
};
//开启Nginx
//
开启Nginx
const
OperateStartNginx
=
()
=>
{
StartNginx
().
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
...
...
@@ -70,7 +70,7 @@ const ProxyConfig = () => {
}
});
};
//停止Nginx
//
停止Nginx
const
OperateStopNginx
=
()
=>
{
StopNginx
().
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
...
...
@@ -81,7 +81,7 @@ const ProxyConfig = () => {
}
});
};
//开启/关闭缓存
//
开启/关闭缓存
const
OperateNginxCache
=
isOpen
=>
{
NginxCache
({
isOpen
:
isOpen
?
1
:
0
,
...
...
@@ -94,7 +94,7 @@ const ProxyConfig = () => {
}
});
};
//开启/关闭日志
//
开启/关闭日志
const
OperateNginxLog
=
isOpen
=>
{
NginxLog
({
isOpen
:
isOpen
?
1
:
0
,
...
...
@@ -133,7 +133,6 @@ const ProxyConfig = () => {
Object
.
keys
(
currentConfig
).
forEach
(
k
=>
{
obj
[
k
]
=
res
.
data
[
k
];
});
console
.
log
(
obj
);
form
.
setFieldsValue
(
obj
);
}
else
{
message
.
errorInfo
(
res
.
msg
);
...
...
@@ -181,22 +180,24 @@ const ProxyConfig = () => {
</
div
>
<
Divider
/>
<
Form
.
Item
style=
{
{
marginLeft
:
'20px'
}
}
label=
"端口(ngnix)"
style=
{
{
marginLeft
:
'12px'
}
}
label=
"Nginx端口"
labelAlign=
"right"
name=
"NginxPort"
rules=
{
[
{
required
:
true
,
pattern
:
new
RegExp
(
/^
[
1-9
]\d
*$/
,
'g'
),
message
:
'请输入
ngni
x端口,例如:8091'
,
message
:
'请输入
Ngin
x端口,例如:8091'
,
},
]
}
>
<
Input
style=
{
{
marginLeft
:
'15px'
,
width
:
'300px'
}
}
placeholder=
"请输入ngni
x端口"
/>
<
Input
style=
{
{
width
:
'300px'
}
}
placeholder=
"请输入Ngin
x端口"
/>
</
Form
.
Item
>
<
Form
.
Item
style=
{
{
marginLeft
:
'20px'
}
}
label=
"地址(IIS)"
style=
{
{
marginLeft
:
'34px'
}
}
label=
"IIS地址"
labelAlign=
"right"
name=
"IISIPProt"
rules=
{
[
{
...
...
@@ -208,15 +209,14 @@ const ProxyConfig = () => {
message
:
'请输入正确的IP例如:192.168.12.231:8231'
,
},
]
}
hasFeedback
>
<
Input
style=
{
{
marginLeft
:
'34px'
,
width
:
'300px'
}
}
placeholder=
"请输入IIS地址"
/>
<
Input
style=
{
{
width
:
'300px'
}
}
placeholder=
"请输入IIS地址"
/>
</
Form
.
Item
>
<
Form
.
Item
style=
{
{
marginLeft
:
'20px'
}
}
label=
"地址(EMQ)"
label=
"EMQ地址"
labelAlign=
"right"
name=
"EMQIPPort"
hasFeedback
rules=
{
[
{
required
:
true
,
...
...
@@ -228,10 +228,10 @@ const ProxyConfig = () => {
},
]
}
>
<
Input
style=
{
{
marginLeft
:
'18px'
,
width
:
'300px'
}
}
placeholder=
"请输入EMQ地址"
/>
<
Input
style=
{
{
width
:
'300px'
}
}
placeholder=
"请输入EMQ地址"
/>
</
Form
.
Item
>
<
Form
.
Item
>
<
Button
type=
"primary"
htmlType=
"submit"
style=
{
{
marginLeft
:
'1
30
px'
}
}
>
<
Button
type=
"primary"
htmlType=
"submit"
style=
{
{
marginLeft
:
'1
03
px'
}
}
>
保存
</
Button
>
</
Form
.
Item
>
...
...
src/pages/platformCenter/videoManager/index.jsx
View file @
39a277af
...
...
@@ -28,10 +28,7 @@ import {
}
from
'@ant-design/icons'
;
import
voca
from
'voca'
;
import
styles
from
'./index.less'
;
import
{
GetVideoConfigList
,
deleteInsertVideoConfig
,
}
from
'@/services/videoManger/videoManger'
;
import
{
GetVideoConfigList
,
deleteInsertVideoConfig
}
from
'@/services/videoManger/videoManger'
;
import
AddModal
from
'./AddModal'
;
import
CheckModal
from
'./CheckModal'
;
import
VideoModal
from
'./VideoModal'
;
...
...
@@ -149,10 +146,7 @@ const videoManager = () => {
render
:
record
=>
(
<
Space
size=
"middle"
>
<
Tooltip
title=
"编辑"
>
<
EditTwoTone
onClick=
{
()
=>
edit
(
record
)
}
style=
{
{
fontSize
:
'16px'
}
}
/>
<
EditTwoTone
onClick=
{
()
=>
edit
(
record
)
}
style=
{
{
fontSize
:
'16px'
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"预览"
>
<
VideoCameraOutlined
...
...
@@ -171,10 +165,7 @@ const videoManager = () => {
placement=
"bottomRight"
title=
{
<
p
>
即将删除
{
' '
}
<
span
className=
{
styles
.
redText
}
>
{
voca
.
stripTags
(
record
.
Name
)
}
</
span
>
即将删除
<
span
className=
{
styles
.
redText
}
>
{
voca
.
stripTags
(
record
.
Name
)
}
</
span
>
,是否确认删除?
</
p
>
}
...
...
@@ -194,10 +185,7 @@ const videoManager = () => {
const
searchStyle
=
val
=>
{
let
n
;
if
(
showSearchStyle
)
{
n
=
val
.
replace
(
new
RegExp
(
searchWord
,
'g'
),
`<span style='color:red'>
${
searchWord
}
</span>`
,
);
n
=
val
.
replace
(
new
RegExp
(
searchWord
,
'g'
),
`<span style='color:red'>
${
searchWord
}
</span>`
);
}
else
{
n
=
val
;
}
...
...
@@ -356,12 +344,12 @@ const videoManager = () => {
<
Col
span=
{
24
}
>
<
span
>
配置类型:
</
span
>
<
Select
defaultValue=
"
莹
石云"
defaultValue=
"
萤
石云"
value=
{
configurationType
}
onChange=
{
selectChange
}
className=
{
styles
.
sel
}
>
<
Option
value=
"1"
>
莹
石云
</
Option
>
<
Option
value=
"1"
>
萤
石云
</
Option
>
<
Option
value=
"2"
>
海康
</
Option
>
<
Option
value=
"3"
>
海康1.2
</
Option
>
<
Option
value=
"4"
>
海康NVR
</
Option
>
...
...
@@ -415,8 +403,7 @@ const videoManager = () => {
},
// 双击
})
}
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
pageSizeOptions
:
[
10
,
20
,
50
,
100
],
defaultPageSize
:
20
,
showQuickJumper
:
true
,
...
...
src/pages/userCenter/siteManage/SiteManage.jsx
View file @
39a277af
/* eslint-disable no-shadow */
/* eslint-disable array-callback-return */
/* eslint-disable consistent-return */
/* eslint-disable react/no-multi-comp */
/* eslint-disable eqeqeq */
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
// Tree,
Table
,
Space
,
message
,
Modal
,
Input
,
notification
,
Tooltip
,
Card
,
Button
,
Spin
,
Dropdown
,
Menu
,
Row
,
Col
,
Empty
,
...
...
@@ -22,15 +22,11 @@ import {
import
classnames
from
'classnames'
;
import
{
UserOutlined
,
PlusSquareOutlined
,
UsergroupAddOutlined
,
EditOutlined
,
FormOutlined
,
DeleteOutlined
,
DoubleLeftOutlined
,
DoubleRightOutlined
,
DownOutlined
,
PlusOutlined
,
ApartmentOutlined
,
CaretUpOutlined
,
...
...
@@ -46,16 +42,12 @@ import lodash, { clone } from 'lodash';
import
styles
from
'./SiteManage.less'
;
import
{
getWebModuleTree
,
chooseUserToStation
,
getAllGroup
,
getUserByStation
,
getStationUserList
,
groupUserPagingList
,
addChildSiteNode
,
getSiteTree
,
getStationUsers
,
DragGroup
,
getGroupUserTree
,
}
from
'@/services/siteManage/api'
;
import
AddModal
from
'./AddModal'
;
import
DelModal
from
'./DelModal'
;
...
...
@@ -72,8 +64,6 @@ const SiteManageV2 = () => {
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
const
[
currentStation
,
setCurrentStation
]
=
useState
(
''
);
// 当前选中站点
const
[
currentStationMsg
,
setCurrentStationMsg
]
=
useState
({});
// 当前编辑节点信息
const
[
currentStationOperate
,
setCurrentStationOperate
]
=
useState
(
false
);
const
[
flag
,
setFlag
]
=
useState
(
1
);
// 操作标致触发界面刷新
const
[
dataList
,
setdataList
]
=
useState
([]);
// 当前站点对应的分页用户列表
const
[
selectedState
,
setSelectedState
]
=
useState
(
false
);
// 已选列表展开状态true为展开false为收起
const
[
visibleParams
,
setvisibleParams
]
=
useState
({
...
...
@@ -87,7 +77,7 @@ const SiteManageV2 = () => {
});
const
[
total
,
setTotal
]
=
useState
(
0
);
// 分页总数
const
[
page
,
setPage
]
=
useState
({
pageNum
:
1
,
pageSize
:
10
});
const
[
selectList
,
setSelectList
]
=
useState
([]);
//
选择
列表数据
const
[
selectList
,
setSelectList
]
=
useState
([]);
//
已勾选
列表数据
const
[
updatePageUser
,
setUpdatePageUser
]
=
useState
(
1
);
//
const
[
updateCheck
,
setUpdateCheck
]
=
useState
(
1
);
const
[
name
,
setName
]
=
useState
(
''
);
...
...
@@ -147,7 +137,6 @@ const SiteManageV2 = () => {
// 编辑当前站点
const
editorSite
=
(
e
,
recode
)
=>
{
e
.
stopPropagation
();
// console.log(recode);
// 保存编辑回显信息
setCurrentStationMsg
(
recode
);
// setCurrentStation(recode.id);
...
...
@@ -200,30 +189,28 @@ const SiteManageV2 = () => {
getAllCheckListNew
();
},
[
currentStation
,
updateCheck
]);
// 获取当前站点可编辑用户(已勾选和未勾选)分页展示
const
getList
=
()
=>
{
let
params
=
{
id
:
+
currentStation
||
''
,
PageIndex
:
+
page
.
pageNum
,
PageSize
:
+
page
.
pageSize
,
};
if
(
name
)
params
=
{
...
params
,
name
};
g
roupUserPagingList
(
params
).
then
(
res
=>
{
if
(
name
)
params
=
{
...
params
,
key
:
name
};
g
etGroupUserTree
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
0
&&
res
.
data
)
{
setShowSearchStyle
(
true
);
let
{
list
}
=
res
.
data
;
let
list
=
res
.
data
.
data
;
// 还原选择的数据
if
(
selectList
.
length
>
0
)
{
selectList
.
forEach
(
item
=>
{
list
.
forEach
((
value
,
index
)
=>
{
if
(
item
.
GroupId
===
value
.
G
roupId
)
{
list
[
index
].
U
sers
.
forEach
((
user
,
userIndex
)
=>
{
if
(
user
.
userI
D
===
item
.
userID
)
{
list
[
index
].
U
sers
[
userIndex
].
isChecked
=
true
;
if
(
item
.
groupId
==
value
.
g
roupId
)
{
list
[
index
].
u
sers
.
forEach
((
user
,
userIndex
)
=>
{
if
(
user
.
userI
d
===
item
.
userId
)
{
list
[
index
].
u
sers
[
userIndex
].
isChecked
=
true
;
}
});
let
checkedLen
=
list
[
index
].
U
sers
.
filter
(
v
=>
v
.
isChecked
).
length
;
if
(
checkedLen
===
list
[
index
].
U
sers
.
length
)
{
let
checkedLen
=
list
[
index
].
u
sers
.
filter
(
v
=>
v
.
isChecked
).
length
;
if
(
checkedLen
===
list
[
index
].
u
sers
.
length
)
{
list
[
index
].
isChecked
=
true
;
}
}
...
...
@@ -232,45 +219,96 @@ const SiteManageV2 = () => {
}
handleShowModal
(
'loading'
,
false
);
setdataList
(
lodash
.
cloneDeep
(
list
));
setTotal
(
res
.
data
.
TotalC
ount
);
setTotal
(
res
.
data
.
c
ount
);
}
else
{
handleShowModal
(
'loading'
,
false
);
setdataList
(
lodash
.
cloneDeep
([]));
}
});
};
// 获取当前站点所有已经勾选的用户
const
getAllcheckList
=
async
()
=>
{
let
res
=
await
getUserByStation
({
stationID
:
currentStation
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
// 搜索状态时获取当前站点可编辑用户(已勾选和未勾选)分页展示
const
getSearchList
=
value
=>
{
let
params
=
{
PageIndex
:
1
,
PageSize
:
10
,
};
if
(
value
)
params
=
{
...
params
,
key
:
value
};
getGroupUserTree
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
0
&&
res
.
data
)
{
setShowSearchStyle
(
true
);
let
list
=
res
.
data
.
data
;
// 还原选择的数据
if
(
selectList
.
length
>
0
)
{
selectList
.
forEach
(
item
=>
{
list
.
forEach
((
value
,
index
)
=>
{
if
(
item
.
groupId
==
value
.
groupId
)
{
list
[
index
].
users
.
forEach
((
user
,
userIndex
)
=>
{
if
(
user
.
userId
===
item
.
userId
)
{
list
[
index
].
users
[
userIndex
].
isChecked
=
true
;
}
});
let
checkedLen
=
list
[
index
].
users
.
filter
(
v
=>
v
.
isChecked
).
length
;
if
(
checkedLen
===
list
[
index
].
users
.
length
)
{
list
[
index
].
isChecked
=
true
;
}
}
});
});
}
handleShowModal
(
'loading'
,
false
);
setdataList
(
lodash
.
cloneDeep
(
list
));
setTotal
(
res
.
data
.
count
);
}
else
{
handleShowModal
(
'loading'
,
false
);
setdataList
(
lodash
.
cloneDeep
([]));
}
});
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
,
});
}
setPage
({
pageNum
:
1
,
pageSize
:
10
});
};
// 重置
const
restButton
=
()
=>
{
let
params
=
{
PageIndex
:
1
,
PageSize
:
10
,
};
params
=
{
...
params
};
getGroupUserTree
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
0
&&
res
.
data
)
{
setShowSearchStyle
(
true
);
let
list
=
res
.
data
.
data
;
// 还原选择的数据
if
(
selectList
.
length
>
0
)
{
selectList
.
forEach
(
item
=>
{
list
.
forEach
((
value
,
index
)
=>
{
if
(
item
.
groupId
==
value
.
groupId
)
{
list
[
index
].
users
.
forEach
((
user
,
userIndex
)
=>
{
if
(
user
.
userId
===
item
.
userId
)
{
list
[
index
].
users
[
userIndex
].
isChecked
=
true
;
}
});
let
checkedLen
=
list
[
index
].
users
.
filter
(
v
=>
v
.
isChecked
).
length
;
if
(
checkedLen
===
list
[
index
].
users
.
length
)
{
list
[
index
].
isChecked
=
true
;
}
}
});
});
}
});
setSelectList
(
lodash
.
cloneDeep
(
list
));
setUpdatePageUser
(
updatePageUser
+
1
);
}
handleShowModal
(
'loading'
,
false
);
setdataList
(
lodash
.
cloneDeep
(
list
));
setTotal
(
res
.
data
.
count
);
}
else
{
handleShowModal
(
'loading'
,
false
);
setdataList
(
lodash
.
cloneDeep
([]));
}
});
setName
(
''
);
setPage
({
pageNum
:
1
,
pageSize
:
10
});
};
const
handleChange
=
e
=>
{
setName
(
e
.
target
.
value
);
};
// 获取当前站点所有已经勾选的用户新接口
...
...
@@ -282,10 +320,10 @@ const SiteManageV2 = () => {
if
(
res
.
data
.
length
>
0
)
{
res
.
data
.
map
((
item
,
index
)
=>
{
list
.
push
({
G
roupId
:
+
item
.
OUID
,
G
roupName
:
item
.
OUName
,
g
roupId
:
+
item
.
OUID
,
g
roupName
:
item
.
OUName
,
userName
:
item
.
userName
,
userI
D
:
item
.
userID
,
userI
d
:
item
.
userID
,
});
});
}
...
...
@@ -295,7 +333,6 @@ const SiteManageV2 = () => {
};
// 选中某个站点
const
onSelect
=
(
props
,
e
)
=>
{
console
.
log
(
'props[0]'
,
props
[
0
]);
setCh
(
props
[
0
]);
if
(
!
props
[
0
])
{
setCurrentStation
(
currentStation
);
...
...
@@ -303,11 +340,8 @@ const SiteManageV2 = () => {
setCurrentStation
(
props
[
0
]);
}
setPage
({
pageNum
:
1
,
pageSize
:
10
});
console
.
log
(
data
);
data
.
map
((
item
,
index
)
=>
{
if
(
item
.
id
==
props
[
0
])
{
console
.
log
(
item
.
id
);
console
.
log
(
item
.
describe
);
setDes
(
item
.
describe
);
}
});
...
...
@@ -315,19 +349,16 @@ const SiteManageV2 = () => {
const
getValue
=
()
=>
{
getSiteTree
({
selectNode
:
-
1
}).
then
(
res
=>
{
console
.
log
(
res
.
data
);
getData1
(
res
.
data
);
});
};
const
getData1
=
e
=>
{
console
.
log
(
e
);
e
.
map
((
i
,
j
)
=>
{
a
.
push
(
i
);
if
(
i
.
children
.
length
>
0
)
{
getData1
(
i
.
children
);
}
});
console
.
log
(
a
);
setData
(
a
);
};
...
...
@@ -337,8 +368,8 @@ const SiteManageV2 = () => {
};
// 获取搜索框的值
const
handleSearch
=
value
=>
{
setName
(
value
);
getList
(
value
);
//
setName(value);
get
Search
List
(
value
);
};
const
confirmModal
=
e
=>
{
handleShowModal
(
'modalVisible'
,
false
);
...
...
@@ -362,7 +393,7 @@ const SiteManageV2 = () => {
};
const
handleChangeCollpase
=
(
groupId
,
isShow
)
=>
{
let
index
=
dataList
.
findIndex
(
item
=>
item
.
G
roupId
===
groupId
);
let
index
=
dataList
.
findIndex
(
item
=>
item
.
g
roupId
===
groupId
);
if
(
dataList
[
index
].
children
&&
dataList
[
index
].
children
.
length
>
0
)
{
setdataList
(
lodash
.
cloneDeep
(
dataList
));
return
;
...
...
@@ -379,18 +410,18 @@ const SiteManageV2 = () => {
// 每组全选全不选
const
handleChangeAll
=
(
e
,
index
)
=>
{
dataList
[
index
].
isChecked
=
e
.
target
.
checked
;
dataList
[
index
].
U
sers
.
forEach
(
item
=>
{
dataList
[
index
].
u
sers
.
forEach
(
item
=>
{
item
.
isChecked
=
e
.
target
.
checked
;
let
delIndex
=
selectList
.
findIndex
(
v
=>
v
.
GroupId
===
dataList
[
index
].
GroupId
&&
v
.
userID
===
item
.
userID
,
v
=>
v
.
groupId
==
dataList
[
index
].
groupId
&&
v
.
userId
==
item
.
userId
,
);
if
(
e
.
target
.
checked
)
{
if
(
delIndex
===
-
1
)
{
selectList
.
push
({
GroupId
:
dataList
[
index
].
G
roupId
,
GroupName
:
dataList
[
index
].
G
roupName
,
groupId
:
dataList
[
index
].
g
roupId
,
groupName
:
dataList
[
index
].
g
roupName
,
userName
:
item
.
userName
,
userI
D
:
item
.
userID
,
userI
d
:
item
.
userId
,
});
}
}
...
...
@@ -398,41 +429,41 @@ const SiteManageV2 = () => {
selectList
.
splice
(
delIndex
,
1
);
}
});
setSelectList
(
lodash
.
cloneDeep
(
selectList
));
setdataList
(
lodash
.
cloneDeep
(
dataList
));
};
// 单个选择checkbox
const
handleChangeSignel
=
(
e
,
index
,
vIndex
)
=>
{
dataList
[
index
].
U
sers
[
vIndex
].
isChecked
=
e
.
target
.
checked
;
dataList
[
index
].
u
sers
[
vIndex
].
isChecked
=
e
.
target
.
checked
;
let
checked
=
isAllChecked
(
index
);
let
hasIndex
=
selectList
.
findIndex
(
item
=>
item
.
userI
D
===
dataList
[
index
].
Users
[
vIndex
].
userID
&&
item
.
GroupId
===
dataList
[
index
].
G
roupId
,
item
.
userI
d
==
dataList
[
index
].
users
[
vIndex
].
userId
&&
item
.
groupId
==
dataList
[
index
].
g
roupId
,
);
dataList
[
index
].
isChecked
=
checked
;
if
(
e
.
target
.
checked
&&
hasIndex
===
-
1
)
{
selectList
.
push
({
GroupId
:
dataList
[
index
].
G
roupId
,
GroupName
:
dataList
[
index
].
G
roupName
,
userName
:
dataList
[
index
].
U
sers
[
vIndex
].
userName
,
userI
D
:
dataList
[
index
].
Users
[
vIndex
].
userID
,
groupId
:
dataList
[
index
].
g
roupId
,
groupName
:
dataList
[
index
].
g
roupName
,
userName
:
dataList
[
index
].
u
sers
[
vIndex
].
userName
,
userI
d
:
dataList
[
index
].
users
[
vIndex
].
userId
,
});
}
else
{
selectList
.
splice
(
hasIndex
,
1
);
}
setSelectList
(
lodash
.
cloneDeep
(
selectList
));
setdataList
(
lodash
.
cloneDeep
(
dataList
));
};
const
isAllChecked
=
index
=>
dataList
[
index
].
Users
.
filter
(
item
=>
item
.
isChecked
).
length
===
dataList
[
index
].
U
sers
.
length
;
dataList
[
index
].
users
.
filter
(
item
=>
item
.
isChecked
).
length
===
dataList
[
index
].
u
sers
.
length
;
// 删除已选列表
const
handleDel
=
index
=>
{
let
{
GroupId
,
userID
}
=
selectList
[
index
];
let
outerIndex
=
dataList
.
findIndex
(
item
=>
item
.
GroupId
===
G
roupId
);
let
{
groupId
,
userId
}
=
selectList
[
index
];
let
outerIndex
=
dataList
.
findIndex
(
item
=>
item
.
groupId
==
g
roupId
);
if
(
outerIndex
>
-
1
)
{
let
innerIndex
=
dataList
[
outerIndex
].
Users
.
findIndex
(
item
=>
item
.
userID
===
userID
);
dataList
[
outerIndex
].
U
sers
[
innerIndex
].
isChecked
=
false
;
let
innerIndex
=
dataList
[
outerIndex
].
users
.
findIndex
(
item
=>
item
.
userId
==
userId
);
dataList
[
outerIndex
].
u
sers
[
innerIndex
].
isChecked
=
false
;
dataList
[
outerIndex
].
isChecked
=
isAllChecked
(
outerIndex
);
}
selectList
.
splice
(
index
,
1
);
...
...
@@ -445,10 +476,10 @@ const SiteManageV2 = () => {
let
result
=
[];
let
obj
=
{};
selectList
.
forEach
(
item
=>
{
if
(
obj
[
item
.
G
roupId
])
{
obj
[
item
.
GroupId
].
push
(
item
.
userID
);
if
(
obj
[
item
.
g
roupId
])
{
obj
[
item
.
groupId
].
push
(
item
.
userId
);
}
else
{
obj
[
item
.
GroupId
]
=
[
item
.
userID
];
obj
[
item
.
groupId
]
=
[
item
.
userId
];
}
});
// dataList.forEach(item => {
...
...
@@ -488,7 +519,6 @@ const SiteManageV2 = () => {
})
.
catch
(
err
=>
{
handleShowModal
(
'btnLoading'
,
false
);
console
.
log
(
err
);
});
};
// 分页
...
...
@@ -504,15 +534,12 @@ const SiteManageV2 = () => {
// 模糊查询匹配的样式
const
searchStyle
=
val
=>
{
console
.
log
(
showSearchStyle
);
console
.
log
(
name
);
let
n
;
if
(
showSearchStyle
)
{
n
=
val
.
replace
(
new
RegExp
(
name
,
'g'
),
`<span style='color:red'>
${
name
}
</span>`
);
}
else
{
n
=
val
;
}
console
.
log
(
n
);
return
<
div
dangerouslySetInnerHTML=
{
{
__html
:
n
}
}
/>;
};
// 返回拖拽完毕后的信息
...
...
@@ -528,15 +555,12 @@ const SiteManageV2 = () => {
};
// 树的拖拽
const
handleDrop
=
infos
=>
{
console
.
log
(
infos
);
const
dropKey
=
infos
.
node
.
key
;
const
dragKey
=
infos
.
dragNode
.
key
;
const
dropPos
=
infos
.
node
.
pos
.
split
(
'-'
);
const
dropPosition
=
infos
.
dropPosition
-
Number
(
dropPos
[
dropPos
.
length
-
1
]);
const
datas
=
JSON
.
parse
(
JSON
.
stringify
(
treeData
));
console
.
log
(
dropKey
,
'dropKey'
);
console
.
log
(
dragKey
,
'dragKey'
);
// 找到拖拽的元素
let
dragObj
;
let
dropObj
;
...
...
@@ -553,7 +577,6 @@ const SiteManageV2 = () => {
});
// 将节点插入到正确的位置
if
(
!
infos
.
dropToGap
)
{
console
.
log
(
'33333333333'
);
dropObj
.
children
=
dropObj
.
children
||
[];
// 在哪里插入,示例添加到头部,可以是随意位置
dropObj
.
children
.
unshift
(
dragObj
);
...
...
@@ -588,9 +611,9 @@ const SiteManageV2 = () => {
});
};
const
Panels
=
React
.
memo
(
props
=>
{
let
{
index
,
GroupId
,
GroupName
,
U
sers
,
isChecked
,
isShow
,
color
}
=
props
;
let
{
index
,
groupId
,
groupName
,
u
sers
,
isChecked
,
isShow
,
color
}
=
props
;
return
(
<
div
className=
{
styles
.
sitePanel
}
key=
{
GroupId
}
id=
{
`siteId${G
roupId}`
}
>
<
div
className=
{
styles
.
sitePanel
}
key=
{
groupId
}
id=
{
`siteId${g
roupId}`
}
>
{
/* onClick={() => props.handleChangeCollpase(GroupId, isShow)} */
}
<
div
className=
{
styles
.
sitePanelHead
}
>
{
/* {isShow ? (
...
...
@@ -600,7 +623,7 @@ const SiteManageV2 = () => {
)} */
}
{
/* <UpOutlined className={styles.siteIcon} /> */
}
<
ApartmentOutlined
className=
{
styles
.
siteIcon
}
/>
{
searchStyle
(
G
roupName
)
}
{
searchStyle
(
g
roupName
)
}
<
Checkbox
key=
"0"
className=
{
styles
.
siteListTitle
}
...
...
@@ -611,13 +634,13 @@ const SiteManageV2 = () => {
</
Checkbox
>
</
div
>
<
div
className=
{
styles
.
sitePanelCon
}
>
{
U
sers
.
length
>
0
&&
U
sers
.
map
((
v
,
vIndex
)
=>
(
{
u
sers
.
length
>
0
&&
u
sers
.
map
((
v
,
vIndex
)
=>
(
<
CheckBoxRow
{
...
v
}
index=
{
index
}
vIndex=
{
vIndex
}
key=
{
v
.
userI
D
}
key=
{
v
.
userI
d
}
handleChangeSignel=
{
props
.
handleChangeSignel
}
/>
))
}
...
...
@@ -724,11 +747,14 @@ const SiteManageV2 = () => {
allowClear
placeholder=
{
placeholder
}
onSearch=
{
handleSearch
}
// onChange={handleChange}
value=
{
name
}
onChange=
{
e
=>
handleChange
(
e
)
}
enterButton
/>
</
Col
>
<
Col
span=
{
3
}
/>
<
Col
span=
{
3
}
>
<
Button
onClick=
{
restButton
}
>
重置
</
Button
>
</
Col
>
</
Row
>
</
Card
>
<
div
style=
{
{
background
:
'#fff'
}
}
>
...
...
@@ -759,10 +785,10 @@ const SiteManageV2 = () => {
<
ul
className=
{
styles
.
siteSelectUl
}
>
{
selectList
.
map
((
item
,
index
)
=>
(
<
li
key=
{
`${item.userName}${item.
G
roupId}${index}`
}
key=
{
`${item.userName}${item.
g
roupId}${index}`
}
onClick=
{
()
=>
handleDel
(
index
)
}
>
{
`${item.userName}(${item.
G
roupName})`
}
{
`${item.userName}(${item.
g
roupName})`
}
</
li
>
))
}
</
ul
>
...
...
@@ -804,7 +830,7 @@ const SiteManageV2 = () => {
<
Panels
{
...
item
}
index=
{
index
}
key=
{
item
.
G
roupId
}
key=
{
item
.
g
roupId
}
handleChangeCollpase=
{
handleChangeCollpase
}
handleChangeAll=
{
handleChangeAll
}
handleChangeSignel=
{
handleChangeSignel
}
...
...
src/services/siteManage/api.js
View file @
39a277af
/*
* @Description:
* @Author: leizhe
* @Date: 2022-01-13 17:26:14
* @LastEditTime: 2022-01-19 17:00:53
* @LastEditors: leizhe
*/
import
{
get
,
post
,
CITY_SERVICE
,
PUBLISH_SERVICE
}
from
'@/services/index'
;
/*
...
...
@@ -37,6 +44,9 @@ export const getStationUserList = params =>
// 获取站点管理一二级列表+分页
export
const
groupUserPagingList
=
params
=>
post
(
`
${
PUBLISH_SERVICE
}
/UserCenter/GroupUserPagingList`
,
params
);
export
const
getGroupUserTree
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/GetGroupUserTree`
,
params
);
// 添加子站点
export
const
addChildSiteNode
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/AddChildSiteNode`
,
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