Commit 84ddf94d authored by Maofei94's avatar Maofei94

fix: fix bug

parent 18801f9f
...@@ -18,6 +18,7 @@ export const checkChildrenByCondition = (item, fn, tag = 'every') => { ...@@ -18,6 +18,7 @@ export const checkChildrenByCondition = (item, fn, tag = 'every') => {
}; };
const ListCard = props => { const ListCard = props => {
console.log(props, 'props');
const { const {
ouid, ouid,
searchWord, searchWord,
...@@ -79,7 +80,7 @@ const ListCard = props => { ...@@ -79,7 +80,7 @@ const ListCard = props => {
/> />
)) ))
) : ( ) : (
<Empty /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)} )}
</> </>
)} )}
......
...@@ -25,7 +25,11 @@ ...@@ -25,7 +25,11 @@
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
.ant-checkbox-group-item{ .ant-checkbox-group-item{
flex:0 0 150px; flex:0 0 auto;
flex-shrink: 0;
flex-grow: 0;
margin-right: 60px;
// min-width: 180px;
margin-bottom: 5px; margin-bottom: 5px;
} }
} }
......
...@@ -16,6 +16,7 @@ import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons'; ...@@ -16,6 +16,7 @@ import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons';
import { import {
setMenuToRole, setMenuToRole,
getRoleGroupList, getRoleGroupList,
getMenuByRoleWithLevel,
} from '@/services/userCenter/roleManage/api'; } from '@/services/userCenter/roleManage/api';
import ListCard, { import ListCard, {
checkChildrenByCondition, checkChildrenByCondition,
...@@ -28,7 +29,6 @@ import AddModal from './AddModal'; ...@@ -28,7 +29,6 @@ import AddModal from './AddModal';
import DelModal from './DelModal'; import DelModal from './DelModal';
import EditModal from './EditModal'; import EditModal from './EditModal';
import EditGroup from './EditGroup'; import EditGroup from './EditGroup';
import { get } from '@/services';
import userStyles from '../UserManage.less'; import userStyles from '../UserManage.less';
const { Search } = Input; const { Search } = Input;
...@@ -79,7 +79,7 @@ const SiteManage = () => { ...@@ -79,7 +79,7 @@ const SiteManage = () => {
}; };
useEffect(() => { useEffect(() => {
setSpinLoading(true); setSpinLoading(true);
getRoleGroupList({ userID: 1 }).then(res => { getRoleGroupList({ userID: '1' }).then(res => {
setSpinLoading(false); setSpinLoading(false);
if (res.code === 0) { if (res.code === 0) {
const { roleList } = res.data; const { roleList } = res.data;
...@@ -114,8 +114,7 @@ const SiteManage = () => { ...@@ -114,8 +114,7 @@ const SiteManage = () => {
title: '默认组', title: '默认组',
id: '', id: '',
}; };
getMenuByRoleWithLevel({
get('/Cityinterface/rest/services/OMS.svc/W4_GetMenuByRoleWithLevel', {
roleID: itemObj.roleID, roleID: itemObj.roleID,
subSystemValue: itemObj.subSystemValue, subSystemValue: itemObj.subSystemValue,
subSystemName: itemObj.subSystemValue, subSystemName: itemObj.subSystemValue,
...@@ -168,16 +167,27 @@ const SiteManage = () => { ...@@ -168,16 +167,27 @@ const SiteManage = () => {
// 树形数据转换; // 树形数据转换;
const transTree = val => { const transTree = val => {
let arr = val; let arr = val;
let newArr = [];
let arr2 = arr.filter(item => { let arr2 = arr.filter(item => {
if (item.child && item.child.length > 0) { if (item.child && item.child.length > 0) {
item.child.forEach(itemC => { item.child.forEach(itemC => {
item.roleList.unshift(itemC); item.roleList.unshift(itemC);
}); });
} }
if (item.visibleTitle === '手持系统') {
newArr[0] = item;
}
if (item.visibleTitle === '小程序') {
newArr[1] = item;
}
return ( return (
item.visibleTitle !== '其它角色' && item.visibleTitle !== '运维管理' item.visibleTitle !== '其它角色' &&
item.visibleTitle !== '运维管理' &&
item.visibleTitle !== '手持系统' &&
item.visibleTitle !== '小程序'
); );
}); });
arr2 = arr2.concat(newArr);
console.log(arr2, 'arr2'); console.log(arr2, 'arr2');
let arr3 = arr2.map(item => { let arr3 = arr2.map(item => {
item.title = item.visibleTitle || ''; item.title = item.visibleTitle || '';
...@@ -291,9 +301,8 @@ const SiteManage = () => { ...@@ -291,9 +301,8 @@ const SiteManage = () => {
}; };
return ( return (
<PageContainer> <PageContainer>
{/* <GridContent> */}
<Row gutter={0}> <Row gutter={0}>
<Col lg={mulu ? 5 : 0}> <Col span={mulu ? 5 : 0}>
<Card className={styles.cardBox}> <Card className={styles.cardBox}>
<Spin <Spin
tip="loading...." tip="loading...."
...@@ -341,21 +350,28 @@ const SiteManage = () => { ...@@ -341,21 +350,28 @@ const SiteManage = () => {
confirmModal={groupModal} confirmModal={groupModal}
/> />
</Card> </Card>
</Col> <div>
<Col>
{mulu && ( {mulu && (
<Tooltip title="隐藏角色栏" className={styles.hide}> <Tooltip title="隐藏角色栏" className={styles.hide}>
<DoubleLeftOutlined onClick={() => handleHide()} /> <DoubleLeftOutlined onClick={() => handleHide()} />
</Tooltip> </Tooltip>
)} )}
</div>
</Col>
<Col span={mulu ? 0 : 1}>
{/* {mulu && (
<Tooltip title="隐藏角色栏" className={styles.hide}>
<DoubleLeftOutlined onClick={() => handleHide()} />
</Tooltip>
)} */}
{!mulu && ( {!mulu && (
<Tooltip title="显示角色栏" className={styles.hide}> <Tooltip title="显示角色栏" className={styles.hide}>
<DoubleRightOutlined onClick={() => handleHide()} /> <DoubleRightOutlined onClick={() => handleHide()} />
</Tooltip> </Tooltip>
)} )}
</Col> </Col>
<Col lg={mulu ? 18 : 23}> <Col span={mulu ? 19 : 23}>
<Card style={{ marginBottom: '10px' }}> <Card style={{ marginBottom: '10px', minWidth: '870px' }}>
<Row align="middle"> <Row align="middle">
<Col span={1}>搜索</Col> <Col span={1}>搜索</Col>
<Col span={8}> <Col span={8}>
...@@ -388,6 +404,7 @@ const SiteManage = () => { ...@@ -388,6 +404,7 @@ const SiteManage = () => {
编辑角色 编辑角色
</Button> </Button>
<Button <Button
type="primary"
danger danger
onClick={() => { onClick={() => {
handleDel(); handleDel();
...@@ -424,7 +441,6 @@ const SiteManage = () => { ...@@ -424,7 +441,6 @@ const SiteManage = () => {
</Card> </Card>
</Col> </Col>
</Row> </Row>
{/* </GridContent> */}
</PageContainer> </PageContainer>
); );
}; };
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
min-height: calc(100vh - 80px); min-height: calc(100vh - 80px);
max-height: calc(100vh - 80px); max-height: calc(100vh - 80px);
overflow-y: scroll; overflow-y: scroll;
margin-right: 20px;
} }
.ant-tree-node-content-wrapper-open{ .ant-tree-node-content-wrapper-open{
display: flex; display: flex;
...@@ -26,6 +27,7 @@ ...@@ -26,6 +27,7 @@
align-items: center; align-items: center;
} }
.cardBoxR{ .cardBoxR{
min-width: 870px;
min-height: calc(100vh - 172px); min-height: calc(100vh - 172px);
max-height: calc(100vh - 172px); max-height: calc(100vh - 172px);
overflow-y: scroll; overflow-y: scroll;
...@@ -43,10 +45,11 @@ ...@@ -43,10 +45,11 @@
.hide{ .hide{
display: block; display: block;
position: relative; position: absolute;
font-size: 20px; font-size: 20px;
color: #1890FF!important; color: #1890FF!important;
top: 45%; top: 45%;
left: 50%; right:0;
transform: translate(-50%,-50%); transform: translate(0%,-50%);
z-index: 2;
} }
...@@ -11,20 +11,17 @@ import { ...@@ -11,20 +11,17 @@ import {
List, List,
Space, Space,
} from 'antd'; } from 'antd';
import { import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons';
FileAddTwoTone,
EditTwoTone,
DeleteTwoTone,
DoubleLeftOutlined,
DoubleRightOutlined,
} from '@ant-design/icons';
import { GridContent } from '@ant-design/pro-layout';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import { import {
getWebModuleTree, getWebModuleTree,
chooseUserToStation, chooseUserToStation,
getUserByStation,
} from '@/services/userCenter/siteManage/api'; } from '@/services/userCenter/siteManage/api';
import ListCard from '@/pages/orgnazation/ListCard'; import ListCard, {
checkChildrenByCondition,
getId,
} from '@/components/CheckGroup';
import styles from '@/pages/userCenter/siteManage/SiteManage.less'; import styles from '@/pages/userCenter/siteManage/SiteManage.less';
import qs from 'qs'; import qs from 'qs';
import classnames from 'classnames'; import classnames from 'classnames';
...@@ -46,6 +43,9 @@ const SiteManage = () => { ...@@ -46,6 +43,9 @@ const SiteManage = () => {
const [subList, setSubList] = useState([]); // 选中的数组 const [subList, setSubList] = useState([]); // 选中的数组
const [spinLoading, setSpinLoading] = useState(false); const [spinLoading, setSpinLoading] = useState(false);
const [btnLoading, setBtnLoading] = useState(false); const [btnLoading, setBtnLoading] = useState(false);
const [valueList, setValueList] = useState([]);
const [dataList, setdataList] = useState([]);
const [loading, setLoading] = useState(true);
const [mulu, setMulu] = useState(true); const [mulu, setMulu] = useState(true);
useEffect(() => { useEffect(() => {
...@@ -81,38 +81,68 @@ const SiteManage = () => { ...@@ -81,38 +81,68 @@ const SiteManage = () => {
console.error(err); console.error(err);
}); });
}, [flag]); }, [flag]);
useEffect(() => {
const Title = props => { if (!currentStation.stationID) return;
const { text } = props; setLoading(true);
return ( const defaultConfig = {};
<div className={styles.treeTitle}> getUserByStation({
{text} stationID: currentStation.stationID,
<div className={styles.titleBox}> _version: 9999,
<Tooltip title="新增站点"> _dc: new Date().getTime(),
<FileAddTwoTone })
onClick={() => { .then(res => {
handleAdd(props); const list = [];
}} // eslint-disable-next-line no-unused-expressions
/> res &&
</Tooltip> res.forEach(item => {
<Tooltip title="编辑站点"> list.push({ ...defaultConfig, ...item });
<EditTwoTone });
onClick={() => { const finalList = buildMap(list);
handleEdit(props); setdataList(finalList);
}} setValueList(
/> finalList
</Tooltip> .map(l =>
<Tooltip title="删除站点"> checkChildrenByCondition(
<DeleteTwoTone l,
onClick={() => { it => (it.isChecked ? [getId(it)] : []),
handleDel(props); 'map',
}} ).flat(Infinity),
/> )
</Tooltip> .flat(Infinity)
</div> .filter(Boolean),
</div>
); );
setLoading(false);
})
.catch(err => {
setLoading(false);
});
}, [currentStation]);
const buildMap = list => {
const obj = {
type: 'widgetGroup',
searchWord,
children: '',
text: '',
itemid: '',
}; };
let arr = list.map(item => {
item.id = item.OUID * 10000;
item.text = item.OUName;
item.type = 'widgetGroup';
item.children = item.userList.map(u => ({
...u,
text: u.userName,
type: 'widgetChild',
}));
return item;
});
console.log(arr);
return arr.filter(item => item.userList.length > 0);
};
// 新增站点
const handleAdd = e => { const handleAdd = e => {
console.log(e); console.log(e);
setModalVisible(true); setModalVisible(true);
...@@ -125,21 +155,6 @@ const SiteManage = () => { ...@@ -125,21 +155,6 @@ const SiteManage = () => {
const handleEdit = e => { const handleEdit = e => {
setEditVisible(true); setEditVisible(true);
}; };
// 树形数据转换
const transTree = val => {
let arr = val;
return arr.map((item, index) => {
item.title = Title(item) || item.text;
item.key = item.stationID || '';
let obj = {};
if (Array.isArray(item.children) && item.children.length > 0) {
transTree(item.children);
obj = item;
return obj;
}
return item;
});
};
// 获取搜索框的值 // 获取搜索框的值
const handleSearch = value => { const handleSearch = value => {
setSearchWord(value); setSearchWord(value);
...@@ -163,12 +178,12 @@ const SiteManage = () => { ...@@ -163,12 +178,12 @@ const SiteManage = () => {
const valueCallback = valueObj => { const valueCallback = valueObj => {
setSubList(valueObj); setSubList(valueObj);
}; };
const handleCommit = value => { const handleCommit = results => {
let arr = Object.values(subList);
setBtnLoading(true); setBtnLoading(true);
chooseUserToStation( chooseUserToStation(
qs.stringify({ qs.stringify({
userList: String(arr.flat()), // userList: String(arr.flat()),
userList: String(results.flat()),
stationID: currentStation.stationID, stationID: currentStation.stationID,
}), }),
{ {
...@@ -188,7 +203,7 @@ const SiteManage = () => { ...@@ -188,7 +203,7 @@ const SiteManage = () => {
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 15,
description: res.message, description: res.message,
}); });
} }
...@@ -219,10 +234,13 @@ const SiteManage = () => { ...@@ -219,10 +234,13 @@ const SiteManage = () => {
return ( return (
<PageContainer> <PageContainer>
<GridContent> <Row>
<Row gutter={0}> <Col span={mulu ? 5 : 0}>
<Col lg={mulu ? 5 : 0}> <Card
<Card className={styles.cardBox}> className={classnames({
[styles.cardBox]: true,
})}
>
<Spin <Spin
tip="loading...." tip="loading...."
spinning={spinLoading} spinning={spinLoading}
...@@ -251,13 +269,25 @@ const SiteManage = () => { ...@@ -251,13 +269,25 @@ const SiteManage = () => {
confirmModal={editModal} confirmModal={editModal}
/> />
</Card> </Card>
</Col> <div>
<Col>
{mulu && ( {mulu && (
<Tooltip title="隐藏站点" className={styles.hide}> <Tooltip title="隐藏站点" className={styles.hide}>
<DoubleLeftOutlined onClick={() => handleHide()} /> <DoubleLeftOutlined onClick={() => handleHide()} />
</Tooltip> </Tooltip>
)} )}
{/* {!mulu && (
<Tooltip title="显示站点" className={styles.hide}>
<DoubleRightOutlined onClick={() => handleHide()} />
</Tooltip>
)} */}
</div>
</Col>
<Col span={mulu ? 0 : 1}>
{/* {mulu && (
<Tooltip title="隐藏站点" className={styles.hide}>
<DoubleLeftOutlined onClick={() => handleHide()} />
</Tooltip>
)} */}
{!mulu && ( {!mulu && (
<Tooltip title="显示站点" className={styles.hide}> <Tooltip title="显示站点" className={styles.hide}>
<DoubleRightOutlined onClick={() => handleHide()} /> <DoubleRightOutlined onClick={() => handleHide()} />
...@@ -265,8 +295,8 @@ const SiteManage = () => { ...@@ -265,8 +295,8 @@ const SiteManage = () => {
)} )}
</Col> </Col>
<Col lg={mulu ? 18 : 23}> <Col span={mulu ? 19 : 23}>
<Card style={{ marginBottom: '10px' }}> <Card style={{ marginBottom: '10px', minWidth: '600px' }}>
<Row align="middle"> <Row align="middle">
<Col span={1}>搜索</Col> <Col span={1}>搜索</Col>
<Col span={8}> <Col span={8}>
...@@ -300,6 +330,7 @@ const SiteManage = () => { ...@@ -300,6 +330,7 @@ const SiteManage = () => {
</Button> </Button>
<Button <Button
danger danger
type="primary"
onClick={() => { onClick={() => {
handleDel(currentStation.stationID); handleDel(currentStation.stationID);
}} }}
...@@ -314,9 +345,10 @@ const SiteManage = () => { ...@@ -314,9 +345,10 @@ const SiteManage = () => {
<Card className={styles.cardBoxR}> <Card className={styles.cardBoxR}>
{currentStation.stationID && ( {currentStation.stationID && (
<ListCard <ListCard
ouid={currentStation.stationID} loading={loading}
checkList={valueList}
dataList={dataList}
searchWord={searchWord} searchWord={searchWord}
valueCallback={valueCallback}
onCommit={handleCommit} onCommit={handleCommit}
btnLoading={btnLoading} btnLoading={btnLoading}
/> />
...@@ -324,7 +356,6 @@ const SiteManage = () => { ...@@ -324,7 +356,6 @@ const SiteManage = () => {
</Card> </Card>
</Col> </Col>
</Row> </Row>
</GridContent>
</PageContainer> </PageContainer>
); );
}; };
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
min-height: calc(100vh - 80px); min-height: calc(100vh - 80px);
max-height: calc(100vh - 80px); max-height: calc(100vh - 80px);
overflow: auto; overflow: auto;
margin-right: 20px;
} }
.siteTitle{ .siteTitle{
font-size: 16px; font-size: 16px;
margin: 0 0 6px 0; margin: 0 0 6px 0;
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
.cardBoxR{ .cardBoxR{
min-height: calc(100vh - 172px); min-height: calc(100vh - 172px);
max-height: calc(100vh - 172px); max-height: calc(100vh - 172px);
min-width: 600px;
overflow-y: scroll; overflow-y: scroll;
} }
.ant-tree-node-content-wrapper-open{ .ant-tree-node-content-wrapper-open{
...@@ -53,10 +54,14 @@ ...@@ -53,10 +54,14 @@
.hide{ .hide{
display: block; display: block;
position: relative; position: absolute;
font-size: 20px; font-size: 20px;
color: #1890FF!important; color: #1890FF!important;
top: 45%; top: 45%;
left: 50%; right: 0;
transform: translate(-50%,-50%); transform: translate(0%,-50%);
z-index: 2;
} }
// .hide{
// left: 0;
// }
\ No newline at end of file
...@@ -53,3 +53,7 @@ export const deleteRole = params => ...@@ -53,3 +53,7 @@ export const deleteRole = params =>
// 编辑分组名称 // 编辑分组名称
export const setRoleGroupName = params => export const setRoleGroupName = params =>
get('/Cityinterface/rest/services/OMS.svc/P_SetRoleGroupName', params); get('/Cityinterface/rest/services/OMS.svc/P_SetRoleGroupName', params);
// 保存选择的功能
export const getMenuByRoleWithLevel = params =>
get('/Cityinterface/rest/services/OMS.svc/W4_GetMenuByRoleWithLevel', params);
...@@ -29,3 +29,7 @@ export const chooseUserToStation = (params, options) => ...@@ -29,3 +29,7 @@ export const chooseUserToStation = (params, options) =>
params, params,
options, options,
); );
// 获取人员
export const getUserByStation = params =>
get('/Cityinterface/rest/services/OMS.svc/P_GetUserByStation', 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