Commit 03d16e7a authored by 张烨's avatar 张烨
parents 6b83c760 bacac5ec
......@@ -8,10 +8,12 @@ const ListCardItem = props => {
const {
getValueCallback,
itemid,
userList,
// userList,
Child,
OUName,
searchWord,
Child,
children,
text,
} = props;
const [indeterminate, setIndeterminate] = useState(false);
const [childValues, setChildValues] = useState({});
......@@ -23,20 +25,18 @@ const ListCardItem = props => {
useEffect(() => {
let arr = [];
userList.map((item, index) => {
children.map((item, index) => {
let obj = { ...item };
obj.label = (
<span
className={
searchWord && obj.userName.includes(searchWord)
? styles.isSearch
: ''
searchWord && obj.text.includes(searchWord) ? styles.isSearch : ''
}
>
{obj.userName || obj.roleName || obj.stationName}
{obj.text}
</span>
);
obj.value = obj.userID || obj.roleID || obj.stationID;
obj.value = obj.userID || obj.roleID || obj.stationID || obj.id;
arr.push(obj);
});
setDefaultList(arr);
......@@ -44,19 +44,19 @@ const ListCardItem = props => {
useEffect(() => {
let arr2 = [];
userList.map((item, index) => {
children.map((item, index) => {
if (item.isChecked) {
arr2.push(item.userID || item.roleID || item.stationID);
arr2.push(item.userID || item.roleID || item.stationID || item.id);
}
});
// eslint-disable-next-line no-unused-expressions
getValueCallback && getValueCallback(arr2, itemid);
const all = userList.every(u => u.isChecked);
setIndeterminate(!all && userList.some(u => u.isChecked));
const all = children.every(u => u.isChecked);
setIndeterminate(!all && children.some(u => u.isChecked));
setAllChecked(all);
setCheckList(arr2);
}, [userList]);
}, [children]);
const handleAllChecked = e => {
const { checked } = e.target;
......@@ -82,9 +82,6 @@ const ListCardItem = props => {
getValueCallback(e, itemid);
}
};
if (defaultList.length === 0) {
return null;
}
const handleChildValueCallback = (arr, childIndex) => {
childValues[childIndex] = arr;
......@@ -105,6 +102,9 @@ const ListCardItem = props => {
/>
));
if (defaultList.length === 0) {
return null;
}
return (
<>
<div className={`${styles.divBox}`}>
......@@ -116,7 +116,7 @@ const ListCardItem = props => {
handleAllChecked(e);
}}
>
{OUName}
{text}
</Checkbox>
</div>
<div style={{ width: '100%' }} className={styles.checkdiv}>
......
......@@ -24,10 +24,15 @@ const ListCard = props => {
title: '默认组',
id: '',
};
// /Cityinterface/rest/services/OMS.svc/P_GetUserByStation
//
// /Cityinterface/rest/services/OMS.svc/U_GetUserListForBatchOper
get('/Cityinterface/rest/services/OMS.svc/P_GetUserByStation', {
get('/Cityinterface/rest/services/OMS.svc/W4_GetMenuByRoleWithLevel', {
// OUID:ouid||'',
stationID: ouid || '',
// stationID: ouid || '',
roleID: ouid,
subSystemValue: 'city',
subSystemName: 'city',
_version: 9999,
_dc: new Date().getTime(),
})
......@@ -35,8 +40,8 @@ const ListCard = props => {
setLoading(false);
const list = [];
// eslint-disable-next-line no-unused-expressions
res &&
res.forEach(item => {
res.success &&
res.root.forEach(item => {
list.push({ ...defaultConfig, ...item });
});
setdataList(list);
......
This diff is collapsed.
.contentContainer{
// min-height: calc(100vh - 194px);
overflow-x: auto;
display: flex;
.menuContainer{
min-width: 300px;
border:1px solid #abaeb1;
min-height:calc(100vh - 300px);
// min-height:calc(100vh - 300px);
overflow-y:auto;
.ant-tree-list{
padding: 10px;
height:calc(100vh - 300px);
height:calc(100vh - 330px);
.ant-tree-switcher{
line-height: 1;
color:#1890FF;
......@@ -19,11 +20,23 @@
}
}
}
.previewContainer{
.editContainer{
margin-left: 12px;
flex: 1;
padding: 16px;
float: left;
// background: white;
min-width: 500px;
border:1px solid #abaeb1;
.ant-table-pagination-right{
padding-right: 12px;
}
}
.previewContainer{
margin-left: 12px;
// flex: 1;
float: left;
min-width: 400px;
border:1px solid #abaeb1;
.ant-table-pagination-right{
padding-right: 12px;
}
......@@ -53,16 +66,4 @@
.redText{
color: red;
cursor: pointer;
}
// .ant-modal-root{
// .ant-tree-switcher{
// line-height: 1;
// color:#1890FF;
// }
// }
// .menuContainer{
// width: 300px;
// padding: 10px;
// background: #1890FF;
// }
\ No newline at end of file
}
\ No newline at end of file
......@@ -206,9 +206,9 @@ const SevenParams = () => {
return (
<Form
form={sevenForm}
labelCol={{ span: 4, offset: 4 }}
labelCol={{ span: 2, offset: 2 }}
wrapperCol={{ span: 16, offset: 1 }}
style={{ width: '900px' }}
style={{ height: 'calc(100vh - 300px)' }}
onFinish={submitSevenParams}
initialValues={{ ellipseType: '1', transType: '1' }}
>
......@@ -324,14 +324,7 @@ const SevenParams = () => {
</Form.Item>
</>
)}
<Form.Item
wrapperCol={{
sm: {
span: 16,
offset: 16,
},
}}
>
<Form.Item wrapperCol={{ offset: 12 }}>
<Button type="primary" htmlType="submit">
提交
</Button>
......
......@@ -101,7 +101,7 @@ const SiteConfig = props => {
</Item>
<Item label="系统图标预览:">
<PicturesWall maxLen={3} />
<PicturesWall />
</Item>
<Item
label="登陆页面:"
......
This diff is collapsed.
.contentContainer{
// min-height: calc(100vh - 194px);
display: flex;
.menuContainer{
min-width: 300px;
border:1px solid #abaeb1;
min-height:calc(100vh - 300px);
overflow-y:auto;
.ant-tree-list{
padding: 10px;
height:calc(100vh - 300px);
.ant-tree-switcher{
line-height: 1;
color:#1890FF;
}
.ant-tree-iconEle{
line-height: 1.2;
color:#1890FF;
}
}
}
.previewContainer{
margin-left: 12px;
flex: 1;
float: left;
// background: white;
.ant-table-pagination-right{
padding-right: 12px;
}
}
.ant-tree-treenode{
width: 100% !important;
.ant-tree-node-content-wrapper{
display: inline-block;
width: 100%;
}
.iconWraper1{
float: right;
span{
display: none;
}
}
}
.ant-tree-treenode:hover{
.iconWraper1>span{
margin-left: 12px;
font-size: 18px;
display: inline-block;
}
}
}
.redText{
color: red;
cursor: pointer;
}
// .ant-modal-root{
// .ant-tree-switcher{
// line-height: 1;
// color:#1890FF;
// }
// }
// .menuContainer{
// width: 300px;
// padding: 10px;
// background: #1890FF;
// }
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import ProCard from '@ant-design/pro-card';
import AddForm from './AddForm';
import LeftPart from './LeftPart';
const MenuConfig = props => {
const [flag, setFlag] = useState(1);
return (
<ProCard split="vertical">
<ProCard colSpan="400px">
<div style={{ height: '60px', backgroundColor: 'red' }}> a</div>
<LeftPart />
</ProCard>
<ProCard>
<AddForm />
......
......@@ -58,7 +58,7 @@ const UserManage = () => {
const [loading, setLoading] = useState(true);
const [treeData, setTreeData] = useState([]); // 用户机构树
const [treeData1, setTreeData1] = useState([]);
const [treeData1, setTreeData1] = useState([]); // 用户机构树-备份,供更改机构使用
const [treeData2, setTreeData2] = useState([]);
const [tableData, setTableData] = useState([]); // 用户表
const [searchData, setSearchData] = useState([]);
......
......@@ -5,11 +5,13 @@ import { PageContainer, GridContent } from '@ant-design/pro-layout';
import {
getWebModuleTree,
chooseUserToStation,
getUserRelationList,
setMenuToRole,
} from '@/services/userCenter/roleManage/api';
import ListCard from '@/pages/orgnazation/ListCard';
import ListCard from '@/components/CheckGroup';
// import ListCard from '@/pages/orgnazation/ListCard';
import qs from 'qs';
import styles from '@/pages/userCenter/roleManage/RoleManage.less';
import { version } from 'less';
import AddModal from './AddModal';
import DelModal from './DelModal';
import EditModal from './EditModal';
......@@ -39,31 +41,43 @@ const SiteManage = () => {
setOuid(saveTreeId);
}
};
// useEffect(() => {
// setSpinLoading(true);
// getWebModuleTree({
// userMode: 'super',
// select: '',
// _version: 9999,
// _dc: Date.now(),
// node: -2,
// })
// .then(res => {
// setSpinLoading(false);
// let arr = [];
// if (res) {
// arr.push(res.find(item => item.id === 'Web4StationRoot'));
// console.log(arr, 'arr');
// }
// let arr2 = transTree(arr);
// setTreeData(arr2);
// })
// .catch(err => {
// setSpinLoading(false);
// console.error(err);
// });
// }, [flag]);
useEffect(() => {
setSpinLoading(true);
getWebModuleTree({
userMode: 'super',
select: '',
getUserRelationList({
userID: 82,
_version: 9999,
_dc: Date.now(),
node: -2,
})
.then(res => {
setSpinLoading(false);
let arr = [];
if (res) {
arr.push(res.find(item => item.id === 'Web4StationRoot'));
console.log(arr, 'arr');
}
let arr2 = transTree(arr);
setTreeData(arr2);
})
.catch(err => {
setSpinLoading(false);
console.error(err);
});
}, [flag]);
}).then(res => {
let arr = res.roleList;
let arr2 = transTree2(arr);
console.log(arr2, 'arr2');
setTreeData(arr2);
});
}, []);
const Title = props => {
const { text } = props;
console.log(props);
......@@ -111,25 +125,46 @@ const SiteManage = () => {
setEditVisible(true);
};
// 树形数据转换
const transTree = val => {
console.log(val);
// const transTree = val => {
// console.log(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 transTree2 = 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;
console.log(arr, 'arr');
let arr2 = arr.map((item, index) => {
item.title = item.visibleTitle;
item.key = item.visibleValue;
if (item.roleList && item.roleList.length > 0) {
item.roleList.map(child => {
child.title = child.roleName;
child.key = child.roleID;
});
}
item.children = item.roleList;
return item;
});
return arr2;
};
// 获取搜索框的值
const handleSearch = value => {
setSearchWord(value);
};
const handleChange = e => {
const { value } = e.target;
setSearchWord(value);
};
const confirmModal = e => {
setModalVisible(false);
setFlag(flag + 1);
......@@ -147,10 +182,10 @@ const SiteManage = () => {
};
const handleCommit = value => {
let arr = Object.values(subList);
chooseUserToStation(
setMenuToRole(
qs.stringify({
userList: String(arr.flat()),
stationID: ouid,
roleID: ouid,
menuNameList: String(arr.flat()),
}),
{
headers: {
......@@ -193,6 +228,7 @@ const SiteManage = () => {
showIcon
onSelect={e => handleTreeSelect(e)}
treeData={treeData}
blockNode
/>
</Spin>
<AddModal
......@@ -223,6 +259,7 @@ const SiteManage = () => {
allowClear
placeholder={placeholder}
onSearch={handleSearch}
onChange={handleChange}
enterButton
/>
</Col>
......
......@@ -76,7 +76,6 @@ export const addMenuGroupApi = (
subSystemValue: 'miniapp',
relatedRoleList: '',
});
// 获取角色列表
export const getRoleList = () =>
get(`/Cityinterface/rest/services/OMS.svc/P_GetRoleListPlain`, {
......@@ -84,14 +83,17 @@ export const getRoleList = () =>
_dc: new Date().getTime(),
subSystemValue: 'miniapp',
});
// 获取菜单
// 编辑-获取菜单
export const getMenuInfo = id =>
get(`/Cityinterface/rest/services/OMS.svc/Mini_GetMenuInfo`, {
_version: 9999,
_dc: new Date().getTime(),
menuID: id,
});
// 获取菜单
// 编辑-提交菜单
export const submitMenuInfo = params =>
get(`/Cityinterface/rest/services/OMS.svc/MiniApp_EditMenu`, params);
// 删除菜单
export const deleteMenuApi = id =>
get(`/Cityinterface/rest/services/OMS.svc/MiniApp_DeleteMenu`, {
_version: 9999,
......
......@@ -24,4 +24,12 @@ export const chooseUserToStation = (params, options) =>
// 获取所有角色信息
export const getUserRelationList = params =>
get('Cityinterface/rest/services/OMS.svc/W4_GetUserRelationList', params);
get('/Cityinterface/rest/services/OMS.svc/W4_GetUserRelationList', params);
// 角色管理保存选择
export const setMenuToRole = (params, options) =>
post(
'/Cityinterface/rest/services/OMS.svc/P_SetMenuToRole?_version: 9999',
params,
options,
);
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