Commit e0ec9b25 authored by 皮倩雯's avatar 皮倩雯

fix: '用户管理菜单树'

parent 2d3bdcab
Pipeline #45257 skipped with stages
......@@ -117,6 +117,8 @@ const MobileConfigPage = props => {
};
// 删除
const delMini = (val, closeModal) => {
console.log(clientName);
console.log(val);
setLoading(true);
closeModal();
console.log(val);
......@@ -128,7 +130,9 @@ const MobileConfigPage = props => {
.then(res => {
setLoading(false);
if (res.code === 0) {
setMiniTitle('');
if (clientName === val) {
setMiniTitle(singleList[0].text);
}
setTimeout(() => {
setFlag(flag + 1);
}, 500);
......
......@@ -276,7 +276,7 @@ const MiniMenu = props => {
notification.error({
message: '提示',
duration: 10,
description: res.message || '获取失败',
description: res.msg || '获取失败',
});
}
console.log(res, 'resss');
......@@ -323,7 +323,7 @@ const MiniMenu = props => {
notification.error({
message: '提示',
duration: 10,
description: res.message || '删除失败',
description: res.msg || '删除失败',
});
}
})
......@@ -402,7 +402,7 @@ const MiniMenu = props => {
} else {
notification.error({
message: '提示',
description: res.message || '新增失败',
description: res.msg || '新增失败',
duration: 10,
});
}
......@@ -442,7 +442,7 @@ const MiniMenu = props => {
notification.error({
message: '提示',
duration: 3,
description: res.message || '编辑失败',
description: res.msg || '编辑失败',
});
}
console.log(res, 'resres');
......@@ -596,7 +596,7 @@ const MiniMenu = props => {
notification.error({
message: '提示',
duration: 3,
description: res.message || '操作失败',
description: res.msg || '操作失败',
});
}
});
......
......@@ -82,6 +82,7 @@ const WebConfigPage = props => {
const updateModuleTree = (userModePrama, canceled = { cancel: false }) => {
setLoading(true);
console.log(userModePrama);
return getWebModuleTree(userModePrama)
.then(res => {
const websArr = [
......@@ -151,7 +152,9 @@ const WebConfigPage = props => {
duration: 3,
});
// updateModuleTree(userMode || 'super');
if (webToOperate.id === curWeb.id) {
setCurWeb(webs[0].id);
}
setTimeout(() => {
updateModuleTree(userMode || 'super');
}, 500);
......
......@@ -150,10 +150,6 @@ const MiniMenu = props => {
}
};
const handleExpand = (keys, { expanded, node }) => {
console.log(keys);
};
const getInfo = id => {
if (!menuID) {
return;
......@@ -190,7 +186,7 @@ const MiniMenu = props => {
notification.error({
message: '提示',
duration: 10,
description: res.message || '获取失败',
description: res.msg || '获取失败',
});
}
})
......@@ -236,7 +232,7 @@ const MiniMenu = props => {
notification.error({
message: '提示',
duration: 10,
description: res.message || '删除失败',
description: res.msg || '删除失败',
});
}
})
......@@ -332,8 +328,10 @@ const MiniMenu = props => {
console.error(err);
});
};
const treeCallback = prop => {
console.log(prop);
const treeCallback = value => {
if (value) {
console.log(value);
}
};
// 编辑的回调
const editSubmitCallback = prop => {
......@@ -364,7 +362,7 @@ const MiniMenu = props => {
notification.error({
message: '提示',
duration: 3,
description: res.message || '编辑失败',
description: res.mes || '编辑失败',
});
}
})
......@@ -569,7 +567,7 @@ const MiniMenu = props => {
notification.error({
message: '提示',
duration: 3,
description: res.message || '操作失败',
description: res.msg || '操作失败',
});
}
});
......@@ -621,7 +619,6 @@ const MiniMenu = props => {
<Tree
showIcon
onSelect={handleSelect}
onExpand={handleExpand}
treeData={menuList.map(item => mapTree(item))}
blockNode
draggable
......
......@@ -3,17 +3,17 @@ import { Modal, Form, Input, notification, message } from 'antd';
import { addOrg } from '@/services/userManage/api';
const AddUserModal = props => {
const { title, visible, orgID, onCancel, updateTrees, onSelect } = props;
const { visible, orgID, onCancel, updateTrees, onSelect, orgTitle1 } = props;
const [addOrgForm] = Form.useForm(); // 添加用户
useEffect(() => {
console.log(orgID)
console.log(orgID);
addOrgForm.resetFields();
}, [orgID]);
// 提交-添加下级机构
const submitAddOrg = () => {
if(orgID == -1){
if (orgID == -1) {
addOrg(
orgID,
addOrgForm.getFieldValue('OUName'),
......@@ -21,7 +21,7 @@ const AddUserModal = props => {
'',
)
.then(res => {
if (res.msg==="Ok") {
if (res.msg === 'Ok') {
onCancel();
notification.success({
message: '提交成功',
......@@ -40,8 +40,7 @@ const AddUserModal = props => {
.catch(err => {
message.error(err);
});
}else{
} else {
addOrg(
orgID.id,
addOrgForm.getFieldValue('OUName'),
......@@ -49,7 +48,7 @@ const AddUserModal = props => {
'',
)
.then(res => {
if (res.msg==="Ok") {
if (res.msg === 'Ok') {
onCancel();
notification.success({
message: '提交成功',
......@@ -70,9 +69,14 @@ const AddUserModal = props => {
});
}
};
const title = (
<span>
<span style={{ fontWeight: 'bold', color: 'red' }}>{orgTitle1}</span>下添加机构
</span>
);
return (
<Modal
title={title}
title={orgID === '-1' ? '添加顶级机构' : title}
visible={visible}
onCancel={onCancel}
onOk={submitAddOrg}
......@@ -80,11 +84,7 @@ const AddUserModal = props => {
cancelText="取消"
>
<Form form={addOrgForm} labelCol={{ span: 4 }}>
<Form.Item
name="OUName"
label="机构名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Form.Item name="OUName" label="机构名称" rules={[{ required: true, message: '不能为空' }]}>
<Input placeholder="请输入机构名称" />
</Form.Item>
<Form.Item name="description" label="描述">
......
......@@ -4,7 +4,7 @@ import { addUser } from '@/services/userManage/api';
import { ok } from '../../../assets/images/icons/ok.svg';
const AddUserModal = props => {
const { title, visible, orgID, onCancel, onSelect } = props;
const { visible, orgID, onCancel, onSelect, orgTitle1 } = props;
const [addUserForm] = Form.useForm(); // 添加用户
/** ***正则验证**** */
const noChinese = new RegExp(/^[^\u4e00-\u9fa5]+$/); // 不能包含中文
......@@ -15,7 +15,7 @@ const AddUserModal = props => {
useEffect(() => {
addUserForm.resetFields();
console.log(orgID)
console.log(orgID);
}, [orgID]);
// 提交-添加用户
......@@ -36,17 +36,17 @@ const AddUserModal = props => {
message: '提交失败',
description: '登录名不支持中文!',
});
}else if (password === '') {
} else if (password === '') {
notification.error({
message: '提交失败',
description: '密码不能为空!',
});
}else if (password.length < 6) {
} else if (password.length < 6) {
notification.error({
message: '提交失败',
description: '密码至少为6位,且包含数字和字母!',
});
}else if (userName === '') {
} else if (userName === '') {
notification.error({
message: '提交失败',
description: '用户名称不能为空!',
......@@ -72,7 +72,7 @@ const AddUserModal = props => {
) {
addUser({ OUID: orgID.id, loginName, userName, password, phone, email })
.then(res => {
if (res.code===0) {
if (res.code === 0) {
addUserForm.resetFields();
onCancel(); // 设置Modal不可见
notification.success({
......@@ -93,6 +93,12 @@ const AddUserModal = props => {
});
}
};
const title = (
<span>
<span style={{ fontWeight: 'bold', color: 'red' }}>{orgTitle1}</span>下添加用户
</span>
);
return (
<Modal
title={title}
......@@ -103,47 +109,53 @@ const AddUserModal = props => {
cancelText="取消"
>
<Form form={addUserForm} labelCol={{ span: 4 }}>
<span style={{position: 'absolute', top: '21%', color: 'red', fontSize: '16px'}}>*</span>
<span style={{ position: 'absolute', top: '21%', color: 'red', fontSize: '16px' }}>*</span>
<Form.Item
hasFeedback
name="loginName"
label="登录名称"
rules={[{
pattern:new RegExp(/^[^\u4e00-\u9fa5]+$/),
message: '不支持中文' },
rules={[
{
pattern: new RegExp(/^[^\u4e00-\u9fa5]+$/),
message: '不支持中文',
},
{
pattern: new RegExp(/^[^\s]*$/),
message: '不能为空' }
message: '不能为空',
},
]}
>
<Input placeholder="登录名称不支持中文" />
</Form.Item>
<span style={{position: 'absolute', top: '35%', color: 'red', fontSize: '16px'}}>*</span>
<span style={{ position: 'absolute', top: '35%', color: 'red', fontSize: '16px' }}>*</span>
<Form.Item
hasFeedback
name="password"
label="账户密码"
rules={[{
rules={[
{
pattern: /^[^\s]*$/,
message: '不能为空'
message: '不能为空',
},
{
pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/,
message: '密码长度必须大于6,且必须包含数字和字母'
}
]
}
message: '密码长度必须大于6,且必须包含数字和字母',
},
]}
>
<Input placeholder="请输入账户密码,至少6位" />
</Form.Item>
<span style={{position: 'absolute', top: '49%', color: 'red', fontSize: '16px'}}>*</span>
<span style={{ position: 'absolute', top: '49%', color: 'red', fontSize: '16px' }}>*</span>
<Form.Item
hasFeedback
name="userName"
label="用户名称"
rules={[{
rules={[
{
pattern: /^[^\s]*$/,
message: '不能为空' }]}
message: '不能为空',
},
]}
>
<Input placeholder="请输入用户姓名" />
</Form.Item>
......
/*
* @Description:
* @Author: leizhe
* @Date: 2022-01-13 17:26:14
* @LastEditTime: 2022-03-07 18:50:03
* @LastEditors: leizhe
*/
import React, { useEffect } from 'react';
import { Modal, Form, Input, notification, message } from 'antd';
import { editOrgInfo } from '@/services/userManage/api';
const EditOrgModal = props => {
const {
title,
visible,
orgID,
orgTitle,
......@@ -12,6 +18,7 @@ const EditOrgModal = props => {
onCancel,
updateTrees,
onSelect,
orgTitle1,
} = props;
const [editOrgForm] = Form.useForm(); // 添加用户
......@@ -51,6 +58,11 @@ const EditOrgModal = props => {
.catch(err => {
message.error(err);
});
const title = (
<span>
编辑<span style={{ fontWeight: 'bold', color: 'red' }}>{orgTitle1}</span>
</span>
);
return (
<Modal
title={title}
......@@ -61,11 +73,7 @@ const EditOrgModal = props => {
cancelText="取消"
>
<Form form={editOrgForm} labelCol={{ span: 4 }}>
<Form.Item
name="OUName"
label="机构名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Form.Item name="OUName" label="机构名称" rules={[{ required: true, message: '不能为空' }]}>
<Input placeholder="请输入机构名称" />
</Form.Item>
<Form.Item name="description" label="描述">
......
......@@ -151,6 +151,7 @@ const UserManage = () => {
const [keep1, setKeep1] = useState([4]); // 存储树选择
const [id, setId] = useState('');
const { Search } = Input;
const [hoverItemIndex, setHoverItemIndex] = useState(0); // hover流程索引
const setRowClassName = record =>
record.userID === selectColor.userID ? styles.clickRowStyle : '';
// 用户表列名
......@@ -389,7 +390,18 @@ const UserManage = () => {
title: (
<div className={styles.title1}>
<span className={styles.titleText}>{org.text}</span>
<span className={styles.tip1}>
<span
className={classnames({
[styles.tip1]: true,
[styles.listHover]: org === hoverItemIndex,
})}
onMouseEnter={() => {
setHoverItemIndex(org);
}}
onMouseLeave={() => {
setHoverItemIndex('');
}}
>
<Tooltip title="" className={styles.fs1}>
<Dropdown overlay={orgButtonMenu}>
<PlusOutlined
......@@ -403,7 +415,6 @@ const UserManage = () => {
/>
</Dropdown>
</Tooltip>
<Dropdown overlay={orgButtonMenu1}>
<EllipsisOutlined
style={{ marginLeft: 10, fontSize: '20px' }}
......@@ -1316,6 +1327,7 @@ const UserManage = () => {
const addChange = e => {
e.domEvent.stopPropagation();
};
/** ***操作按钮**** */
// 机构操作
const orgButtonMenu = (
......@@ -1487,16 +1499,16 @@ const UserManage = () => {
{/* Modal弹框 */}
{/* 添加用户 */}
<AddUserModal
title={`在${orgTitle1}下添加用户`}
visible={userVisible}
orgID={orgID}
orgTitle1={orgTitle1}
onCancel={kee}
onSelect={() => onSelect([orgID])}
/>
{/* 添加下级机构 */}
<AddSubOrgModal
title={orgID === '-1' ? '添加顶级机构' : `在${orgTitle1}下添加机构`}
visible={addOrgVisible}
orgTitle1={orgTitle1}
orgID={orgID}
onCancel={() => setAddOrgVisible(false)}
// onSelect={onSelect}
......@@ -1504,10 +1516,9 @@ const UserManage = () => {
/>
{/* 编辑机构 */}
<EditOrgModal
title={`编辑${orgTitle1}`}
visible={editOrgVisible}
orgID={orgID}
orgTitle={orgTitle1}
orgTitle1={orgTitle1}
description={description}
onCancel={() => setEditOrgVisible(false)}
// onSelect={onSelect}
......
......@@ -196,6 +196,12 @@
font-size: 18px;
margin-left: 10px;
}
.listHover {
display: flex;
align-items: center;
justify-content: flex-end;
width: 100%;
}
.title1:hover {
.tip1 {
display: flex;
......
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