Commit 6d4877dc authored by Maofei94's avatar Maofei94

perf: 角色管理优化

parent d27c7e8d
@font-face {font-family: "iconfont";
src: url('iconfont.eot?t=1606814471866'); /* IE9 */
src: url('iconfont.ttf?t=1606814471866') format('truetype') /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.iconliulanqi:before {
content: "\e63b";
}
.iconliulanqi1:before {
content: "\e643";
}
.iconanzhuo1:before {
content: "\e63a";
}
.iconxiaochengxu:before {
content: "\e60e";
}
.iconcity:before {
content: "\e79c";
}
.iconanzhuo:before {
content: "\e687";
}
.iconCustomermanagement-fill:before {
content: "\e77c";
}
.iconaccount-fill:before {
content: "\e7aa";
}
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
padding: 10px; padding: 10px;
margin-top: 10px; margin-top: 10px;
flex-wrap: wrap; flex-wrap: wrap;
border: 1px solid gray; // border: 1px solid gray;
} }
.check{ .check{
flex-shrink: 0; flex-shrink: 0;
......
...@@ -54,7 +54,7 @@ const EditForm = props => { ...@@ -54,7 +54,7 @@ const EditForm = props => {
submit(); submit();
}; };
return ( return (
<div> <div style={{ marginTop: '10px' }}>
{(nodeType === 1 || nodeType === 2) && ( {(nodeType === 1 || nodeType === 2) && (
<Form <Form
form={form} form={form}
......
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
Input, Input,
Button, Button,
Spin, Spin,
Empty,
} from 'antd'; } from 'antd';
import { import {
FileAddTwoTone, FileAddTwoTone,
...@@ -27,6 +28,7 @@ import { ...@@ -27,6 +28,7 @@ import {
getRoleListPlain, getRoleListPlain,
} from '@/services/mobileConfig/api'; } from '@/services/mobileConfig/api';
import styles from './miniMenu.less'; import styles from './miniMenu.less';
import AddForm from './AddForm'; import AddForm from './AddForm';
import EditForm from './editForm'; import EditForm from './editForm';
import CheckList from './checkBox'; import CheckList from './checkBox';
...@@ -73,13 +75,14 @@ const MiniMenu = props => { ...@@ -73,13 +75,14 @@ const MiniMenu = props => {
// 更新树 // 更新树
const updateTrees = () => { const updateTrees = () => {
setLoading(true); setLoading(true);
// miniAppSiteTree({ // miniAppSiteTree({
// _version: 9999, // _version: 9999,
// _dc: new Date().getTime(), // _dc: new Date().getTime(),
// node: -2, // node: -2,
// userMode: 'super', // userMode: 'super',
// select: '', // select: '',
// }); // })
getMiniAppModuleTree({ getMiniAppModuleTree({
userMode: 'super', userMode: 'super',
}) })
...@@ -89,6 +92,7 @@ const MiniMenu = props => { ...@@ -89,6 +92,7 @@ const MiniMenu = props => {
const { data } = res; const { data } = res;
setLoading(false); setLoading(false);
const result = data[0].children[0].children[1].children; const result = data[0].children[0].children[1].children;
setTreeData(result); setTreeData(result);
console.log(result); console.log(result);
// 第一次加载,默认选择第一个组织 // 第一次加载,默认选择第一个组织
...@@ -255,14 +259,14 @@ const MiniMenu = props => { ...@@ -255,14 +259,14 @@ const MiniMenu = props => {
// 新增菜单组 // 新增菜单组
const addMenuGroupTip = val => { const addMenuGroupTip = val => {
console.log(val, 'addgroup'); console.log(val, 'addgroup');
setModalTitle(val.text); setModalTitle(`在${val.text}下新增菜单组`);
setNodeObj(val); setNodeObj(val);
setAddVisible(true); setAddVisible(true);
}; };
const rootAddGroup = () => { const rootAddGroup = () => {
setNodeObj(''); setNodeObj('');
// setNodeType(1); // setNodeType(1);
setModalTitle('最上级列表'); setModalTitle('新增最上级菜单组');
setAddType(1); setAddType(1);
setAddVisible(true); setAddVisible(true);
}; };
...@@ -270,11 +274,11 @@ const MiniMenu = props => { ...@@ -270,11 +274,11 @@ const MiniMenu = props => {
const addMenuTip = val => { const addMenuTip = val => {
console.log(val, 'add'); console.log(val, 'add');
setNodeObj(val); setNodeObj(val);
setModalTitle(val.text); setModalTitle(`在${val.text}下新增功能菜单`);
setAddTwoVisible(true); setAddTwoVisible(true);
}; };
const rootAdd = () => { const rootAdd = () => {
setModalTitle('最上级列表'); setModalTitle('新增最上级功能菜单');
setNodeObj(''); setNodeObj('');
// setNodeType(3); // setNodeType(3);
setAddType(3); setAddType(3);
...@@ -359,6 +363,7 @@ const MiniMenu = props => { ...@@ -359,6 +363,7 @@ const MiniMenu = props => {
setLoading(false); setLoading(false);
}); });
}; };
// 复选框选中值
const valueCallback = val => { const valueCallback = val => {
console.log(val, 'val'); console.log(val, 'val');
// relatedRoleCode // relatedRoleCode
...@@ -371,6 +376,13 @@ const MiniMenu = props => { ...@@ -371,6 +376,13 @@ const MiniMenu = props => {
}); });
setRoleList(arr2); setRoleList(arr2);
}; };
// 树的拖动
const handleDrop = info => {
console.log(info, 'info');
};
const handleDragEnter = info => {
console.log(info, 'info');
};
return ( return (
<Spin spinning={loading} tip="loading..."> <Spin spinning={loading} tip="loading...">
<div <div
...@@ -394,13 +406,13 @@ const MiniMenu = props => { ...@@ -394,13 +406,13 @@ const MiniMenu = props => {
[styles.tRight]: true, [styles.tRight]: true,
})} })}
> >
<Tooltip title="新增菜单组"> <Tooltip title="新增最上级菜单组">
<FolderAddTwoTone <FolderAddTwoTone
className={`${styles.icon1} ${styles.icon}`} className={`${styles.icon1} ${styles.icon}`}
onClick={() => rootAddGroup()} onClick={() => rootAddGroup()}
/> />
</Tooltip> </Tooltip>
<Tooltip title="新增功能菜单"> <Tooltip title="新增最上级功能菜单">
<FileAddTwoTone <FileAddTwoTone
onClick={() => rootAdd()} onClick={() => rootAdd()}
className={`${styles.icon2} ${styles.icon}`} className={`${styles.icon2} ${styles.icon}`}
...@@ -414,7 +426,10 @@ const MiniMenu = props => { ...@@ -414,7 +426,10 @@ const MiniMenu = props => {
onSelect={handleSelect} onSelect={handleSelect}
treeData={treeData.map(item => mapTree(item))} treeData={treeData.map(item => mapTree(item))}
blockNode blockNode
draggable
autoExpandParent autoExpandParent
onDrop={handleDrop}
onDragEnter={handleDragEnter}
selectedKeys={[menuID]} selectedKeys={[menuID]}
expandedKeys={[menuID]} expandedKeys={[menuID]}
/> />
...@@ -422,7 +437,7 @@ const MiniMenu = props => { ...@@ -422,7 +437,7 @@ const MiniMenu = props => {
</div> </div>
<Modal <Modal
visible={addVisible} visible={addVisible}
title={`在${modalTitle}下新增菜单组`} title={modalTitle}
bodyStyle={{ width: '100%', minHeight: '100px' }} bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: 80 }} style={{ top: 80 }}
width="600px" width="600px"
...@@ -430,6 +445,7 @@ const MiniMenu = props => { ...@@ -430,6 +445,7 @@ const MiniMenu = props => {
footer={null} footer={null}
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
maskClosable={false}
onCancel={() => setAddVisible(false)} onCancel={() => setAddVisible(false)}
> >
<AddForm <AddForm
...@@ -444,7 +460,7 @@ const MiniMenu = props => { ...@@ -444,7 +460,7 @@ const MiniMenu = props => {
</Modal> </Modal>
<Modal <Modal
visible={addTwoVisible} visible={addTwoVisible}
title={`在${modalTitle}下新增功能菜单`} title={modalTitle}
bodyStyle={{ bodyStyle={{
width: '100%', width: '100%',
minHeight: '100px', minHeight: '100px',
...@@ -457,6 +473,7 @@ const MiniMenu = props => { ...@@ -457,6 +473,7 @@ const MiniMenu = props => {
footer={null} footer={null}
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
maskClosable={false}
onCancel={() => setAddTwoVisible(false)} onCancel={() => setAddTwoVisible(false)}
> >
<AddForm <AddForm
...@@ -478,6 +495,7 @@ const MiniMenu = props => { ...@@ -478,6 +495,7 @@ const MiniMenu = props => {
destroyOnClose destroyOnClose
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
maskClosable={false}
onCancel={() => setDelVisible(false)} onCancel={() => setDelVisible(false)}
onOk={() => delMenu()} onOk={() => delMenu()}
confirmLoading={modalLoading} confirmLoading={modalLoading}
...@@ -489,12 +507,15 @@ const MiniMenu = props => { ...@@ -489,12 +507,15 @@ const MiniMenu = props => {
[styles.middle]: true, [styles.middle]: true,
})} })}
> >
{nodeType && ( 菜单配置
{nodeType ? (
<EditForm <EditForm
nodeType={nodeType} nodeType={nodeType}
info={info} info={info}
submitCallback={editSubmitCallback} submitCallback={editSubmitCallback}
/> />
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)} )}
</div> </div>
<div <div
......
...@@ -77,3 +77,8 @@ ...@@ -77,3 +77,8 @@
border: 1px solid #eee; border: 1px solid #eee;
padding: 10px; padding: 10px;
} }
:global{
.ant-tree .ant-tree-node-content-wrapper .ant-tree-iconEle .anticon-folder{
}
}
\ No newline at end of file
...@@ -36,6 +36,7 @@ import DelModal from './DelModal'; ...@@ -36,6 +36,7 @@ import DelModal from './DelModal';
import EditModal from './EditModal'; import EditModal from './EditModal';
import EditGroup from './EditGroup'; import EditGroup from './EditGroup';
import userStyles from '../UserManage.less'; import userStyles from '../UserManage.less';
import '@/assets/font/omsfont//iconfont.css';
const { Search } = Input; const { Search } = Input;
const placeholder = '请输入功能名称'; const placeholder = '请输入功能名称';
...@@ -184,10 +185,13 @@ const SiteManage = () => { ...@@ -184,10 +185,13 @@ const SiteManage = () => {
}); });
} }
if (item.visibleTitle === '手持系统') { if (item.visibleTitle === '手持系统') {
item.icon = <span className="iconfont iconanzhuo1" />;
newArr[0] = item; newArr[0] = item;
} } else if (item.visibleTitle === '小程序') {
if (item.visibleTitle === '小程序') { item.icon = <span className="iconfont iconxiaochengxu" />;
newArr[1] = item; newArr[1] = item;
} else {
item.icon = <span className="iconfont iconliulanqi" />;
} }
return ( return (
item.visibleTitle !== '其它角色' && item.visibleTitle !== '其它角色' &&
...@@ -197,11 +201,9 @@ const SiteManage = () => { ...@@ -197,11 +201,9 @@ const SiteManage = () => {
); );
}); });
arr2 = arr2.concat(newArr); arr2 = arr2.concat(newArr);
console.log(arr2, 'arr2');
let arr3 = arr2.map(item => { let arr3 = arr2.map(item => {
item.title = item.visibleTitle || ''; item.title = item.visibleTitle || '';
item.key = item.visibleValue || ''; item.key = item.visibleValue || '';
item.icon = <TeamOutlined />;
if (item.roleList && item.roleList.length > 0) { if (item.roleList && item.roleList.length > 0) {
item.roleList.map((itemRole, index) => { item.roleList.map((itemRole, index) => {
if (itemRole.roleList) { if (itemRole.roleList) {
......
.cardBox{ .cardBox{
min-height: calc(100vh - 74px); min-height: calc(100vh - 74px);
max-height: calc(100vh - 74px); max-height: calc(100vh - 74px);
// overflow-y: scroll; overflow-y: scroll;
overflow: auto; // overflow: auto;
overflow-x: hidden;
width: 300px; width: 300px;
left: 0; left: 0;
top: 0; top: 0;
...@@ -64,7 +65,7 @@ ...@@ -64,7 +65,7 @@
align-items: center; align-items: center;
// color:#1890FF; // color:#1890FF;
.ant-tree-switcher-line-icon{ .ant-tree-switcher-line-icon{
margin-left: 5px; // margin-left: 5px;
} }
} }
} }
...@@ -72,10 +73,10 @@ ...@@ -72,10 +73,10 @@
.hide{ .hide{
display: block; display: block;
position: absolute; position: absolute;
font-size: 20px; font-size: 18px;
color: #1890FF!important; color: #1890FF!important;
top: 45%; top: 45%;
right:0; right: -3px;
transform: translate(0%,-50%); transform: translate(0%,-50%);
z-index: 2; z-index: 2;
} }
......
.cardBox{ .cardBox{
min-height: calc(100vh - 75px); min-height: calc(100vh - 75px);
max-height: calc(100vh - 75px); max-height: calc(100vh - 75px);
overflow: auto; overflow-y: scroll;
overflow-x: hidden;
width: 300px; width: 300px;
left: 0; left: 0;
top: 0; top: 0;
...@@ -76,10 +77,10 @@ ...@@ -76,10 +77,10 @@
.hide{ .hide{
display: block; display: block;
position: absolute; position: absolute;
font-size: 20px; font-size: 18px;
color: #1890FF!important; color: #1890FF!important;
top: 45%; top: 45%;
right: 0; right: -3px;
transform: translate(0%,-50%); transform: translate(0%,-50%);
z-index: 2; z-index: 2;
} }
......
...@@ -40,7 +40,7 @@ const EditForm = props => { ...@@ -40,7 +40,7 @@ const EditForm = props => {
submit(); submit();
}; };
return ( return (
<div> <div style={{ marginTop: '10px' }}>
{nodeType === 1 && ( {nodeType === 1 && (
<Form <Form
form={form} form={form}
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { notification, Tree, Tooltip, Modal, Spin } from 'antd'; import { notification, Tree, Tooltip, Modal, Spin, Empty } from 'antd';
import { import {
FileAddTwoTone, FileAddTwoTone,
FolderAddTwoTone, FolderAddTwoTone,
...@@ -173,14 +173,14 @@ const MiniMenu = props => { ...@@ -173,14 +173,14 @@ const MiniMenu = props => {
// 新增菜单组 // 新增菜单组
const addMenuGroupTip = (val, e) => { const addMenuGroupTip = (val, e) => {
e.stopPropagation(); e.stopPropagation();
setModalTitle(val.text); setModalTitle(`在${val.text}下新增菜单组`);
setNodeObj(val); setNodeObj(val);
setAddType(2); setAddType(2);
setAddVisible(true); setAddVisible(true);
}; };
const rootAddGroup = () => { const rootAddGroup = () => {
setNodeObj(''); setNodeObj('');
setModalTitle('最上级列表'); setModalTitle('新增最上级菜单组');
setAddType(2); setAddType(2);
setAddVisible(true); setAddVisible(true);
}; };
...@@ -188,12 +188,12 @@ const MiniMenu = props => { ...@@ -188,12 +188,12 @@ const MiniMenu = props => {
const addMenuTip = (val, e) => { const addMenuTip = (val, e) => {
e.stopPropagation(); e.stopPropagation();
setNodeObj(val); setNodeObj(val);
setModalTitle(val.text); setModalTitle(`在${val.text}下新增功能菜单`);
setAddType(1); setAddType(1);
setAddTwoVisible(true); setAddTwoVisible(true);
}; };
const rootAdd = () => { const rootAdd = () => {
setModalTitle('最上级列表'); setModalTitle('新增最上级功能菜单');
setNodeObj(''); setNodeObj('');
setAddType(1); setAddType(1);
setAddTwoVisible(true); setAddTwoVisible(true);
...@@ -302,13 +302,13 @@ const MiniMenu = props => { ...@@ -302,13 +302,13 @@ const MiniMenu = props => {
> >
菜单列表 菜单列表
<div className={classnames(styles.tRight)}> <div className={classnames(styles.tRight)}>
<Tooltip title="新增菜单组"> <Tooltip title="新增最上级菜单组">
<FolderAddTwoTone <FolderAddTwoTone
className={`${styles.icon1} ${styles.icon}`} className={`${styles.icon1} ${styles.icon}`}
onClick={() => rootAddGroup()} onClick={() => rootAddGroup()}
/> />
</Tooltip> </Tooltip>
<Tooltip title="新增功能菜单"> <Tooltip title="新增最上级功能菜单">
<FileAddTwoTone <FileAddTwoTone
onClick={() => rootAdd()} onClick={() => rootAdd()}
className={`${styles.icon2} ${styles.icon}`} className={`${styles.icon2} ${styles.icon}`}
...@@ -330,7 +330,7 @@ const MiniMenu = props => { ...@@ -330,7 +330,7 @@ const MiniMenu = props => {
</div> </div>
<Modal <Modal
visible={addVisible} visible={addVisible}
title={`在${modalTitle}下新增菜单组`} title={modalTitle}
bodyStyle={{ width: '100%', minHeight: '100px' }} bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: 80 }} style={{ top: 80 }}
width="600px" width="600px"
...@@ -338,6 +338,7 @@ const MiniMenu = props => { ...@@ -338,6 +338,7 @@ const MiniMenu = props => {
footer={null} footer={null}
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
maskClosable={false}
onCancel={() => setAddVisible(false)} onCancel={() => setAddVisible(false)}
onConfirm={() => { onConfirm={() => {
submitCallback(); submitCallback();
...@@ -353,12 +354,13 @@ const MiniMenu = props => { ...@@ -353,12 +354,13 @@ const MiniMenu = props => {
</Modal> </Modal>
<Modal <Modal
visible={addTwoVisible} visible={addTwoVisible}
title={`在${modalTitle}下新增功能菜单`} title={modalTitle}
bodyStyle={{ width: '100%', minHeight: '100px' }} bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: 80 }} style={{ top: 80 }}
width="600px" width="600px"
destroyOnClose destroyOnClose
footer={null} footer={null}
maskClosable={false}
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
onCancel={() => setAddTwoVisible(false)} onCancel={() => setAddTwoVisible(false)}
...@@ -380,6 +382,7 @@ const MiniMenu = props => { ...@@ -380,6 +382,7 @@ const MiniMenu = props => {
destroyOnClose destroyOnClose
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
maskClosable={false}
onCancel={() => setDelVisible(false)} onCancel={() => setDelVisible(false)}
onOk={() => delMenu()} onOk={() => delMenu()}
confirmLoading={modalLoading} confirmLoading={modalLoading}
...@@ -391,13 +394,16 @@ const MiniMenu = props => { ...@@ -391,13 +394,16 @@ const MiniMenu = props => {
[styles.middle]: true, [styles.middle]: true,
})} })}
> >
{nodeType && ( 菜单配置
{nodeType ? (
<EditForm <EditForm
nodeType={nodeType} nodeType={nodeType}
info={info} info={info}
configFiles={configFiles} configFiles={configFiles}
submitCallback={editSubmitCallback} submitCallback={editSubmitCallback}
/> />
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)} )}
</div> </div>
<div <div
......
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