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

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

parent c0cf7174
Pipeline #49101 skipped with stages
This diff is collapsed.
......@@ -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(() => {
passwordForm.setFieldsValue({
oldPassword: currentUser.password,
newPassword: '',
passwordConfirm: '',
});
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
style={{ marginLeft: 20, lineHeight: '24px' }}
onClick={e => e.stopPropagation()}
onMouseEnter={e => {
setOrgID(org);
setOrgTitle1(org.text);
console.log(org);
}}
/>
</Dropdown>
<UserAddOutlined
style={{ marginLeft: 20, lineHeight: '24px' }}
onClick={e => {
e.stopPropagation();
addUser();
}}
onMouseEnter={e => {
setOrgID(org);
setOrgTitle1(org.text);
console.log(org);
}}
/>
</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);
// 删除后默认选择第一个组织
setTreeState(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