Commit 39a277af authored by 皮倩雯's avatar 皮倩雯

fix: '重构站点管理勾选站点人员模块'

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