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

fix: '角色管理选中系统分组下角色时不展示关联菜单权限'

parent e0ec9b25
Pipeline #45286 skipped with stages
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import SiteModal from '@/components/Modal/SiteModa'; import SiteModal from '@/components/Modal/SiteModa';
import { Input, Cascader, Button } from 'antd'; import { Input, Cascader, Button } from 'antd';
import { import { gcj_decrypt, exetent2AmapPoint, lngLat2WebMercator } from '@/utils/transformUtil';
gcj_decrypt,
exetent2AmapPoint,
lngLat2WebMercator,
} from '@/utils/transformUtil';
import { GetAllConfig, GetMetaData } from '@/services/gis/gis'; import { GetAllConfig, GetMetaData } from '@/services/gis/gis';
const { Search } = Input; const { Search } = Input;
import styles from './index.less'; import styles from './index.less';
...@@ -54,10 +50,7 @@ const MapScope = props => { ...@@ -54,10 +50,7 @@ const MapScope = props => {
const layers = res2.layers || []; const layers = res2.layers || [];
const workspace = res2.mapName.split('_')[0]; const workspace = res2.mapName.split('_')[0];
const subLayers = layers const subLayers = layers
.filter( .filter(layer => layer.subLayerIds && layer.subLayerIds.length === 0)
layer =>
layer.subLayerIds && layer.subLayerIds.length === 0,
)
.map(layer => layer.name); .map(layer => layer.name);
const paramLayers = `${workspace}:${subLayers.join(',')}`; const paramLayers = `${workspace}:${subLayers.join(',')}`;
const params = { const params = {
...@@ -68,9 +61,7 @@ const MapScope = props => { ...@@ -68,9 +61,7 @@ const MapScope = props => {
console.log('params', params); console.log('params', params);
const wmsOption = { const wmsOption = {
tileSize: 512, tileSize: 512,
url: `${ url: `${location.origin}/Cityinterface/rest/services/MapServer.svc/${
location.origin
}/Cityinterface/rest/services/MapServer.svc/${
pipenetCofig.servicename pipenetCofig.servicename
}/GeoServerProxy/wms`, }/GeoServerProxy/wms`,
blend: false, blend: false,
...@@ -200,17 +191,16 @@ const MapScope = props => { ...@@ -200,17 +191,16 @@ const MapScope = props => {
}); });
}; };
const filter = (inputValue, path) => { const filter = (inputValue, path) => {
return path.some( return path.some(option => option.name.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
option =>
option.name.toLowerCase().indexOf(inputValue.toLowerCase()) > -1,
);
}; };
return ( return (
<SiteModal <SiteModal
{...props} {...props}
title={ title={
<span> <span>
<span style={{ marginRight: '20px' }}>{title}的范围选择</span> <span style={{ marginRight: '20px' }}>
<span style={{ fontWeight: 'blod', color: 'red' }}>{title}</span>的范围选择
</span>
<span style={{ color: 'red' }}>提示:必须框选范围</span> <span style={{ color: 'red' }}>提示:必须框选范围</span>
</span> </span>
} }
...@@ -224,10 +214,7 @@ const MapScope = props => { ...@@ -224,10 +214,7 @@ const MapScope = props => {
okText="确认" okText="确认"
onOk={() => onSubmit()} onOk={() => onSubmit()}
> >
<div <div style={{ width: '750px', height: '500px' }} className={styles.indexContainer}>
style={{ width: '750px', height: '500px' }}
className={styles.indexContainer}
>
<div style={{ width: '750px', height: '500px', position: 'absolute' }}> <div style={{ width: '750px', height: '500px', position: 'absolute' }}>
<div id={mapId} style={{ width: '750px', height: '500px' }} /> <div id={mapId} style={{ width: '750px', height: '500px' }} />
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
padding: 10px 24px 0px 24px; padding: 10px 24px 0px 24px;
} }
.ant-modal-footer { .ant-modal-footer {
padding: 0px 48px 10px 40px; padding: 10px 48px 10px 40px;
} }
.ant-table-pagination.ant-pagination { .ant-table-pagination.ant-pagination {
margin: 5px 0; margin: 5px 0;
......
...@@ -60,6 +60,7 @@ const SiteManage = () => { ...@@ -60,6 +60,7 @@ const SiteManage = () => {
const [saveTreeId, setSaveTreeId] = useState(''); // 保存点击回调的roleid const [saveTreeId, setSaveTreeId] = useState(''); // 保存点击回调的roleid
const [modalVisible, setModalVisible] = useState(false); // 新增弹窗 const [modalVisible, setModalVisible] = useState(false); // 新增弹窗
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
const [flagSearch, setFlagSearch] = useState(0);
const [itemObj, setItemObj] = useState(''); // 选择的角色item const [itemObj, setItemObj] = useState(''); // 选择的角色item
const [delVisible, setDelVisible] = useState(false); // 删除弹窗 const [delVisible, setDelVisible] = useState(false); // 删除弹窗
const [editVisible, setEditVisible] = useState(false); // 修改弹窗 const [editVisible, setEditVisible] = useState(false); // 修改弹窗
...@@ -77,21 +78,35 @@ const SiteManage = () => { ...@@ -77,21 +78,35 @@ const SiteManage = () => {
const [mulu, setMulu] = useState(true); // 展示目录 const [mulu, setMulu] = useState(true); // 展示目录
const [siteList, setSiteList] = useState([]); const [siteList, setSiteList] = useState([]);
const [disFlag, setDisFlag] = useState(false); const [disFlag, setDisFlag] = useState(false);
const [chileID, setChildID] = useState([]);
const [descrip, setDescrip] = useState('当前未选中角色');
// const [childData, setChildData] = useState({visibleValue:''}) // const [childData, setChildData] = useState({visibleValue:''})
// 点击树的回调 // 点击树的回调
const handleTreeSelect = (e, treenode) => { const handleTreeSelect = (e, treenode) => {
console.log(e);
console.log(treenode);
if (treenode) { if (treenode) {
const { node } = treenode; const { node } = treenode;
const { roleID: id } = node; const { roleID: id } = node;
setItemObj(node); setItemObj(node);
let aa = chileID.find(i => i.roleID === id);
if (id) { if (id) {
setSaveTreeId(id); setSaveTreeId(id);
setRoleID(id);
setValueList([...valueList]); setValueList([...valueList]);
if (aa) {
setRoleID('');
setDescrip('系统分组下的角色不可配置菜单权限也不能被关联');
setFlagSearch(0);
} else {
setRoleID(id);
setFlagSearch(1);
}
} else { } else {
// setRoleID(saveTreeId); // setRoleID(saveTreeId);
setRoleID(''); setRoleID('');
setDescrip('当前未选中角色');
setFlagSearch(0);
} }
} }
...@@ -147,10 +162,27 @@ const SiteManage = () => { ...@@ -147,10 +162,27 @@ const SiteManage = () => {
} }
} }
}); });
console.log(res.data.roleList);
const { roleList } = res.data; const { roleList } = res.data;
let arr = transTree(roleList); let arr = transTree(roleList);
setTreeData(arr); setTreeData(arr);
console.log(arr);
let dataA = [];
arr.map(i => {
console.log(i.child);
dataA.push(i.child.find(j => j.visibleTitle === '系统分组'));
// if (i.child.find(j => j.visibleTitle === '系统分组')) {
// data.push(j);
// }
});
console.log(dataA);
let Arr = [];
dataA.map(i => {
i.children.map(j => {
Arr.push(j);
});
});
console.log(Arr);
setChildID(Arr);
} }
}); });
}; };
...@@ -795,6 +827,7 @@ const SiteManage = () => { ...@@ -795,6 +827,7 @@ const SiteManage = () => {
> >
<Row align="middle"> <Row align="middle">
<Col span={8}> <Col span={8}>
{flagSearch == 1 ? (
<Search <Search
allowClear allowClear
placeholder={placeholder} placeholder={placeholder}
...@@ -802,6 +835,9 @@ const SiteManage = () => { ...@@ -802,6 +835,9 @@ const SiteManage = () => {
onChange={handleChange} onChange={handleChange}
enterButton enterButton
/> />
) : (
<span />
)}
</Col> </Col>
<Col span={3} /> <Col span={3} />
</Row> </Row>
...@@ -823,7 +859,7 @@ const SiteManage = () => { ...@@ -823,7 +859,7 @@ const SiteManage = () => {
hasData={hasData} hasData={hasData}
/> />
) : ( ) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="当前未选中角色" /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={descrip} />
)} )}
</Card> </Card>
</div> </div>
......
import React, { useState, useCallback, useEffect } from 'react'; import React, { useState, useCallback, useEffect } from 'react';
import { Modal, Spin, Tabs, notification, message, Checkbox, Divider } from 'antd'; import { Modal, Spin, Tabs, notification, message, Checkbox, Divider } from 'antd';
import { import { SetUserRelationList, setUserRelation, setUserRelations } from '@/services/userManage/api';
SetUserRelationList,
setUserRelation,
setUserRelations,
} from '@/services/userManage/api';
import ListCardItem from './components/listCardItem'; import ListCardItem from './components/listCardItem';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
...@@ -45,6 +41,7 @@ const RelateRoleModal = props => { ...@@ -45,6 +41,7 @@ const RelateRoleModal = props => {
}, []); }, []);
useEffect(() => { useEffect(() => {
console.log(currentUser);
console.log(multiRoleList); console.log(multiRoleList);
console.log(multistationList); console.log(multistationList);
}, [visible]); }, [visible]);
...@@ -129,7 +126,9 @@ const RelateRoleModal = props => { ...@@ -129,7 +126,9 @@ const RelateRoleModal = props => {
); );
const title1 = ( const title1 = (
<span> <span>
<span>关联角色{currentUser.loginName}</span> <span>
关联角色<span style={{ fontWeight: 'bold', color: 'red' }}>{currentUser.userName}</span>
</span>
</span> </span>
); );
if (mult == 'Yes') { if (mult == 'Yes') {
......
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