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

fix: '用户管理菜单树'

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