Commit 9c974aab authored by 皮倩雯's avatar 皮倩雯

fix: '修改用户管理添加用户管理图标'

parent c0cf7174
Pipeline #49101 skipped with stages
......@@ -42,6 +42,7 @@ import styles from './WebDic.less';
import { GetMetaData } from '@/services/gis/gis';
import DragTable from '@/components/DragTable/DragTable';
import ImportModal from './importModal';
const WebDic = () => {
const [loading, setLoading] = useState(false);
......@@ -69,12 +70,15 @@ const WebDic = () => {
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [InPutVisible, setInPutVisible] = useState(false);
const [importVisible, setImportVisible] = useState(false);
const [name, setName] = useState('');
const [keepName, setKeepName] = useState('');
const columns = [
{
title: () => <span className={styles.font}>序号</span>,
key: 'nodeID ',
dataIndex: 'nodeID',
key: 'id ',
dataIndex: 'id',
render: (text, record, index) => (
<Space>
<span>{index + 1}</span>
......@@ -87,7 +91,12 @@ const WebDic = () => {
title: () => <span className={styles.font}>名称</span>,
dataIndex: 'nodeName',
key: 'nodeName',
render: item => searchStyle(item),
// render: item => searchStyle(item),
render: record => (
<Tooltip placement="topLeft" title={record}>
{searchStyle(record)}
</Tooltip>
),
},
{
title: () => <span className={styles.font}>操作</span>,
......@@ -101,7 +110,7 @@ const WebDic = () => {
onClick={() => {
setSelect(record);
if (record.parentID === '-1') {
setSelectColor(record);
setSelectColor(record.nodeID);
}
setEditVisible1(true);
editForm.setFieldsValue({
......@@ -118,7 +127,7 @@ const WebDic = () => {
title="是否确认删除该数据,删除一级目录数据会将其二级目录子数据一起删除?"
okText="确认"
cancelText="取消"
onConfirm={submitDelete}
onConfirm={submitDeleteOne}
>
<DeleteOutlined
onClick={() => {
......@@ -144,10 +153,11 @@ const WebDic = () => {
const columns1 = [
{
title: () => <span className={styles.font}>序号</span>,
dataIndex: 'nodeID',
key: 'nodeID',
dataIndex: 'ID',
key: 'ID',
width: 60,
align: 'center',
className: 'column',
render: (text, record, index) => (
<Space>
<span>{index + 1}</span>
......@@ -158,11 +168,13 @@ const WebDic = () => {
title: () => <span className={styles.font}>名称</span>,
dataIndex: 'nodeName',
key: 'nodeName',
className: 'column',
},
{
title: () => <span className={styles.font}></span>,
dataIndex: 'nodeValue',
key: 'nodeValue',
className: 'column',
render: record => {
if (!record) {
return '-';
......@@ -174,6 +186,7 @@ const WebDic = () => {
title: () => <span className={styles.font}>操作</span>,
key: 'action',
width: 100,
className: 'column',
align: 'center',
render: record => (
<Space>
......@@ -182,7 +195,7 @@ const WebDic = () => {
onClick={() => {
setSelect(record);
if (record.parentID === '-1') {
setSelectColor(record);
setSelectColor(record.nodeID);
}
setEditVisible(true);
editForm.setFieldsValue({
......@@ -205,7 +218,7 @@ const WebDic = () => {
onClick={() => {
setSelect(record);
if (record.parentID === '-1') {
setSelectColor(record);
setSelectColor(record.nodeID);
}
}}
style={{
......@@ -233,8 +246,9 @@ const WebDic = () => {
return <div dangerouslySetInnerHTML={{ __html: n }} />;
};
const setRowClassName = record =>
record.nodeID === selectColor.nodeID ? styles.clickRowStyle : '';
const setRowClassName = nodeID => {
return nodeID == selectColor ? styles.clickRowStyle : '';
};
const setRowClassName1 = record =>
record.nodeID === twoSelectColor.nodeID ? styles.clickRowStyle : '';
......@@ -295,6 +309,12 @@ const WebDic = () => {
setIsloading(false);
});
}, [subData]);
// useEffect(() => {
// console.log(selectColor);
// console.log(data);
// console.log(data.find(i => i.nodeID == selectColor));
// }, [selectColor]);
// 根据父节点nodeID(即parentID)获取子节点数据,一级条目parentID = -1
const getData = value => {
isLoadingShow(value, true);
......@@ -308,15 +328,19 @@ const WebDic = () => {
return item;
});
}
// 是否首次加载
if (value === null || value === '-1') {
console.log(123);
setData(res);
// 是否首次加载
if (first) {
setSelect(res[0]); // 默认当前选中一级条目第一条
setSelectColor(res[0]);
setSelectColor(res[0].nodeID);
setSelectID(res[0].nodeID); // 设置选中的一级条目ID,用于添加二级条目
setFirst(false);
setName(res[0].nodeName);
getData(res[0].nodeID); // 拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
} else {
console.log(selectColor);
}
} else if (value) {
setSubData(res); // 设置二级条目,res为空[]时也要设置
......@@ -356,6 +380,7 @@ const WebDic = () => {
// };
// 搜索
const sumbitSearch = () => {
console.log(121212);
SearchDataDictionaryList({ key: searchWord }).then(res => {
if (res.code === 0) {
setSearchData(res.data);
......@@ -406,10 +431,11 @@ const WebDic = () => {
const setItem = value => {
setLevel(value);
if (value === 1) {
setSearchWord('');
setAddVisible1(true);
}
if (value === 2) {
if (selectID.length === 0) {
if (name == '') {
notification.warning({
description: '请先选择一级条目',
});
......@@ -422,6 +448,7 @@ const WebDic = () => {
// 添加二级条目
const submitAdd = value => {
console.log(value);
const nodeName1 = addForm.getFieldsValue();
const nodeName = addForm.getFieldsValue().nodeName1;
const nodeValue = addForm.getFieldsValue().nodeValue1;
......@@ -465,17 +492,18 @@ const WebDic = () => {
}).then(res => {
console.log(res.msg);
if (res.code === 0) {
console.log(res.data);
setSelectColor(res.data);
setSelectID(res.data);
setRowClassName(res.data);
setAddVisible1(false);
setSubData([]);
getData(null);
setSubData(res.msg); // res.message为添加成功返回的一级条目ID
// // 设置添加二级条目的父级ID及父级ID选中状态
setSelect({ nodeID: res.msg, parentID: '-1' });
setSelectID(res.msg);
setSelectColor({ nodeID: res.msg });
setFlag1(0);
notification.success({
message: '提交成功',
});
setName(nodeName);
} else {
notification.error({
message: '提交失败',
......@@ -504,7 +532,8 @@ const WebDic = () => {
message: '提交成功',
});
if (flag1 === 1) {
sumbitSearch();
// sumbitSearch();
getData(null);
}
} else {
notification.error({
......@@ -529,6 +558,7 @@ const WebDic = () => {
nodeValue: '-',
}).then(res => {
if (res.code === 0) {
setName(nodeName);
setEditVisible1(false);
if (flag1 === 0) {
getData(select.parentID === '-1' ? null : select.parentID);
......@@ -538,9 +568,10 @@ const WebDic = () => {
notification.success({
message: '提交成功',
});
if (flag1 === 1) {
sumbitSearch();
}
// if (flag1 === 1) {
// // sumbitSearch();
// getData(null);
// }
} else {
notification.error({
message: '提交失败',
......@@ -588,6 +619,60 @@ const WebDic = () => {
message.error(err);
});
};
// 删除
const submitDeleteOne = () => {
DeleteDataDictionary({
nodeID: select.nodeID,
})
.then(res => {
if (res.code === 0) {
if (select.nodeID == selectColor) {
if (flag1 === 0) {
// getData(null);
GetDataDictionaryList({ nodeID: null }).then(resnew => {
if (resnew.code === 0) {
let res = resnew.data;
setData(res);
setSelect(res[0]); // 默认当前选中一级条目第一条
setSelectColor(res[0].nodeID);
setSelectID(res[0].nodeID); // 设置选中的一级条目ID,用于添加二级条目
getData(res[0].nodeID); // 拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
// setSubData(res); // 设置二级条目,res为空[]时也要设置
// isLoadingShow(value, false);
setName(res[0].nodeName);
console.log(res[0].nodeName);
} else {
isLoadingShow(value, false);
notification.error({
message: '获取失败',
description: resnew.msg,
});
}
});
} else {
submitSearchUser(1);
}
} else {
if (flag1 === 0) {
getData(null);
} else {
submitSearchUser();
}
}
notification.success({
message: '删除成功',
});
} else {
notification.error({
message: '删除失败',
description: res.message,
});
}
})
.catch(err => {
message.error(err);
});
};
const pagenation = {
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
......@@ -636,19 +721,60 @@ const WebDic = () => {
setInPutVisible(false);
};
const submitInput = () => {
setInPutVisible(true);
console.log(111);
setImportVisible(true);
// setInPutVisible(true);
};
const submitSearchUser = aa => {
setFlag1(1);
console.log(searchWord);
SearchDataDictionaryList({ key: searchWord, type: 1 }).then(res => {
if (res.code === 0) {
setShowSearchStyle(true);
if (res.data.length === 0) {
setData(res.data);
setSubData([]);
setName('');
} else {
setData(res.data);
// 搜索
if (aa == 1) {
setSelect(res.data[0]);
setName(res.data[0].nodeName);
setSelectColor(res.data[0].nodeID);
setSelectID(res.data[0].nodeID);
getData(res.data[0].nodeID);
} else {
getData(selectColor);
}
}
} else {
notification.error({
message: '提交失败',
description: res.msg,
});
}
});
};
const submitSearchUser = () => {
const submitSearchUserAll = aa => {
setFlag1(1);
console.log(searchWord);
SearchDataDictionaryList({ key: searchWord, type: 1 }).then(res => {
if (res.code === 0) {
setShowSearchStyle(true);
if (res.data.length === 0) {
setData(res.data);
setSubData([]);
setName('');
} else {
setData(res.data);
// 搜索
setName(res.data[0].nodeName);
setSelect(res.data[0]);
setSelectColor(res.data[0].nodeID);
setSelectID(res.data[0].nodeID);
getData(res.data[0].nodeID);
}
} else {
......@@ -678,7 +804,8 @@ const WebDic = () => {
}
setData(res);
setSelect(res[0]); // 默认当前选中一级条目第一条
setSelectColor(res[0]);
setSelectColor(res[0].nodeID);
setName(res[0].nodeName);
setSelectID(res[0].nodeID); // 设置选中的一级条目ID,用于添加二级条目
getData(res[0].nodeID); // 拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
setShowSearchStyle(false);
......@@ -700,6 +827,18 @@ const WebDic = () => {
}
};
const onImportSubmit = () => {
setImportVisible(false);
setFlag(flag + 1);
};
const title = (
<>
<span>添加二级条目</span>
<span style={{ color: 'rgb(24, 144, 255)' }}>{name}</span>
</>
);
return (
<div className={styles.WebDic}>
<Spin spinning={loading} tip="loading...">
......@@ -711,7 +850,7 @@ const WebDic = () => {
<Search
style={{ width: 260, marginRight: '20px', marginLeft: '10px' }}
placeholder="搜索一级条目数据"
onSearch={submitSearchUser}
onSearch={submitSearchUserAll}
onChange={e => handleSearch(e)}
enterButton
value={searchWord}
......@@ -782,12 +921,13 @@ const WebDic = () => {
</Tooltip>
</div>
)}
rowClassName={setRowClassName}
rowClassName={record => setRowClassName(record.nodeID)}
onClick={record => {
getData(record.nodeID);
setSelect(record);
setSelectColor(record);
setSelectColor(record.nodeID);
setSelectID(record.nodeID);
setName(record.nodeName);
}}
ItemTypes="first"
pagination={false}
......@@ -814,6 +954,9 @@ const WebDic = () => {
title={() => (
<div>
<span>二级条目</span>
<span style={{ color: 'rgb(24, 144, 255)' }}>
<strong>{name}</strong>
</span>
<Tooltip title="添加二级条目配置">
<PlusSquareFilled
onClick={() => setItem(2)}
......@@ -855,7 +998,7 @@ const WebDic = () => {
</Modal>
{/* 添加二级 */}
<Modal
title="添加二级条目"
title={title}
visible={addVisible}
width="500px"
onOk={() => {
......@@ -1069,7 +1212,7 @@ const WebDic = () => {
pagination={pagenation}
/>
</Modal> */}
<Modal
{/* <Modal
title="导入数据"
visible={InPutVisible}
onOk={input1}
......@@ -1090,7 +1233,12 @@ const WebDic = () => {
<a style={{ color: 'rgb(24 144 255)' }}>请选择将要导入的数据文件(仅支持Excel文件)</a>
</span>
</Upload>
</Modal>
</Modal> */}
<ImportModal
visible={importVisible}
onCancel={() => setImportVisible(false)}
callBackSubmit={onImportSubmit}
/>
</div>
);
};
......
......@@ -2,6 +2,9 @@
.item {
margin-bottom: 20px;
}
th.column {
background-color: #9ec3e2;
}
.ant-table-content {
max-height: calc(100vh - 260px);
border-right: white;
......@@ -40,9 +43,16 @@
}
.tab {
padding-right: 5px;
.th.column {
background-color: #f4fcff;
}
.ant-table-body {
margin-right: -7px;
background-color: #f4fcff;
}
// .ant-table.ant-table-bordered > .ant-table-title {
// background-color: #f4fcff;
// }
}
// .pad{
// overflow-x: hidden;
......
/* eslint-disable react-hooks/rules-of-hooks */
/*
* @Description:
* @Author: leizhe
* @Date: 2022-04-11 18:12:39
* @LastEditTime: 2022-04-24 15:52:05
* @LastEditors: leizhe
*/
import React, { useEffect, useState } from 'react';
import { Modal, Form, Input, notification, message, Button, Col, Row, Upload } from 'antd';
import { ImportDataDictionary } from '@/services/dataCenter/api';
const importModal = props => {
const { visible, onCancel, callBackSubmit = () => {} } = props;
const [addForm] = Form.useForm();
const [file, setFile] = useState('');
useEffect(() => {
addForm.resetFields();
}, [visible]);
const aa = {
beforeUpload: file => {
console.log(file);
addForm.setFieldsValue({
ModelFile: file.name,
});
setFile(file);
console.log(file);
return false;
},
};
const importData = () => {
addForm.validateFields().then(validate => {
if (validate) {
const formData = new FormData();
formData.append('file', file);
ImportDataDictionary(formData).then(res => {
if (res.code === 0) {
callBackSubmit();
addForm.resetFields();
notification.success({
message: '提示',
duration: 3,
description: '导入成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
}
});
};
return (
<Modal
title="导入数据"
visible={visible}
onCancel={onCancel}
destroyOnClose
onOk={importData}
afterClose={() => {
addForm.resetFields();
}}
maskClosable={false}
okText="确认"
cancelText="取消"
>
<Form form={addForm} labelCol={{ span: 5 }}>
<Row>
<Col span={17}>
<Form.Item
label="模型文件"
name="ModelFile"
labelCol={{ span: 7 }}
rules={[
{
required: true,
message: '请选择文件',
},
]}
>
<Input placeholder="仅支持.xls, .xlsx格式" />
</Form.Item>
</Col>
<Col span={7}>
<Form.Item>
<Upload {...aa} accept=".xls, .xlsx">
<Button style={{ width: '130px' }}>上传文件</Button>
</Upload>
</Form.Item>
</Col>
</Row>
</Form>
</Modal>
);
};
export default importModal;
/* eslint-disable no-debugger */
/* eslint-disable array-callback-return */
/* eslint-disable no-plusplus */
/* eslint-disable consistent-return */
......@@ -489,6 +490,7 @@ const MiniMenu = props => {
};
// 树的拖动
const handleDrop = infos => {
debugger;
const dropKey = infos.node.key;
const dragKey = infos.dragNode.key;
const dropPos = infos.node.pos.split('-');
......
......@@ -81,6 +81,13 @@
border: 1px solid #eee;
padding: 10px;
}
.ant-tree.ant-tree-block-node .ant-tree-list-holder-inner .ant-tree-node-content-wrapper {
line-height: 28px !important;
}
.ant-tree-drop-indicator {
bottom: 3px !important;
margin-left: 6px;
}
// .modal{
// .ant-modal-body{
// padding: 0 !important;
......
/* eslint-disable import/no-unresolved */
import React, { useEffect } from 'react';
import { Modal, Form, Input, notification, message } from 'antd';
import { addOrg } from '@/services/userManage/api';
const AddUserModal = props => {
const { visible, orgID, onCancel, updateTrees, onSelect, orgTitle1 } = props;
const { visible, orgID, onCancel, updateTrees1, onSelect, orgTitle1 } = props;
const [addOrgForm] = Form.useForm(); // 添加用户
useEffect(() => {
......@@ -13,6 +14,7 @@ const AddUserModal = props => {
// 提交-添加下级机构
const submitAddOrg = () => {
// 顶级机构
if (orgID == -1) {
addOrg(
orgID,
......@@ -28,8 +30,9 @@ const AddUserModal = props => {
duration: 2,
});
// 重新获取机构树与用户表
updateTrees();
onSelect([`${res.OUID}`]);
console.log(res.data);
updateTrees1(res.data);
onSelect([`${res.data}`]);
} else {
notification.error({
message: '提交失败',
......@@ -55,8 +58,9 @@ const AddUserModal = props => {
duration: 2,
});
// 重新获取机构树与用户表
updateTrees();
onSelect([`${res.OUID}`]);
console.log(res.data);
updateTrees1(res.data);
onSelect([`${res.data}`]);
} else {
notification.error({
message: '提交失败',
......
......@@ -4,7 +4,7 @@ import { addUser } from '@/services/userManage/api';
import { ok } from '../../../assets/images/icons/ok.svg';
const AddUserModal = props => {
const { visible, orgID, onCancel, onSelect, orgTitle1 } = props;
const { visible, orgID, onCancel, updateTrees1, orgTitle1, onSelect } = props;
const [addUserForm] = Form.useForm(); // 添加用户
/** ***正则验证**** */
const noChinese = new RegExp(/^[^\u4e00-\u9fa5]+$/); // 不能包含中文
......@@ -79,8 +79,10 @@ const AddUserModal = props => {
message: '提交成功',
duration: 2,
});
updateTrees1(orgID.id);
onSelect([`${orgID.id}`]);
// 重新获取用户表
onSelect();
} else {
notification.error({
message: '提交失败',
......
/* eslint-disable import/no-unresolved */
import React, { useEffect } from 'react';
import { Modal, Form, Input, notification, message } from 'antd';
import { updateUserPassword } from '@/services/userManage/api';
......@@ -7,11 +8,15 @@ const ChangePasswordModal = props => {
const [passwordForm] = Form.useForm(); // 修改密码
useEffect(() => {
console.log(currentUser);
if (visible) {
console.log(currentUser.password);
passwordForm.setFieldsValue({
oldPassword: currentUser.password,
newPassword: '',
passwordConfirm: '',
});
}
}, [visible]);
// 提交-修改密码
......
......@@ -2,7 +2,7 @@
* @Description:
* @Author: leizhe
* @Date: 2022-01-13 17:26:14
* @LastEditTime: 2022-03-10 14:31:30
* @LastEditTime: 2022-04-27 11:24:57
* @LastEditors: leizhe
*/
import React from 'react';
......
/* eslint-disable import/no-unresolved */
/*
* @Description:
* @Author: leizhe
* @Date: 2022-01-13 17:26:14
* @LastEditTime: 2022-03-22 16:17:58
* @LastEditTime: 2022-04-27 18:56:09
* @LastEditors: leizhe
*/
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import { Modal, Form, Input, notification, message } from 'antd';
import { editOrgInfo } from '@/services/userManage/api';
const EditOrgModal = props => {
const { visible, orgID, description, onCancel, updateTrees, onSelect, orgTitle1 } = props;
const [editOrgForm] = Form.useForm(); // 添加用户
const { Item } = Form;
useEffect(() => {
console.log(orgTitle1);
editOrgForm.setFieldsValue({
OUName: orgTitle1,
description,
});
console.log(orgID);
if (visible && orgID) {
console.log(orgID.text);
editOrgForm.setFieldsValue({ OUName: orgID.text });
console.log(editOrgForm.getFieldValue('OUName'));
}
}, [visible]);
// 提交-编辑当前机构
......@@ -38,7 +41,7 @@ const EditOrgModal = props => {
});
// 重新获取机构树与用户表
updateTrees();
onSelect([orgID]);
// onSelect([orgID]);
// setExpandedKeys([`${orgID}`]);
} else {
notification.error({
......@@ -70,12 +73,12 @@ const EditOrgModal = props => {
cancelText="取消"
>
<Form form={editOrgForm} labelCol={{ span: 4 }}>
<Form.Item name="OUName" label="机构名称" rules={[{ required: true, message: '不能为空' }]}>
<Item name="OUName" label="机构名称" rules={[{ required: true, message: '不能为空' }]}>
<Input placeholder="请输入机构名称" maxLength="20" />
</Form.Item>
<Form.Item name="description" label="描述">
</Item>
<Item name="description" label="描述">
<Input placeholder="请输入相关描述" maxLength="100" />
</Form.Item>
</Item>
</Form>
</Modal>
);
......
/* eslint-disable import/no-unresolved */
import React, { useEffect } from 'react';
import { Modal, Form, Input, notification, message } from 'antd';
import voca from 'voca';
......
......@@ -159,6 +159,11 @@ const UserManage = () => {
const { Search } = Input;
const [hoverItemIndex, setHoverItemIndex] = useState(0); // hover流程索引
const [keepTree, setKeepTree] = useState([]); // 保存所有一级id用于控制只展开一项一级菜单
const [expendKey, setExpendKey] = useState(''); // 保存默认展开项
const [menuID, setMenuID] = useState(''); // 选中的树IDs
const [keepId, setKeepId] = useState('');
const [flag, setFlag] = useState(1); // 刷新标志
const setRowClassName = record =>
record.userID === selectColor.userID ? styles.clickRowStyle : '';
// 用户表列名
......@@ -357,6 +362,11 @@ const UserManage = () => {
),
},
];
useEffect(() => {
setExpendKey(menuID);
console.log(expendKey);
}, [menuID]);
// 模糊查询匹配的样式
const searchStyle = val => {
let n;
......@@ -419,17 +429,18 @@ const UserManage = () => {
}}
>
<Tooltip title="" className={styles.fs1}>
<Dropdown overlay={orgButtonMenu}>
<PlusOutlined
<UserAddOutlined
style={{ marginLeft: 20, lineHeight: '24px' }}
onClick={e => e.stopPropagation()}
onClick={e => {
e.stopPropagation();
addUser();
}}
onMouseEnter={e => {
setOrgID(org);
setOrgTitle1(org.text);
console.log(org);
}}
/>
</Dropdown>
</Tooltip>
<Dropdown overlay={orgButtonMenu1}>
<EllipsisOutlined
......@@ -495,6 +506,7 @@ const UserManage = () => {
.then(newres => {
if (newres.code === 0) {
let res = newres.data;
console.log(res);
setTreeLoading(false);
setTreeData(res);
setTreeDataCopy(res);
......@@ -503,6 +515,7 @@ const UserManage = () => {
aa.push(i.id);
});
setKeepTree(aa);
// 第一次加载,默认选择第一个组织
if (treeState) {
onSelect([res[0].id]);
......@@ -523,6 +536,40 @@ const UserManage = () => {
});
};
const updateTrees1 = e => {
console.log(e);
setTreeLoading(true);
GetOUTreeNew({ selectOU: -1 })
.then(newres => {
if (newres.code === 0) {
let res = newres.data;
console.log(res);
setTreeLoading(false);
setTreeData(res);
setTreeDataCopy(res);
let aa = [];
res.forEach(i => {
aa.push(i.id);
});
setKeepTree(aa);
console.log(e);
setMenuID(e.toString());
setExpendKey(e);
} else {
setTreeLoading(false);
notification.error({
message: '获取失败',
// eslint-disable-next-line no-undef
description: res.message,
});
}
})
.catch(err => {
setTreeLoading(false);
message.error(err);
});
};
// 获取用户机构树
useEffect(() => {
updateTrees();
......@@ -540,6 +587,7 @@ const UserManage = () => {
// 点击树节点,获取当前机构下所有用户
const onSelect = (props, e) => {
console.log(props);
console.log(e);
if (e) {
props[0] = e.node.key;
} else {
......@@ -547,9 +595,6 @@ const UserManage = () => {
}
setKeep1(props);
setTableLoading(true);
// if (e) {
// setOrgTitle(e.node.title.props.children[0].props.children);
// }
if (!props[0]) {
setCurrentSelectOrg(currentSelectOrg);
setCurrentSelectOrg1(currentSelectOrg);
......@@ -557,13 +602,6 @@ const UserManage = () => {
setCurrentSelectOrg(props[0]);
setCurrentSelectOrg1(props[0]);
}
// orgAreas.map((item)=>{
// if(item.OUID == props[0]){
// setCurrentOrgArea(item.Extent)
// setCurrentOrgDistinct(item.AreaName)
// }
// })
GetMapSetByGroupID({
groupID: props[0],
}).then(res => {
......@@ -578,6 +616,8 @@ const UserManage = () => {
setOrgID(props[0] || currentSelectOrg);
// 树节点变化(即props不为空)时才请求,避免重复请求
if (props[0]) {
console.log(props[0]);
setMenuID(props[0]);
// eslint-disable-next-line no-console
getOneOUUserListNew(props[0] || currentSelectOrg)
.then(res => {
......@@ -619,6 +659,44 @@ const UserManage = () => {
}
};
// 添加用户刷新表数据
const onSelect1 = () => {
console.log(orgID);
setTableLoading(true);
// eslint-disable-next-line no-console
getOneOUUserListNew(orgID.id || currentSelectOrg)
.then(res => {
setCurrentOrgOperate(false); // 重置禁用当前机构操作为false
setMultiOperate(true); // 重新禁止用户批量操作
setSelectedRowKeys([]); // 重置选中用户数
if (res.code === 0) {
setTableLoading(false);
setSearchWord(''); // 搜索框置空
setOrgTitle(res.data.GroupName);
setDescription(res.data.Description);
// 返回用户表数据结构处理,扁平化
const temp = flatten(getUsers(res.data));
// 设置过滤字段
let arr = temp.map(item => item.OUName);
arr = arr.filter((value, index) => arr.indexOf(value) === index);
setOrgFilters(arr.map(item => ({ text: item, value: item })));
setTableLength(temp.length);
const table = temp.map((item, index) => {
item.key = index;
return item;
});
setShowSearchStyle(false);
setTableData(table);
} else {
setTableLoading(false);
}
})
.catch(err => {
setTableLoading(false);
message.error(err);
});
};
const getDescription = e => {
getOneOUUserListNew(e).then(res => {
if (res.code === 0) {
......@@ -675,8 +753,13 @@ const UserManage = () => {
// 删除机构
const deleteOrg = () => {
setDeleteOrgVisible(true);
// 删除后默认选择第一个组织
console.log(orgID);
console.log(keep1);
if (orgID.id == keep1) {
setTreeState(true);
} else {
setTreeState(false);
}
};
// 编辑机构范围
const EditOrgScope = () => {
......@@ -1273,6 +1356,10 @@ const UserManage = () => {
<Menu.Item key="1" onClick={addUser} icon={<UserAddOutlined style={{ marginTop: '5px' }} />}>
添加用户
</Menu.Item>
</Menu>
);
const orgButtonMenu1 = (
<Menu onClick={e => addChange(e)}>
<Menu.Item
key="2"
onClick={addSubOrg}
......@@ -1280,10 +1367,6 @@ const UserManage = () => {
>
添加下级机构
</Menu.Item>
</Menu>
);
const orgButtonMenu1 = (
<Menu onClick={e => addChange(e)}>
<Menu.Item key="3" onClick={editOrg} icon={<EditOutlined style={{ marginTop: '5px' }} />}>
编辑当前机构
</Menu.Item>
......@@ -1357,12 +1440,13 @@ const UserManage = () => {
showIcon="true"
blockNode
autoExpandParent
selectedKeys={[currentSelectOrg]}
onSelect={onSelect}
treeData={treeData.map(t => mapTree(t))}
draggable
onDrop={handleDrop}
selectedKeys={[menuID]}
keepTree={keepTree}
expandedKeys={expendKey}
/>
</div>
)}
......@@ -1464,7 +1548,8 @@ const UserManage = () => {
orgID={orgID}
orgTitle1={orgTitle1}
onCancel={kee}
onSelect={() => onSelect([orgID])}
updateTrees1={updateTrees1}
onSelect={onSelect}
/>
{/* 添加下级机构 */}
<AddSubOrgModal
......@@ -1472,8 +1557,8 @@ const UserManage = () => {
orgTitle1={orgTitle1}
orgID={orgID}
onCancel={() => setAddOrgVisible(false)}
// onSelect={onSelect}
updateTrees={updateTrees}
onSelect={onSelect}
updateTrees1={updateTrees1}
/>
{/* 编辑机构 */}
<EditOrgModal
......@@ -1482,7 +1567,6 @@ const UserManage = () => {
orgTitle1={orgTitle1}
description={description}
onCancel={() => setEditOrgVisible(false)}
// onSelect={onSelect}
updateTrees={updateTrees}
/>
{/* 删除机构 */}
......
/*
* @Description:
* @Author: leizhe
* @Date: 2022-01-13 17:10:28
* @LastEditTime: 2022-04-24 15:46:27
* @LastEditors: leizhe
*/
import { post, get, PUBLISH_SERVICE } from '../index';
export const GetDataDictionaryList = params =>
......@@ -25,3 +32,10 @@ export const ExportDataDictionary = params =>
// 拖拽组件
export const DataDictionaryChangeOrder = params =>
post(`${PUBLISH_SERVICE}/DataManger/DataDictionaryChangeOrder`, params);
export const ImportDataDictionary = query =>
post(`${PUBLISH_SERVICE}/DataManger/ImportDataDictionary`, query, {
headers: {
'Content-Type': 'multipart/form-data;charset=UTF-8',
},
});
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