Commit d4617766 authored by 皮倩雯's avatar 皮倩雯

fix: '地图方案权限配置关联站点优化'

parent 01c660bd
Pipeline #82569 passed with stages
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Modal, Checkbox, Tabs, Input, Button, Pagination, Empty, Tag, Divider, Radio } from 'antd'; import { Modal, Checkbox, Tabs, Input, Button, Pagination, Empty, Tag, Divider, Radio } from 'antd';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api'; import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api';
import { GetMapLayerStationList } from '@/services/webConfig/api';
import styles from './index.less'; import styles from './index.less';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
...@@ -32,6 +33,8 @@ const RMSComponents = props => { ...@@ -32,6 +33,8 @@ const RMSComponents = props => {
chooseGroupName, chooseGroupName,
dataType, dataType,
isRadio, isRadio,
mapSite,
gisType,
} = props; } = props;
const [checkedList, setCheckedList] = useState([]); // 选中复选框内容 const [checkedList, setCheckedList] = useState([]); // 选中复选框内容
const [searchWord, setSearchWord] = useState(''); // 关键字 const [searchWord, setSearchWord] = useState(''); // 关键字
...@@ -102,7 +105,7 @@ const RMSComponents = props => { ...@@ -102,7 +105,7 @@ const RMSComponents = props => {
setKeyValue('2'); setKeyValue('2');
setKeepTabKey(2); setKeepTabKey(2);
} }
getRoles(groupName, '', pageSize, 1, 0);
let checkArr = []; let checkArr = [];
// 角色 // 角色
let listdata = []; let listdata = [];
...@@ -178,6 +181,7 @@ const RMSComponents = props => { ...@@ -178,6 +181,7 @@ const RMSComponents = props => {
} }
setSaveCheckValue(checkArr); setSaveCheckValue(checkArr);
setCheckedList(checkArr); setCheckedList(checkArr);
getRoles(groupName, '', pageSize, 1, 0, checkArr);
} }
}); });
} else { } else {
...@@ -232,6 +236,7 @@ const RMSComponents = props => { ...@@ -232,6 +236,7 @@ const RMSComponents = props => {
// 搜索时获取数据 // 搜索时获取数据
const sreachRoles = (type, keywords, pageSizes, pageIndex) => { const sreachRoles = (type, keywords, pageSizes, pageIndex) => {
if (!mapSite) {
CM_Event_LoadDepartmentAndRoles({ CM_Event_LoadDepartmentAndRoles({
type, type,
keywords, keywords,
...@@ -299,9 +304,92 @@ const RMSComponents = props => { ...@@ -299,9 +304,92 @@ const RMSComponents = props => {
} }
} }
}); });
} else {
GetMapLayerStationList({
keywords: keywords,
}).then(res => {
if (res.code === '0') {
let obj = {};
let arr = [];
res.data.list.forEach(i => {
let str = checkedList[2].indexOf(i.id.toString()) !== -1;
if (gisType === 'phone') {
arr.push({
label: i.name,
value: i.id.toString(),
disabled: str ? false : i.isPhone,
});
} else {
arr.push({
label: i.name,
value: i.id.toString(),
disabled: str ? false : i.isWeb,
});
}
});
obj.站点 = arr;
setOptionValue(obj);
let list = [];
let data = '';
if (type == '角色') {
data = 0;
} else if (type == '部门') {
data = 1;
} else if (type == '站点') {
data = 2;
}
obj[type] &&
obj[type].map(i => {
if (checkedList[data].indexOf(i.value) != -1) {
list.push(i.value);
}
});
if (list.length === obj[type].length) {
if (type == '角色') {
setCheckAll(true);
setIndeterminate(false);
} else if (type == '部门') {
setCheckAll1(true);
setIndeterminate1(false);
} else if (type == '站点') {
setCheckAll2(true);
setIndeterminate2(false);
}
} else if (list.length < obj[type].length && list.length !== 0) {
if (type == '角色') {
setCheckAll(false);
setIndeterminate(true);
} else if (type == '部门') {
setCheckAll1(false);
setIndeterminate1(true);
} else if (type == '站点') {
setCheckAll2(false);
setIndeterminate2(true);
}
} else if (list.length === 0) {
if (type == '角色') {
setCheckAll(false);
setIndeterminate(false);
} else if (type == '部门') {
setCheckAll1(false);
setIndeterminate1(false);
} else if (type == '站点') {
setCheckAll2(false);
setIndeterminate2(false);
}
}
if (res.data.count == 0) {
setEmptyValue(1);
} else {
setEmptyValue(0);
}
}
});
}
}; };
const getRoles = (type, keywords, pageSizes, pageIndex, flag) => { const getRoles = (type, keywords, pageSizes, pageIndex, flag, check) => {
if (!mapSite) {
CM_Event_LoadDepartmentAndRoles({ CM_Event_LoadDepartmentAndRoles({
type, type,
keywords, keywords,
...@@ -388,6 +476,109 @@ const RMSComponents = props => { ...@@ -388,6 +476,109 @@ const RMSComponents = props => {
} }
} }
}); });
} else {
GetMapLayerStationList({
keywords: '',
}).then(res => {
if (res.code === '0') {
let obj = {};
let arr = [];
res.data.list.forEach(i => {
let newCheck = check ? check : checkedList;
let str = newCheck[2].indexOf(i.id.toString()) !== -1;
if (gisType === 'phone') {
arr.push({
label: i.name,
value: i.id.toString(),
disabled: str ? false : i.isPhone,
});
} else {
arr.push({
label: i.name,
value: i.id.toString(),
disabled: str ? false : i.isWeb,
});
}
});
obj.站点 = arr;
setOptionValue(obj);
let list = [];
let data = '';
if (type == '角色') {
data = 0;
} else if (type == '部门') {
data = 1;
} else if (type == '站点') {
data = 2;
}
// 首次进入调用
if (flag != undefined) {
let listId = [];
newCheckedList.map(checkItem => {
keepFiled.current[groupName].map(i => {
let canSave = dataType === 'name' ? i.label == checkItem : i.value == checkItem;
if (canSave) {
listId.push(i.value.toString());
}
});
});
obj[type] &&
obj[type].map(i => {
if (listId.indexOf(i.value) != -1) {
list.push(i.value);
}
});
} else {
obj[type] &&
obj[type].map(i => {
if (checkedList[data].indexOf(i.value) != -1) {
list.push(i.value);
}
});
}
if (list.length === obj[type].length) {
if (type == '角色') {
setCheckAll(true);
setIndeterminate(false);
} else if (type == '部门') {
setCheckAll1(true);
setIndeterminate1(false);
} else if (type == '站点') {
setCheckAll2(true);
setIndeterminate2(false);
}
} else if (list.length < obj[type].length && list.length !== 0) {
if (type == '角色') {
setCheckAll(false);
setIndeterminate(true);
} else if (type == '部门') {
setCheckAll1(false);
setIndeterminate1(true);
} else if (type == '站点') {
setCheckAll2(false);
setIndeterminate2(true);
}
} else if (list.length === 0) {
if (type == '角色') {
setCheckAll(false);
setIndeterminate(false);
} else if (type == '部门') {
setCheckAll1(false);
setIndeterminate1(false);
} else if (type == '站点') {
setCheckAll2(false);
setIndeterminate2(false);
}
}
if (res.data.count == 0) {
setEmptyValue(1);
} else {
setEmptyValue(0);
}
}
});
}
}; };
const groupArr = (initialArr, name) => { const groupArr = (initialArr, name) => {
...@@ -927,6 +1118,8 @@ const RMSComponents = props => { ...@@ -927,6 +1118,8 @@ const RMSComponents = props => {
})} })}
</Radio.Group> </Radio.Group>
) : ( ) : (
<>
{!mapSite && (
<> <>
<Checkbox <Checkbox
indeterminate={indeterminate2} indeterminate={indeterminate2}
...@@ -936,6 +1129,9 @@ const RMSComponents = props => { ...@@ -936,6 +1129,9 @@ const RMSComponents = props => {
全选 全选
</Checkbox> </Checkbox>
<Divider /> <Divider />
</>
)}
<CheckboxGroup <CheckboxGroup
options={optionValue['站点']} options={optionValue['站点']}
value={checkedList[2]} value={checkedList[2]}
...@@ -957,6 +1153,7 @@ const RMSComponents = props => { ...@@ -957,6 +1153,7 @@ const RMSComponents = props => {
</div> </div>
{/* 分页 */} {/* 分页 */}
<div className={styles.footer}> <div className={styles.footer}>
{!mapSite && (
<Pagination <Pagination
size="small" size="small"
total={total} total={total}
...@@ -968,6 +1165,7 @@ const RMSComponents = props => { ...@@ -968,6 +1165,7 @@ const RMSComponents = props => {
onChange={paginationChange} onChange={paginationChange}
style={{ marginBottom: '10px' }} style={{ marginBottom: '10px' }}
/> />
)}
</div> </div>
</div> </div>
{/* 已选列表 */} {/* 已选列表 */}
......
...@@ -35,6 +35,7 @@ const VectorData = props => { ...@@ -35,6 +35,7 @@ const VectorData = props => {
const [leafs, setLeafs] = useState([]); const [leafs, setLeafs] = useState([]);
const [addVisible, setAddVisible] = useState(false); const [addVisible, setAddVisible] = useState(false);
const [checkValue, setCheckValue] = useState([]); const [checkValue, setCheckValue] = useState([]);
const [gisType, setGisType] = useState('');
const columns = [ const columns = [
{ {
...@@ -65,7 +66,10 @@ const VectorData = props => { ...@@ -65,7 +66,10 @@ const VectorData = props => {
render: record => ( render: record => (
<Space size="middle"> <Space size="middle">
<UserAddOutlined <UserAddOutlined
onClick={() => pickRole(record)} onClick={() => {
pickRole(record);
setGisType('web');
}}
style={{ fontSize: '18px', color: '#1890FF' }} style={{ fontSize: '18px', color: '#1890FF' }}
/> />
</Space> </Space>
...@@ -124,7 +128,10 @@ const VectorData = props => { ...@@ -124,7 +128,10 @@ const VectorData = props => {
render: record => ( render: record => (
<Space size="middle"> <Space size="middle">
<UserAddOutlined <UserAddOutlined
onClick={() => pickRole(record)} onClick={() => {
pickRole(record);
setGisType('phone');
}}
style={{ fontSize: '18px', color: '#1890FF' }} style={{ fontSize: '18px', color: '#1890FF' }}
/> />
</Space> </Space>
...@@ -779,6 +786,8 @@ const VectorData = props => { ...@@ -779,6 +786,8 @@ const VectorData = props => {
groupName="站点" // 打开组件展示的分组名,用来首次获取数据 groupName="站点" // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={['站点']} // 可选分组名 chooseGroupName={['站点']} // 可选分组名
dataType="id" dataType="id"
mapSite={true}
gisType={gisType}
// isRadio={true} // 站点单选 // isRadio={true} // 站点单选
/> />
{/* <RoleModal {/* <RoleModal
......
...@@ -349,3 +349,6 @@ export const SortSchemePost = param => post(`${PANDA_GIS}/MapLayer/SortSchemePos ...@@ -349,3 +349,6 @@ export const SortSchemePost = param => post(`${PANDA_GIS}/MapLayer/SortSchemePos
export const GetUserName = param => get(`${PUBLISH_SERVICE}/UserCenter/GetUserName`, param); export const GetUserName = param => get(`${PUBLISH_SERVICE}/UserCenter/GetUserName`, param);
export const ProductRepair = param => get(`${PUBLISH_SERVICE}/DBManager/ProductRepair`, param); export const ProductRepair = param => get(`${PUBLISH_SERVICE}/DBManager/ProductRepair`, param);
export const GetMapLayerStationList = param =>
get(`${PANDA_GIS}/MapLayer/GetMapLayerStationList`, param);
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