Commit 55d9ad2f authored by 皮倩雯's avatar 皮倩雯

修改用户管理界面UI

parent e610bdbf
Pipeline #30594 passed with stages
in 28 minutes 26 seconds
......@@ -8,4 +8,4 @@ PROXY=/Cityinterface:http://192.168.19.105:8049;/PandaCore:http://192.168.19.105
HOST = 0.0.0.0
# 本地应用启动的端口
PORT = 3001
\ No newline at end of file
PORT = 3001
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 14 14" style="enable-background:new 0 0 14 14;" xml:space="preserve">
<style type="text/css">
.st0{fill:#46546D;}
</style>
<g>
<g>
<path class="st0" d="M6.81,0c0.263,0,0.526,0.087,0.702,0.261s0.263,0.435,0.263,0.696v4.957h5.261C13.562,5.913,14,6.348,14,6.87
s-0.438,0.957-0.965,0.957H7.774v5.217C7.774,13.565,7.336,14,6.81,14s-0.965-0.435-0.965-0.957V7.826H0.934
c-0.351,0-0.614-0.174-0.789-0.435C-0.03,6.957-0.03,6.696,0.058,6.348c0.175-0.261,0.526-0.435,0.877-0.435h4.998V0.957
c0-0.261,0.088-0.522,0.263-0.696S6.547,0,6.81,0L6.81,0z"/>
</g>
</g>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 14 14" style="enable-background:new 0 0 14 14;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M13.16,6.16H7.84V0.84C7.84,0.376,7.464,0,7,0S6.16,0.376,6.16,0.84v5.32H0.84C0.376,6.16,0,6.536,0,7
s0.376,0.84,0.84,0.84h5.32v5.32C6.16,13.624,6.536,14,7,14s0.84-0.376,0.84-0.84V7.84h5.32C13.624,7.84,14,7.464,14,7
S13.624,6.16,13.16,6.16z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 14 14" style="enable-background:new 0 0 14 14;" xml:space="preserve">
<style type="text/css">
.st0{clip-path:url(#SVGID_2_);}
.st1{fill:#46546D;}
</style>
<g>
<defs>
<rect id="SVGID_1_" x="0" width="14" height="14"/>
</defs>
<clipPath id="SVGID_2_">
<use xlink:href="#SVGID_1_" style="overflow:visible;"/>
</clipPath>
<g class="st0">
<circle class="st1" cx="1.5" cy="7" r="1.5"/>
<circle class="st1" cx="7" cy="7" r="1.5"/>
<circle class="st1" cx="12.5" cy="7" r="1.5"/>
</g>
</g>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#70C23B;}
</style>
<g>
<path class="st0" d="M8,0C3.589,0,0,3.589,0,8c0,4.412,3.589,8,8,8c4.412,0,8-3.588,8-8C16,3.589,12.411,0,8,0z M14.809,8
c0,3.754-3.055,6.809-6.809,6.809c-3.754,0-6.809-3.055-6.809-6.809c0-3.754,3.054-6.809,6.809-6.809
C11.754,1.191,14.809,4.246,14.809,8z"/>
</g>
<path class="st0" d="M6.855,10.867c-0.176,0-0.345-0.07-0.469-0.194L4.27,8.556c-0.259-0.259-0.259-0.679,0-0.939
s0.679-0.259,0.939,0l1.647,1.647l3.936-3.937c0.259-0.259,0.679-0.259,0.939,0s0.259,0.679,0,0.939l-4.405,4.406
C7.2,10.797,7.031,10.867,6.855,10.867z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FF5C68;}
</style>
<g>
<path class="st0" d="M8,0C3.589,0,0,3.589,0,8c0,4.412,3.589,8,8,8c4.412,0,8-3.588,8-8C16,3.589,12.411,0,8,0z M14.809,8
c0,3.754-3.055,6.809-6.809,6.809c-3.754,0-6.809-3.055-6.809-6.809c0-3.754,3.054-6.809,6.809-6.809
C11.754,1.191,14.809,4.246,14.809,8z"/>
</g>
<g>
<path class="st0" d="M8,12.245c-0.212,0-0.402-0.08-0.57-0.239c-0.168-0.159-0.252-0.345-0.252-0.557
c0-0.124,0.141-1.044,0.424-2.759L7.045,9.141c-1.044,0.849-1.592,1.282-1.645,1.3c-0.106,0.053-0.221,0.08-0.345,0.08
c-0.283,0-0.531-0.133-0.743-0.398C4.241,9.981,4.206,9.831,4.206,9.671c0-0.301,0.133-0.522,0.398-0.663L7.178,8L4.604,6.992
c-0.265-0.159-0.398-0.389-0.398-0.69c0-0.159,0.035-0.31,0.106-0.451c0.177-0.265,0.416-0.398,0.716-0.398
c0.106,0,0.23,0.035,0.371,0.106c0.053,0.018,0.601,0.451,1.645,1.3L7.602,7.31C7.319,5.595,7.178,4.675,7.178,4.551
c0-0.212,0.084-0.398,0.252-0.557C7.598,3.835,7.788,3.755,8,3.755c0.212,0,0.402,0.08,0.57,0.239
c0.168,0.159,0.252,0.345,0.252,0.557c0,0.124-0.141,1.044-0.424,2.759l0.557-0.451l1.618-1.3c0.088-0.071,0.221-0.106,0.398-0.106
c0.301,0,0.539,0.133,0.716,0.398c0.071,0.141,0.106,0.283,0.106,0.424c0,0.301-0.133,0.539-0.398,0.716L8.822,8l2.573,1.008
c0.265,0.159,0.398,0.389,0.398,0.69c0,0.141-0.035,0.283-0.106,0.424c-0.212,0.265-0.46,0.398-0.743,0.398
c-0.124,0-0.239-0.027-0.345-0.08c-0.053-0.018-0.601-0.451-1.645-1.3L8.398,8.69c0.283,1.716,0.424,2.635,0.424,2.759
c0,0.212-0.084,0.398-0.252,0.557C8.402,12.165,8.212,12.245,8,12.245z"/>
</g>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FF5C68;}
</style>
<g>
<path class="st0" d="M8,0C3.589,0,0,3.589,0,8c0,4.412,3.589,8,8,8c4.412,0,8-3.588,8-8C16,3.589,12.411,0,8,0z M14.809,8
c0,3.754-3.055,6.809-6.809,6.809c-3.754,0-6.809-3.055-6.809-6.809c0-3.754,3.054-6.809,6.809-6.809
C11.754,1.191,14.809,4.246,14.809,8z"/>
<path class="st0" d="M8,3.308c-0.334,0-0.596,0.262-0.596,0.596v4.884c0,0.335,0.262,0.596,0.596,0.596
c0.335,0,0.596-0.262,0.596-0.596V3.904C8.596,3.57,8.334,3.308,8,3.308z"/>
<path class="st0" d="M8,10.823c-0.334,0-0.596,0.262-0.596,0.595v0.631c0,0.334,0.262,0.595,0.596,0.595
c0.335,0,0.596-0.262,0.596-0.595v-0.631C8.596,11.085,8.334,10.823,8,10.823z"/>
</g>
</svg>
import React, { useEffect } from 'react';
import { Modal, Form, Input, notification, message } from 'antd';
import { addUser } from '@/services/userCenter/userManage/api';
import { ok } from '../../../assets/images/icons/ok.svg';
const AddUserModal = props => {
const { title, visible, orgID, onCancel, onSelect } = props;
......@@ -97,27 +98,42 @@ const AddUserModal = props => {
>
<Form form={addUserForm} labelCol={{ span: 4 }}>
<Form.Item
hasFeedback
name="loginName"
label="登录名称"
rules={[{ required: true, message: '不能为空且不支持中文' }]}
rules={[{
pattern:new RegExp(/^[^\u4e00-\u9fa5]+$/),
message: '不支持中文' },
{
pattern: new RegExp(/^[^\s]*$/),
message: '不能为空' }
]}
>
<Input placeholder="登录名称不支持中文" />
</Form.Item>
<Form.Item
hasFeedback
name="password"
label="账户密码"
rules={[{ required: true, message: '不能为空' }]}
rules={[{
pattern: /^[^\s]*$/,
message: '不能为空' }
]}
>
<Input placeholder="请输入账户密码,至少6位" />
</Form.Item>
<Form.Item
hasFeedback
name="userName"
label="用户名称"
rules={[{ required: true, message: '不能为空' }]}
rules={[{
pattern: /^[^\s]*$/,
message: '不能为空' }]}
>
<Input placeholder="请输入用户姓名" />
</Form.Item>
<Form.Item
hasFeedback
name="phone"
label="手机号码"
rules={[
......@@ -130,6 +146,7 @@ const AddUserModal = props => {
<Input placeholder="请输入11位手机号码" autoComplete="off" />
</Form.Item>
<Form.Item
hasFeedback
name="email"
label="电子邮箱"
rules={[
......
......@@ -120,20 +120,23 @@ const EditUserModal = props => {
>
<Form form={editUserForm} labelCol={{ span: 4 }}>
<Form.Item
hasFeedback
name="loginName"
label="登录名称"
rules={[{ required: true, message: '不能为空' }]}
rules={[{ message: '不能为空' }]}
>
<Input placeholder="请输入登录名称" />
</Form.Item>
<Form.Item
hasFeedback
name="userName"
label="用户姓名"
rules={[{ required: true, message: '不能为空' }]}
rules={[{ message: '不能为空' }]}
>
<Input placeholder="请输入用户姓名" />
</Form.Item>
<Form.Item
hasFeedback
name="phone"
label="手机号码"
rules={[
......@@ -146,6 +149,7 @@ const EditUserModal = props => {
<Input placeholder="请输入11位手机号码" autoComplete="off" />
</Form.Item>
<Form.Item
hasFeedback
name="email"
label="电子邮箱"
rules={[
......
......@@ -13,6 +13,7 @@ import {
Spin,
Dropdown,
Menu,
Popconfirm,
} from 'antd';
import {
UserOutlined,
......@@ -29,7 +30,11 @@ import {
DoubleRightOutlined,
DownOutlined,
BorderlessTableOutlined,
LockOutlined
LockOutlined,
PlusSquareFilled,
EllipsisOutlined,
PlusOutlined,
SyncOutlined,
} from '@ant-design/icons';
import PageContainer from '@/components/BasePageContainer';
import voca from 'voca';
......@@ -59,9 +64,6 @@ import {
SetUserRelationListNew,
JumpToAnotherOUNew,
DeleteUserNew,
} from '@/services/userCenter/userManage/api';
import Tree from '@/components/ExpendableTree';
import classnames from 'classnames';
......@@ -72,12 +74,14 @@ import DeleteOrgModal from './DeleteOrgModal';
import RelateRoleModal from './RelateRoleModal';
import EditUserModal from './EditUserModal';
import ChangePasswordModal from './ChangePasswordModal';
import MapScopeEditModal from '@/components/MapScope'
import AuthModal from './AuthModal'
import MapScopeEditModal from '@/components/MapScope';
import AuthModal from './AuthModal';
import styles from './UserManage.less';
import {createGuid} from '@/utils/transformUtil'
import { createGuid } from '@/utils/transformUtil';
const UserManage = () => {
const { TreeNode } = Tree;
const [treeLoading, setTreeLoading] = useState(false);
const [tableLoading, setTableLoading] = useState(false);
const [loading, setLoading] = useState(true);
......@@ -106,7 +110,7 @@ const UserManage = () => {
const [changeOrgVisible, setChangeOrgVisible] = useState(false); // 更改机构
const [passwordVisible, setPasswordVisible] = useState(false); // 修改密码
const [editUserVisible, setEditUserVisible] = useState(false); // 编辑用户
const [freezeUserVisible, setFreezeUserVisible] = useState(false); // 冻结用户
// const [freezeUserVisible, setFreezeUserVisible] = useState(false); // 冻结用户
const [deleteUserVisible, setDeleteUserVisible] = useState(false); // 删除用户
const [authUserVisible, setAuthUserVisible] = useState(false); // 鉴权用户
......@@ -127,10 +131,10 @@ const UserManage = () => {
const [rolelist, setRolelist] = useState([]); // 角色列表
const [stationlist, setStationlist] = useState([]); // 站点列表
const [orgAreas,setOrgAreas] = useState([])
const [currentOrgArea,setCurrentOrgArea] = useState("")
const [currentOrgDistinct,setCurrentOrgDistinct] = useState("")
const [saveExtentFlag,setSaveExtentFlag] = useState(0)
const [orgAreas, setOrgAreas] = useState([]);
const [currentOrgArea, setCurrentOrgArea] = useState('');
const [currentOrgDistinct, setCurrentOrgDistinct] = useState('');
const [saveExtentFlag, setSaveExtentFlag] = useState(0);
const { Search } = Input;
const setRowClassName = record =>
record.userID === selectColor.userID ? styles.clickRowStyle : '';
......@@ -263,39 +267,85 @@ const UserManage = () => {
style={{ fontSize: '16px' }}
/>
</Tooltip>
{(record.state === '0' || record.state === null) && (
{(record.state == 0 || record.state == null) && (
<>
{ console.log(record.state,'record.state')}
<Tooltip title="冻结用户">
<StopOutlined
onClick={() => freezeUser(record)}
style={{ fontSize: '16px', color: '#e86060' }}
/>
<Popconfirm
placement="bottomRight"
title={
<p>
即将冻结用户{' '}
<span className={styles.redText}>
{voca.stripTags(record.loginName)}
</span>
,是否确认冻结?
</p>
}
okText="确认"
cancelText="取消"
onConfirm={() => freezeUser(record)}
>
<StopOutlined
style={{ fontSize: '16px', color: '#e86060' }}
/>
</Popconfirm>
</Tooltip>
</>
)}
{record.state === '1' && (
{record.state == 1 && (
<>
{ console.log(record.state,'record.state1')}
<Tooltip title="解冻用户">
<UserOutlined
onClick={() => freezeUser(record)}
style={{ fontSize: '16px', color: '#535353' }}
/>
<Popconfirm
placement="bottomRight"
title={
<p>
即将解冻用户{' '}
<span className={styles.redText}>
{voca.stripTags(record.loginName)}
</span>
,是否确认解冻?
</p>
}
okText="确认"
cancelText="取消"
onConfirm={() => freezeUser(record)}
>
<UserOutlined
style={{ fontSize: '16px', color: '#1890ff' }}
/>
</Popconfirm>
</Tooltip>
</>
)}
<Tooltip title="用户鉴权">
<LockOutlined
onClick={() => authUser(record)}
style={{ fontSize: '16px', color: '#535353' }}
style={{ fontSize: '16px', color: '#1890ff' }}
/>
</Tooltip>
<Tooltip title="删除用户">
<DeleteOutlined
onClick={() => deleteUser(record)}
style={{ fontSize: '16px', color: '#e86060' }}
/>
<Popconfirm
placement="bottomRight"
title={
<p>
即将删除用户{' '}
<span className={styles.redText}>
{voca.stripTags(record.loginName)}
</span>
,是否确认删除?
</p>
}
// title={`确认删除用户${currentUser}`}
okText="确认"
cancelText="取消"
onConfirm={() => deleteUser(record)}
>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
</Space>
),
},
......@@ -305,7 +355,7 @@ const UserManage = () => {
const handleSearch = e => {
setSearchWord(e.target.value);
};
// 复选框
const rowSelection = {
selectedRowKeys,
onChange: (RowKeys, Rows) => {
......@@ -323,18 +373,34 @@ const UserManage = () => {
}
},
};
// 渲染机构树
const mapTree = org => {
const haveChildren = Array.isArray(org.children) && org.children.length > 0;
return {
title: org.text,
title: (
<div className={styles.title}>
<span className={styles.titleText}>{org.text}</span>
<span className={styles.tip}>
<Tooltip title="" className={styles.fs}>
<Dropdown style={{ position: 'relative', zIndex: '99', width: '5rem' }} onClick={changeUsers} overlay={orgButtonMenu} disabled={currentOrgOperate}>
<PlusOutlined style={{ marginLeft: 20 }} />
</Dropdown>
</Tooltip>
<Dropdown overlay={orgButtonMenu1} disabled={currentOrgOperate}>
<EllipsisOutlined style={{ marginLeft: 20 }} />
</Dropdown>
</span>
</div>
),
key: org.id,
// icon: <UserOutlined style={{ display: 'inline' }} />,
// 判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
children: haveChildren ? org.children.map(i => mapTree(i)) : [],
};
};
const changeUsers = (e) => {
e.stopPropagation();
}
// 重新渲染树
const updateTrees = () => {
setTreeLoading(true);
......@@ -361,9 +427,10 @@ const UserManage = () => {
// setTreeLoading(false);
// message.error(err);
// });
GetOUTreeNew({selectOU:-1}).then(newres => {
if (newres.code == 0) {
let res = newres.data
GetOUTreeNew({ selectOU: -1 })
.then(newres => {
if (newres.code === 0) {
let res = newres.data;
setTreeLoading(false);
setTreeData(res);
setTreeDataCopy(res);
......@@ -376,6 +443,7 @@ const UserManage = () => {
setTreeLoading(false);
notification.error({
message: '获取失败',
// eslint-disable-next-line no-undef
description: res.message,
});
}
......@@ -389,22 +457,21 @@ const UserManage = () => {
// 获取用户机构树
useEffect(() => {
updateTrees();
}, []);
//更新获取初始范围
useEffect(()=>{
// 更新获取初始范围
useEffect(() => {
getOrgArea().then(res => {
if (res.IsSuccess) {
setOrgAreas(res.Results)
setOrgAreas(res.Results);
}
})
},[saveExtentFlag])
});
}, [saveExtentFlag]);
// 点击树节点,获取当前机构下所有用户
const onSelect = (props, e) => {
setTableLoading(true);
if (e) {
setOrgTitle(e.node.title);
setOrgTitle(e.node.title.props.children[0].props.children);
}
if (!props[0]) {
setCurrentSelectOrg(currentSelectOrg);
......@@ -412,25 +479,26 @@ const UserManage = () => {
setCurrentSelectOrg(props[0]);
}
// orgAreas.map((item)=>{
// if(item.OUID == props[0]){
// setCurrentOrgArea(item.Extent)
// setCurrentOrgDistinct(item.AreaName)
// }
// })
GetMapSetByGroupID({
groupID:props[0]
}).then(
res=>{
if(res.code == 0){
setCurrentOrgArea(res.data.MapRange)
setCurrentOrgDistinct(res.data.AreeName)
}
groupID: props[0],
}).then(res => {
if (res.code === 0) {
console.log(res.data.MapRange);
setCurrentOrgArea(res.data.MapRange);
setCurrentOrgDistinct(res.data.AreeName);
}
)
});
setOrgID(props[0] || currentSelectOrg);
// 树节点变化(即props不为空)时才请求,避免重复请求
if (props[0]) {
// eslint-disable-next-line no-console
console.log(props[0]);
getOneOUUserListNew(props[0] || currentSelectOrg)
.then(res => {
setCurrentOrgOperate(false); // 重置禁用当前机构操作为false
......@@ -488,9 +556,11 @@ const UserManage = () => {
}
return arr;
};
const editorMenu = (e) => {
e.stopPropagation();
}
// 添加用户
const addUser = () => {
const addUser = (e) => {
setUserVisible(true);
};
// 添加顶级机构
......@@ -512,10 +582,10 @@ const UserManage = () => {
// 删除后默认选择第一个组织
setTreeState(true);
};
//编辑机构范围
// 编辑机构范围
const EditOrgScope = () => {
setEditOrgExtentVisible(true)
}
setEditOrgExtentVisible(true);
};
// 在currentUser变化后获取角色列表
useEffect(() => {
......@@ -570,21 +640,76 @@ const UserManage = () => {
};
// 冻结用户
const freezeUser = record => {
setFreezeUserVisible(true);
// setFreezeUserVisible(true);
setCurrentUser(record);
setSelectColor(record);
let state = '';
console.log(record);
if (record.state === '0' || record.state === null) {
state = '1';
} else {
state = '0';
}
UserStateOUNew({ ouid: record.userID })
.then(res => {
if (res.code === 0) {
// 重新获取用户表
// eslint-disable-next-line no-unused-expressions
currentSelectOrg === '-1'
? submitSearchUser()
: onSelect([currentSelectOrg]);
notification.success({
message: '提交成功',
duration: 2,
});
} else {
notification.error({
message: '提交失败',
description: res.msg,
});
}
})
.catch(err => {
setTableLoading(false);
message.error(err);
});
};
// 删除用户
const deleteUser = record => {
setDeleteUserVisible(true);
setCurrentUser(record);
console.log(record.userName);
setCurrentUser(record.userName);
setSelectColor(record);
DeleteUserNew({
userID: record.userID,
ouID: record.OUID,
})
.then(res => {
if (res.code === 0) {
notification.success({
message: '提交成功',
duration: 2,
});
// eslint-disable-next-line no-unused-expressions
currentSelectOrg === '-1'
? submitSearchUser()
: onSelect([currentSelectOrg]);
} else {
notification.error({
message: '提交失败',
description: res.msg,
});
}
})
.catch(err => {
setTableLoading(false);
message.error(err);
});
};
//用户鉴权
const authUser = record =>{
// 用户鉴权
const authUser = record => {
setCurrentUser(record);
setAuthUserVisible(true)
}
setAuthUserVisible(true);
};
// 查找用户
const submitSearchUser = () => {
// getUserByKey(searchWord)
......@@ -607,14 +732,15 @@ const UserManage = () => {
// .catch(err => {
// message.error(err);
// });
GetUserByKeyNew({key:searchWord})
GetUserByKeyNew({ key: searchWord })
.then(res => {
if (res.code == 0) {
if (res.code === 0) {
setSelectedRowKeys([]); // 重置选中用户数
setCurrentOrgOperate(true); // 禁止当前机构操作
setMultiOperate(true); // 禁用批量操作
setOrgTitle('全部机构搜索结果'); // 设置表头
setCurrentSelectOrg('-1'); // 清空选中机构
console.log(res.data);
setTableData(res.data);
setTableLength(res.data.length);
} else {
......@@ -652,10 +778,10 @@ const UserManage = () => {
// setTableLoading(false);
// message.error(err);
// });
GetUserRelationListNew({userID:currentUser.userID})
GetUserRelationListNew({ userID: currentUser.userID })
.then(res => {
setLoading(false);
if (res.code == 0) {
if (res.code === 0) {
const { roleList, stationList } = res.data;
setRolelist(roleList);
setStationlist(stationList);
......@@ -694,10 +820,10 @@ const UserManage = () => {
// setTableLoading(false);
// message.error(err);
// });
GetUserRelationListNew({userID:""})
GetUserRelationListNew({ userID: '' })
.then(res => {
setLoading(false);
if (res.code == 0) {
if (res.code === 0) {
const { roleList, stationList } = res.data;
setRolelist(roleList);
setStationlist(stationList);
......@@ -715,7 +841,7 @@ const UserManage = () => {
});
};
// 提交-更改机构
const submitChangeOrg = () =>{
const submitChangeOrg = () => {
// addToOrg(currentUser.userID, currentUser.OUID, newOrgID)
// .then(res => {
// if (res.success) {
......@@ -738,42 +864,16 @@ const UserManage = () => {
// message.error(err);
// });
JumpToAnotherOUNew({
userID:currentUser.userID,
oldOUID:currentUser.OUID,
newOUID:newOrgID
}).then(res => {
if (res.code === 0) {
setChangeOrgVisible(false);
// 跳转到新组织机构下的用户表
onSelect([newOrgID]);
// setExpandedKeys([`${newOrgID}`]);
notification.success({
message: '提交成功',
duration: 2,
});
} else {
notification.error({
message: '提交失败',
description: res.msg,
});
}
userID: currentUser.userID,
oldOUID: currentUser.OUID,
newOUID: newOrgID,
})
.catch(err => {
message.error(err);
});
}
// 提交-批量更改机构
const submitChangeOrgs = () =>
addToOrgs(userIDs, orgIDs, newOrgID)
.then(res => {
if (res.code === 0) {
setChangeOrgVisible(false);
// 跳转到新组织机构下的用户表
const temp = orgIDs.split(',');
// 批量更改机构成功后设置老的orgIDs为全部是newOrgID的数组,并转字符串
setOrgIDs(temp.map(() => newOrgID).toString());
onSelect([newOrgID]);
// setExpandedKeys([`${newOrgID}`]);
notification.success({
message: '提交成功',
duration: 2,
......@@ -788,47 +888,19 @@ const UserManage = () => {
.catch(err => {
message.error(err);
});
};
// 提交-冻结用户
const submitFreezeUser = () => {
let state = '';
if (currentUser.state === '0' || currentUser.state === null) {
state = '1';
} else {
state = '0';
}
// postSetUserState(currentUser.userID, state)
// .then(res => {
// if (res.success) {
// setFreezeUserVisible(false);
// // 重新获取用户表
// // eslint-disable-next-line no-unused-expressions
// currentSelectOrg === '-1'
// ? submitSearchUser()
// : onSelect([currentSelectOrg]);
// notification.success({
// message: '提交成功',
// duration: 2,
// });
// } else {
// notification.error({
// message: '提交失败',
// description: res.message,
// });
// }
// })
// .catch(err => {
// setTableLoading(false);
// message.error(err);
// });
UserStateOUNew({ouid:currentUser.userID,state:state}).then(res => {
if (res.code == 0) {
setFreezeUserVisible(false);
// 重新获取用户表
// eslint-disable-next-line no-unused-expressions
currentSelectOrg === '-1'
? submitSearchUser()
: onSelect([currentSelectOrg]);
// 提交-批量更改机构
const submitChangeOrgs = () =>
addToOrgs(userIDs, orgIDs, newOrgID)
.then(res => {
if (res.code === 0) {
setChangeOrgVisible(false);
// 跳转到新组织机构下的用户表
const temp = orgIDs.split(',');
// 批量更改机构成功后设置老的orgIDs为全部是newOrgID的数组,并转字符串
setOrgIDs(temp.map(() => newOrgID).toString());
onSelect([newOrgID]);
notification.success({
message: '提交成功',
duration: 2,
......@@ -841,10 +913,66 @@ const UserManage = () => {
}
})
.catch(err => {
setTableLoading(false);
message.error(err);
});
};
// 提交-冻结用户
// const submitFreezeUser = () => {
// let state = '';
// if (currentUser.state === '0' || currentUser.state === null) {
// state = '1';
// } else {
// state = '0';
// }
// // postSetUserState(currentUser.userID, state)
// // .then(res => {
// // if (res.success) {
// // setFreezeUserVisible(false);
// // // 重新获取用户表
// // // eslint-disable-next-line no-unused-expressions
// // currentSelectOrg === '-1'
// // ? submitSearchUser()
// // : onSelect([currentSelectOrg]);
// // notification.success({
// // message: '提交成功',
// // duration: 2,
// // });
// // } else {
// // notification.error({
// // message: '提交失败',
// // description: res.message,
// // });
// // }
// // })
// // .catch(err => {
// // setTableLoading(false);
// // message.error(err);
// // });
// UserStateOUNew({ ouid: currentUser.userID, state })
// .then(res => {
// if (res.code === 0) {
// // setFreezeUserVisible(false);
// // 重新获取用户表
// // eslint-disable-next-line no-unused-expressions
// currentSelectOrg === '-1'
// ? submitSearchUser()
// : onSelect([currentSelectOrg]);
// notification.success({
// message: '提交成功',
// duration: 2,
// });
// } else {
// notification.error({
// message: '提交失败',
// description: res.msg,
// });
// }
// })
// .catch(err => {
// setTableLoading(false);
// message.error(err);
// });
// };
// 提交-删除用户
const submitDeleteUser = () => {
// postDeleteUser(currentUser.userID)
......@@ -870,12 +998,12 @@ const UserManage = () => {
// setTableLoading(false);
// message.error(err);
// });
DeleteUserNew({
userID:currentUser.userID,
ouID:currentUser.OUID
}).then(res => {
if (res.code == 0) {
setDeleteUserVisible(false);
DeleteUserNew({
userID: currentUser.userID,
ouID: currentUser.OUID,
})
.then(res => {
if (res.code === 0) {
notification.success({
message: '提交成功',
duration: 2,
......@@ -922,46 +1050,51 @@ const UserManage = () => {
setTableLoading(false);
message.error(err);
});
};
//更改机构范围
// 更改机构范围
const submitExtent = (extent, areaName) => {
console.log(extent)
if (extent) {
setOrgArea({
OUID: currentSelectOrg,
areaName: areaName,
extent: extent
areaName,
extent,
}).then(res => {
if (res.IsSuccess) {
setSaveExtentFlag(saveExtentFlag + 1)
message.success("机构范围设置成功!")
setSaveExtentFlag(saveExtentFlag + 1);
message.success('机构范围设置成功!');
} else {
message.warn(res.Message)
message.warn(res.Message);
}
})
});
}
setEditOrgExtentVisible(false)
}
setEditOrgExtentVisible(false);
};
/** ***操作按钮**** */
// 机构操作
const orgButtonMenu = (
<Menu>
<Menu.Item key="1" onClick={addUser} icon={<UserAddOutlined />}>
<Menu.Item key="1" onClick={e => addUser(e)} icon={<UserAddOutlined />}>
添加用户
</Menu.Item>
<hr />
<Menu.Item key="2" onClick={addSubOrg} icon={<UsergroupAddOutlined />}>
添加下级机构
</Menu.Item>
</Menu>
);
const orgButtonMenu1 = (
<Menu>
<Menu.Item key="3" onClick={editOrg} icon={<EditOutlined />}>
编辑当前机构
</Menu.Item>
<Menu.Item key="4" onClick={deleteOrg} icon={<DeleteOutlined />}>
删除当前机构
</Menu.Item>
<Menu.Item key="5" onClick={EditOrgScope} icon={<BorderlessTableOutlined />}>
<Menu.Item
key="5"
onClick={EditOrgScope}
icon={<BorderlessTableOutlined />}
>
编辑机构范围
</Menu.Item>
</Menu>
......@@ -993,21 +1126,30 @@ const UserManage = () => {
})}
>
<div>
<span style={{ margin: '0 106px 0 10px' }}>机构列表</span>
<span
style={{
margin: '0px 120px 0px 4px',
fontSize: '17px ',
fontWeight: 'bold',
}}
>
机构列表
</span>
<Tooltip title="添加顶级机构">
<UsergroupAddOutlined
<PlusSquareFilled
onClick={() => addOrg()}
style={{
color: '#1890FF',
fontSize: '18px',
verticalAlign: '0.04em',
fontSize: '35px',
verticalAlign: 'middle',
}}
/>
</Tooltip>
<hr style={{ width: '80%', color: '#eeecec' }} />
{treeData.length > 0 && (
<Tree
showIcon="true"
showLine={{ showLeafIcon: false }}
// showLine={{ showLeafIcon: false }}
blockNode
autoExpandParent
// expandedKeys={[currentSelectOrg]}
......@@ -1032,7 +1174,6 @@ const UserManage = () => {
</div>
</Card>
</Spin>
{/* 右侧用户表 */}
<div
className={classnames({
......@@ -1057,11 +1198,9 @@ const UserManage = () => {
enterButton
value={searchWord}
/>
<Dropdown overlay={orgButtonMenu} disabled={currentOrgOperate}>
<Button type="primary">
当前机构操作 <DownOutlined />
</Button>
</Dropdown>
<Button icon={<SyncOutlined />}>重置</Button>
<Dropdown overlay={userButtonMenu} disabled={multiOperate}>
<Button type={multiOperateButtonType}>
用户批量操作 <DownOutlined />
......@@ -1196,7 +1335,7 @@ const UserManage = () => {
onCancel={() => setEditUserVisible(false)}
/>
{/* 冻结用户 */}
<Modal
{/* <Modal
title="请确认"
visible={freezeUserVisible}
onOk={submitFreezeUser}
......@@ -1212,7 +1351,7 @@ const UserManage = () => {
,是否确认
{+currentUser.state ? '激活' : '冻结'}?
</p>
</Modal>
</Modal> */}
{/* 删除用户 */}
<Modal
title="确认删除用户"
......@@ -1226,15 +1365,7 @@ const UserManage = () => {
cancelText="取消"
>
<p>
将删除用户
{multiDelete ? (
''
) : (
<span className={styles.redText}>
{voca.stripTags(currentUser.loginName)}
</span>
)}
, 是否确认删除?
将删除多个用户, 是否确认删除?
</p>
</Modal>
<MapScopeEditModal
......@@ -1247,9 +1378,9 @@ const UserManage = () => {
extent={currentOrgArea}
/>
<AuthModal
visible={authUserVisible}
currentUser={currentUser}
onCancel={() => setAuthUserVisible(false)}
visible={authUserVisible}
currentUser={currentUser}
onCancel={() => setAuthUserVisible(false)}
/>
</div>
</PageContainer>
......
......@@ -27,7 +27,8 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
display: flex !important;
justify-content: space-between;
}
}
.ant-pagination-prev,.ant-pagination-next{
......@@ -52,6 +53,10 @@
}
.ant-tree-switcher-icon svg{
font-size: 14px;
color: #767777 !important;
}
.ant-card-body {
padding: 12px 24px 24px 10px;
}
}
.redText{
......@@ -64,7 +69,10 @@
margin:12px !important;
}
}
.ant-btn > .anticon + span, .ant-btn > span + .anticon {
margin-left: 8px;
vertical-align: middle;
}
.siteTitle{
font-size: 16px;
margin: 0 0 6px 0;
......@@ -100,7 +108,7 @@
position: relative;
.orgContainer{
height: calc(100vh - 74px);
width: 240px;
width: 260px;
left: 0;
top: 0;
overflow-x: hidden;
......@@ -214,4 +222,56 @@
overflow: auto;
height: 50vh;
}
}
\ No newline at end of file
}
.ant-modal-body{
padding-bottom:0px;
padding-right:40px;
padding-left:40px;
.ant-form{
width: 90%;
}
}
.ant-modal-content{
border-radius: 5px;
}
.ant-modal-header{
border-radius: 5px 5px 0 0;
padding: 28px 40px;
}
.ant-modal-close{
top:14px;
right:20px;
}
.ant-modal-footer{
border:none;
padding: 28px 40px;
}
.ant-modal-footer .ant-btn + .ant-btn:not(.ant-dropdown-trigger) {
margin-bottom: 0;
margin-left: 15px;
}
.ant-form-horizontal .ant-form-item-control {
margin-left: 10px;
}
.title{
display: flex;
align-items: center;
width: 100%;
}
.tip{
display: none;
}
.fs{
font-size: 18px;
margin-left: 10px;
}
.title:hover{
.tip{
position: relative;
z-index: 99;
display: flex;
align-items: center;
justify-content: flex-end;
width: 100%;
}
}
\ No newline at end of file
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