Commit fa457b9e authored by 陈前坚's avatar 陈前坚

perf: 用户管理优化

parent 7ef8e4bf
...@@ -290,8 +290,8 @@ const UserManage = () => { ...@@ -290,8 +290,8 @@ const UserManage = () => {
console.log(selectedRows.map(item => item.OUID).toString()); console.log(selectedRows.map(item => item.OUID).toString());
setUserIDs(selectedRowKeys.toString()); // 数组转字符串,逗号连接 setUserIDs(selectedRowKeys.toString()); // 数组转字符串,逗号连接
setOrgIDs(selectedRows.map(item => item.OUID).toString()); setOrgIDs(selectedRows.map(item => item.OUID).toString());
// 选中行数大于1时设置批量操作可行 // 选中行数大于0时设置批量操作可行
if (selectedRows.length > 1) { if (selectedRows.length > 0) {
setMultiOperate(false); setMultiOperate(false);
setMultiOperateButtonType('primary'); setMultiOperateButtonType('primary');
} else { } else {
...@@ -533,6 +533,8 @@ const UserManage = () => { ...@@ -533,6 +533,8 @@ const UserManage = () => {
getUserByKey(searchWord) getUserByKey(searchWord)
.then(res => { .then(res => {
if (res.success) { if (res.success) {
setOrgTitle('搜索结果'); // 设置表头
setCurrentSelectOrg([]); // 清空机构时选中机构
setTableData(res.root); setTableData(res.root);
setTableLength(res.root.length); setTableLength(res.root.length);
} else { } else {
...@@ -871,15 +873,12 @@ const UserManage = () => { ...@@ -871,15 +873,12 @@ const UserManage = () => {
const newPassword = passwordForm.getFieldValue('newPassword'); const newPassword = passwordForm.getFieldValue('newPassword');
const passwordConfirm = passwordForm.getFieldValue('passwordConfirm'); const passwordConfirm = passwordForm.getFieldValue('passwordConfirm');
if ( if (
(newPassword && newPassword.length < 6) || newPassword &&
(passwordConfirm && passwordConfirm < 6) newPassword.length >= 6 &&
passwordConfirm &&
newPassword.length >= 6 &&
newPassword === passwordConfirm
) { ) {
notification.error({
message: '提交失败',
description: '密码至少为6位!',
});
}
if (newPassword && passwordConfirm && newPassword === passwordConfirm) {
updateUserPassword( updateUserPassword(
currentUser.userID, currentUser.userID,
password, password,
...@@ -908,7 +907,15 @@ const UserManage = () => { ...@@ -908,7 +907,15 @@ const UserManage = () => {
message: '提交失败', message: '提交失败',
description: '带*号为必填项,不能为空', description: '带*号为必填项,不能为空',
}); });
} else { } else if (
(newPassword && newPassword.length < 6) ||
(passwordConfirm && passwordConfirm < 6)
) {
notification.error({
message: '提交失败',
description: '密码至少为6位!',
});
} else if (newPassword !== passwordConfirm) {
notification.error({ notification.error({
message: '提交失败', message: '提交失败',
description: '确认密码不一致!', description: '确认密码不一致!',
...@@ -1078,13 +1085,13 @@ const UserManage = () => { ...@@ -1078,13 +1085,13 @@ const UserManage = () => {
</Menu.Item> </Menu.Item>
<hr /> <hr />
<Menu.Item key="2" onClick={addSubOrg} icon={<UsergroupAddOutlined />}> <Menu.Item key="2" onClick={addSubOrg} icon={<UsergroupAddOutlined />}>
添加机构 添加下级机构
</Menu.Item> </Menu.Item>
<Menu.Item key="3" onClick={editOrg} icon={<EditOutlined />}> <Menu.Item key="3" onClick={editOrg} icon={<EditOutlined />}>
编辑机构 编辑当前机构
</Menu.Item> </Menu.Item>
<Menu.Item key="4" onClick={deleteOrg} icon={<DeleteOutlined />}> <Menu.Item key="4" onClick={deleteOrg} icon={<DeleteOutlined />}>
删除机构 删除当前机构
</Menu.Item> </Menu.Item>
</Menu> </Menu>
); );
...@@ -1139,7 +1146,6 @@ const UserManage = () => { ...@@ -1139,7 +1146,6 @@ const UserManage = () => {
/> />
)} )}
</div> </div>
<div className={styles.switcher}> <div className={styles.switcher}>
{treeVisible && ( {treeVisible && (
<Tooltip title="隐藏机构列表"> <Tooltip title="隐藏机构列表">
...@@ -1156,7 +1162,12 @@ const UserManage = () => { ...@@ -1156,7 +1162,12 @@ const UserManage = () => {
</Spin> </Spin>
{/* 右侧用户表 */} {/* 右侧用户表 */}
<div className={styles.userContainer}> <div
className={classnames({
[styles.userContainer]: true,
[styles.userContainerHide]: !treeVisible,
})}
>
<div style={{ height: '50px' }}> <div style={{ height: '50px' }}>
<p style={{ margin: '16px 0 10px 16px', display: 'inline-block' }}> <p style={{ margin: '16px 0 10px 16px', display: 'inline-block' }}>
{orgTitle}(共{tableLength}人) {orgTitle}(共{tableLength}人)
...@@ -1172,7 +1183,7 @@ const UserManage = () => { ...@@ -1172,7 +1183,7 @@ const UserManage = () => {
/> />
<Dropdown overlay={orgButtonMenu}> <Dropdown overlay={orgButtonMenu}>
<Button type="primary"> <Button type="primary">
机构操作 <DownOutlined /> 当前机构操作 <DownOutlined />
</Button> </Button>
</Dropdown> </Dropdown>
<Dropdown overlay={userButtonMenu} disabled={multiOperate}> <Dropdown overlay={userButtonMenu} disabled={multiOperate}>
......
...@@ -91,7 +91,8 @@ ...@@ -91,7 +91,8 @@
background: white; background: white;
overflow: auto; overflow: auto;
margin-right:10px; margin-right:10px;
transform: translateX(0px); margin-left:0px;
transform: translateX(1px);
transition: transform 0.5s; transition: transform 0.5s;
.ant-tree{ .ant-tree{
padding-top: 6px; padding-top: 6px;
...@@ -115,12 +116,16 @@ ...@@ -115,12 +116,16 @@
.orgContainerHide{ .orgContainerHide{
transform: translateX(-230px); transform: translateX(-230px);
} }
.userContainerHide{
transform: translateX(-230px);
margin-right: -230px;
}
.userContainer{ .userContainer{
height: calc(100vh - 74px) !important; height: calc(100vh - 74px) !important;
flex: 1; flex: 1;
min-width: 760px; min-width: 800px;
background: white; background: white;
transition: transform 0.5s;
.ant-table-pagination{ .ant-table-pagination{
padding-right: 12px; padding-right: 12px;
background: white; background: white;
......
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