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

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

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