module-menu 0.1.36 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.html +22 -0
- package/dist/static/admin_logo.436045b7.svg +48 -0
- package/dist/static/admin_slogo.cc12b7d8.svg +48 -0
- package/dist/static/alert_logo.461428a2.svg +26 -0
- package/dist/static/alert_slogo.d7000af9.svg +26 -0
- package/dist/static/dataManager_logo.e27b3137.svg +42 -0
- package/dist/static/dataanalytic_logo.76dd2fda.svg +44 -0
- package/dist/static/dataanalytic_slogo.69fa2eee.svg +47 -0
- package/dist/static/dataasset_logo.9f1e48b2.svg +52 -0
- package/dist/static/dataasset_slogo.84d16e23.svg +52 -0
- package/dist/static/datacollection_logo.348102ed.svg +70 -0
- package/dist/static/datacollection_slogo.743ac405.svg +70 -0
- package/dist/static/datadev_logo.e57f9325.svg +26 -0
- package/dist/static/datadev_slogo.db9ce68f.svg +26 -0
- package/dist/static/datalabel_slogo.62e8f571.svg +26 -0
- package/dist/static/datamanager_slogo.8028bc5f.svg +42 -0
- package/dist/static/dataservice_logo.9a737452.svg +209 -0
- package/dist/static/dataservice_slogo.b9f136dc.svg +209 -0
- package/dist/static/datasharing_logo.6c828c61.svg +28 -0
- package/dist/static/datasharing_slogo.d0ccda7a.svg +28 -0
- package/dist/static/home.c9f8fbce.svg +12 -0
- package/dist/static/ic_gonggongmokuai_m.870acd57.svg +5 -0
- package/dist/static/ic_shujuhuiju_m.aceecaa1.svg +5 -0
- package/dist/static/ic_shujukaifa_m.a1b978b5.svg +15 -0
- package/dist/static/ic_shujukaifang_m.205ec04f.svg +5 -0
- package/dist/static/ic_shujuyingyong_m.4fed335c.svg +5 -0
- package/dist/static/ic_shujuzhili_m.9762b4f0.svg +5 -0
- package/dist/static/menuIcon.a281e69f.svg +1 -0
- package/dist/static/messageCenter.87236800.svg +1 -0
- package/dist/static/metadata_logo.45d05339.svg +25 -0
- package/dist/static/metadata_slogo.64e545f1.svg +25 -0
- package/dist/static/operate_logo.2a7ee3a9.svg +63 -0
- package/dist/static/operate_slogo.b46625a9.svg +63 -0
- package/dist/static/personalCenter.40f40e04.svg +16 -0
- package/dist/static/quality_logo.ef4e102a.svg +26 -0
- package/dist/static/quality_slogo.3557a527.svg +26 -0
- package/dist/static/systemManage.cc20d139.svg +16 -0
- package/dist/static/workorder_slogo.72b76127.svg +54 -0
- package/dist/umi.css +1 -0
- package/dist/umi.js +1 -0
- package/package.json +3 -2
- package/src/.umi/.cache/babel-loader/0cf458567cfdaa4bcc98ad17f126d505.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/172487ddf659c5e5ed4c4cc43ab177d9.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/1d496c36e309d0a102e0dac5294c7868.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/1d61f257af04e239d0ea836688a06494.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/2778829a08334bd378a2fdd98391a43c.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/2a52a607066a02cb72bc9f72140998a3.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/3076ff60b33bd715e63da884712660ff.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/35fcc056042728656dfce9dd67b6bbc6.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/382b0d400111ab0b80c259db1aa480ae.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/38966e8352b47ea30f67e98ce8dfbce1.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/61ed376d37914f796e6ee3e7206c53bd.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/66357c799ae9dc8d0fdcab0abb98e3be.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/713975e5f8979c076b77105bcc664433.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/737e9e5ca4f0aa3883a7d8623a1560f3.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/78278b5a6929a5a79cdf84421140a995.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/80e5871bc78e732263638960b11de875.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/8ce21ab4f5fb95407c2f635f6e0e9713.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/8e6fb4487c51c552ca584b2f53dc3810.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/8e7e40a2e6770c8f279024db25bc8fcf.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/91ab7e7c6e4b220534b7b8dde5825001.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/956e66fcc9441e07247197b2ecf6b440.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/975afa5d1bc90c4c8f37aa402468675d.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/a320cf81322ac1c1440132f0a1713345.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/ae4616202782e31e14cf4b17641b1fe6.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/b501b37dd395c6fe3df5b9f9f2217710.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/c052495a4884502f57654ee834ae0a85.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/c1062507fd6703590141de4c872c47de.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/c14e03befcbd217f8aa57a7a7600590c.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/c84d64ffe481659b495089907db80c2c.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/d55b6d19818be24dbc615a2bf90f5c53.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/de423f345d70a7488000626c81305752.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/ec3a1cda1f0c32a803e9a9140d97110d.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/f5c49dbe2f3c9fbba9c8b04c3254d7bb.json.gz +0 -0
- package/src/.umi/core/history.ts +21 -0
- package/src/.umi/core/plugin.ts +8 -0
- package/src/.umi/core/pluginConfig.d.ts +304 -0
- package/src/.umi/core/pluginRegister.ts +15 -0
- package/src/.umi/core/polyfill.ts +4 -0
- package/src/.umi/core/routes.ts +24 -0
- package/src/.umi/core/umiExports.ts +7 -0
- package/src/.umi/plugin-helmet/exports.ts +3 -0
- package/src/.umi/plugin-initial-state/Provider.tsx +37 -0
- package/src/.umi/plugin-initial-state/exports.ts +7 -0
- package/src/.umi/plugin-initial-state/models/initialState.ts +2 -0
- package/src/.umi/plugin-initial-state/runtime.tsx +13 -0
- package/src/.umi/plugin-model/Provider.tsx +39 -0
- package/src/.umi/plugin-model/helpers/constant.tsx +4 -0
- package/src/.umi/plugin-model/helpers/dispatcher.tsx +19 -0
- package/src/.umi/plugin-model/helpers/executor.tsx +83 -0
- package/src/.umi/plugin-model/runtime.tsx +12 -0
- package/src/.umi/plugin-model/useModel.tsx +71 -0
- package/src/.umi/plugin-request/request.ts +278 -0
- package/src/.umi/umi.ts +58 -0
- package/src/assets/muluguanli_slogo.png +0 -0
- package/src/assets/ziyuanguanli_slogo.png +0 -0
- package/src/pages/ModuleMenu/constData.jsx +15 -5
- package/src/pages/ModuleMenu/index.jsx +42 -65
- package/src/pages/ModuleMenu/index.less +109 -90
- package/src/pages/ModuleUser/index.jsx +103 -25
- package/src/pages/ModuleUser/index.less +46 -34
- package/src/pages/util/axios.js +35 -10
- package/src/pages/util/config.js +4 -8
- package/src/pages/util/permessionUtils.js +1 -19
- package/src/pages/util/userInfo.js +64 -39
|
@@ -2,27 +2,55 @@ import { useState, useEffect, useRef, useMemo } from 'react';
|
|
|
2
2
|
import { Popconfirm, message, Popover } from 'antd';
|
|
3
3
|
import { menuList as menuListInit, menuIconSrc, sysNameMap } from './constData';
|
|
4
4
|
import HeaderDropdown from '../ModuleUser/HeaderDropdown';
|
|
5
|
+
import Axios from '../util/axios';
|
|
6
|
+
import _ from 'lodash';
|
|
5
7
|
import './index.less';
|
|
6
8
|
|
|
7
|
-
const ModuleMenu = ({ sysName }) => {
|
|
9
|
+
const ModuleMenu = ({ sysName, stash }) => {
|
|
10
|
+
// stash = 'ii';
|
|
8
11
|
const [sessionMenu, setsessionMenu] = useState([]);
|
|
9
12
|
const [showMenuList, setshowMenuList] = useState(false);
|
|
10
13
|
const [menuList, setMenuList] = useState([]);
|
|
14
|
+
const [menuListServer, setMenuListServer] = useState([]);
|
|
11
15
|
|
|
12
16
|
useEffect(() => {
|
|
13
17
|
let newSessionMenu = getSessionMenu();
|
|
14
18
|
setsessionMenu(newSessionMenu);
|
|
15
19
|
let newMenuList = getNewMenuList();
|
|
16
|
-
// let newMenuList = menuListInit;
|
|
17
20
|
setMenuList(newMenuList);
|
|
18
21
|
}, []);
|
|
19
22
|
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const getUserMenusList = async () => {
|
|
24
|
+
const res = await Axios(
|
|
25
|
+
'get',
|
|
26
|
+
'/admin-api/system/user/getUserMenusList',
|
|
27
|
+
'',
|
|
28
|
+
{},
|
|
29
|
+
);
|
|
30
|
+
let menuListServers = [];
|
|
31
|
+
if (res.data.code === 0) {
|
|
32
|
+
menuListServers =
|
|
33
|
+
res.data.data &&
|
|
34
|
+
res.data.data.map((item) => {
|
|
35
|
+
return {
|
|
36
|
+
...item,
|
|
37
|
+
path: item.path.indexOf('/') !== -1 ? item.path : '/' + item.path,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return menuListServers;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const getSessionMenu = async () => {
|
|
45
|
+
if (!stash) {
|
|
46
|
+
const menuObj = JSON.parse(sessionStorage.getItem('bigdata-menu'));
|
|
47
|
+
if (menuObj) {
|
|
48
|
+
return menuObj.content || [];
|
|
49
|
+
}
|
|
50
|
+
return [];
|
|
51
|
+
} else {
|
|
52
|
+
return (await getUserMenusList()) || [];
|
|
24
53
|
}
|
|
25
|
-
return [];
|
|
26
54
|
};
|
|
27
55
|
|
|
28
56
|
// 获取系统logo及title
|
|
@@ -36,39 +64,6 @@ const ModuleMenu = ({ sysName }) => {
|
|
|
36
64
|
return logoAndTitle;
|
|
37
65
|
};
|
|
38
66
|
|
|
39
|
-
/**
|
|
40
|
-
* 判断第三方服务是否有对应服务的菜单权限
|
|
41
|
-
* @param {*} authMenus
|
|
42
|
-
* @param {*} rootMenuPath
|
|
43
|
-
*/
|
|
44
|
-
const judgeThirdPartyServiceIsHaveMenus = (authMenus, rootMenuPath) => {
|
|
45
|
-
let dsMenus = [];
|
|
46
|
-
if (
|
|
47
|
-
typeof authMenus !== 'undefined' &&
|
|
48
|
-
authMenus !== null &&
|
|
49
|
-
authMenus.length > 0
|
|
50
|
-
) {
|
|
51
|
-
const rootMenus = authMenus.filter((item) => {
|
|
52
|
-
const { parentId, type, path } = item;
|
|
53
|
-
console.log('object', path, rootMenuPath);
|
|
54
|
-
if (parentId === -1 && type === '3' && path === rootMenuPath) {
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
return false;
|
|
58
|
-
});
|
|
59
|
-
if (
|
|
60
|
-
rootMenus &&
|
|
61
|
-
Object.keys(rootMenus).length > 0 &&
|
|
62
|
-
rootMenus[0].children
|
|
63
|
-
) {
|
|
64
|
-
dsMenus = rootMenus[0].children;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (!dsMenus || dsMenus.length === 0) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
return true;
|
|
71
|
-
};
|
|
72
67
|
// 跳转各个模块
|
|
73
68
|
const toModulePage = (nameStr) => {
|
|
74
69
|
if (!sessionMenu || sessionMenu.length === 0) {
|
|
@@ -76,72 +71,54 @@ const ModuleMenu = ({ sysName }) => {
|
|
|
76
71
|
message.warning('没有获取到菜单列表,请联系管理员添加权限');
|
|
77
72
|
return;
|
|
78
73
|
}
|
|
79
|
-
console.log('nameStr', nameStr);
|
|
80
74
|
let thirdPartyServiceJumpPath = ''; // 第三方服务跳转路径
|
|
81
|
-
let thirdPartyServiceRootMenuPath = ''; // 第三方服务根菜单路径
|
|
82
75
|
switch (nameStr) {
|
|
83
76
|
case '数据集成':
|
|
84
77
|
thirdPartyServiceJumpPath = '/datacollect/';
|
|
85
|
-
thirdPartyServiceRootMenuPath = '/datacollection';
|
|
86
78
|
break;
|
|
87
79
|
case '数据治理':
|
|
88
80
|
thirdPartyServiceJumpPath = '/datamanage/';
|
|
89
|
-
thirdPartyServiceRootMenuPath = '/dataManager';
|
|
90
81
|
break;
|
|
91
82
|
case '元数据管理':
|
|
92
83
|
thirdPartyServiceJumpPath = '/metadata/';
|
|
93
|
-
thirdPartyServiceRootMenuPath = '/metadata';
|
|
94
84
|
break;
|
|
95
85
|
case '数据质量':
|
|
96
86
|
thirdPartyServiceJumpPath = '/quality/';
|
|
97
|
-
thirdPartyServiceRootMenuPath = '/quality/';
|
|
98
87
|
break;
|
|
99
88
|
case '离线开发':
|
|
100
89
|
thirdPartyServiceJumpPath = '/datadev/';
|
|
101
|
-
thirdPartyServiceRootMenuPath = '/datadev/';
|
|
102
90
|
break;
|
|
103
91
|
case '实时开发':
|
|
104
92
|
thirdPartyServiceJumpPath = '/dataanalytic/';
|
|
105
|
-
thirdPartyServiceRootMenuPath = '/dataanalytic';
|
|
106
93
|
break;
|
|
107
94
|
case '数据服务':
|
|
108
95
|
thirdPartyServiceJumpPath = '/dataservice/';
|
|
109
|
-
thirdPartyServiceRootMenuPath = '/dataservice';
|
|
110
96
|
break;
|
|
111
97
|
case '数据资产':
|
|
112
98
|
thirdPartyServiceJumpPath = '/dataasset/';
|
|
113
|
-
thirdPartyServiceRootMenuPath = '/dataasset';
|
|
114
99
|
break;
|
|
115
100
|
case '数据共享':
|
|
116
101
|
thirdPartyServiceJumpPath = '/datasharing/';
|
|
117
|
-
thirdPartyServiceRootMenuPath = '/datasharing';
|
|
118
102
|
break;
|
|
119
103
|
case '运维中心':
|
|
120
104
|
thirdPartyServiceJumpPath = '/operate/';
|
|
121
|
-
thirdPartyServiceRootMenuPath = '/operate';
|
|
122
105
|
break;
|
|
123
106
|
case '消息中心':
|
|
124
107
|
thirdPartyServiceJumpPath = '/alert/';
|
|
125
|
-
thirdPartyServiceRootMenuPath = '/alert';
|
|
126
108
|
break;
|
|
127
109
|
case '数据安全':
|
|
128
110
|
thirdPartyServiceJumpPath = '/datasecurity/';
|
|
129
|
-
|
|
111
|
+
break;
|
|
112
|
+
case '目录管理':
|
|
113
|
+
thirdPartyServiceJumpPath = '/admin-ui/catalog/menuClassify/list';
|
|
114
|
+
break;
|
|
115
|
+
case '资源管理':
|
|
116
|
+
thirdPartyServiceJumpPath = '/admin-ui/resource/tableResource/list';
|
|
130
117
|
break;
|
|
131
118
|
default:
|
|
132
119
|
break;
|
|
133
120
|
}
|
|
134
121
|
// 判断第三方服务是否有对应服务的菜单权限
|
|
135
|
-
if (
|
|
136
|
-
!judgeThirdPartyServiceIsHaveMenus(
|
|
137
|
-
sessionMenu,
|
|
138
|
-
thirdPartyServiceRootMenuPath,
|
|
139
|
-
)
|
|
140
|
-
) {
|
|
141
|
-
message.destroy();
|
|
142
|
-
message.warning('您没有权限,请联系管理员添加权限。');
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
122
|
window.location.href = thirdPartyServiceJumpPath;
|
|
146
123
|
};
|
|
147
124
|
// 跳转首页
|
|
@@ -152,7 +129,7 @@ const ModuleMenu = ({ sysName }) => {
|
|
|
152
129
|
};
|
|
153
130
|
const getNewMenuList = () => {
|
|
154
131
|
const sessionMenu = getSessionMenu();
|
|
155
|
-
let newMenuList =
|
|
132
|
+
let newMenuList = _.cloneDeep(menuListInit(stash));
|
|
156
133
|
if (sessionMenu) {
|
|
157
134
|
const pathList = sessionMenu.map((item) => item.path);
|
|
158
135
|
// 过滤掉没有权限的子菜单(PS:如果模块下面子菜单都没有,则不显示该模块)
|
|
@@ -1,90 +1,109 @@
|
|
|
1
|
-
.menu_list_content{
|
|
2
|
-
border: 1px solid #E9E9E9;
|
|
3
|
-
z-index: 2;
|
|
4
|
-
float: left;
|
|
5
|
-
position: fixed;
|
|
6
|
-
top: 50px;
|
|
7
|
-
left:0;
|
|
8
|
-
background-color: #FFF;
|
|
9
|
-
box-shadow: rgba(0, 0, 0, 0.2) 1px 2px 10px;
|
|
10
|
-
padding-left: 35px;
|
|
11
|
-
padding-bottom: 35px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
1
|
+
.menu_list_content {
|
|
2
|
+
border: 1px solid #E9E9E9;
|
|
3
|
+
z-index: 2;
|
|
4
|
+
float: left;
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: 50px;
|
|
7
|
+
left: 0;
|
|
8
|
+
background-color: #FFF;
|
|
9
|
+
box-shadow: rgba(0, 0, 0, 0.2) 1px 2px 10px;
|
|
10
|
+
padding-left: 35px;
|
|
11
|
+
padding-bottom: 35px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.cardLine {
|
|
15
|
+
padding: 5px 0px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.iconPad {
|
|
19
|
+
width: 16px;
|
|
20
|
+
height: 16px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.textPad {
|
|
24
|
+
padding-left: 10px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.leftMenu {
|
|
28
|
+
width: 100px;
|
|
29
|
+
float: left;
|
|
30
|
+
color: rgba(0, 0, 0, 0.85);
|
|
31
|
+
font-size: 16px;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
text-align: left;
|
|
34
|
+
font-weight: 400;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.rightMenu {
|
|
38
|
+
width: 460px;
|
|
39
|
+
float: left;
|
|
40
|
+
vertical-align: middle;
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
color: rgba(0, 0, 0, 0.65);
|
|
43
|
+
font-weight: 400;
|
|
44
|
+
margin-left: 15px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.childMenu:hover {
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
color: #4091F7;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.childMenu {
|
|
53
|
+
width: 29%;
|
|
54
|
+
display: inline-block;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.middle {
|
|
58
|
+
vertical-align: middle;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.middle:hover {
|
|
62
|
+
color: #4091F7;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.menuPopupAndTitle {
|
|
66
|
+
display: flex;
|
|
67
|
+
justify-content: flex-start;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.menuIcon {
|
|
71
|
+
text-align: center;
|
|
72
|
+
line-height: 49px;
|
|
73
|
+
display: inline-block;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
width: 60px;
|
|
76
|
+
height: 49px;
|
|
77
|
+
background-color: #4091F7;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.menuIcon_img {
|
|
81
|
+
height: 25px;
|
|
82
|
+
width: 25px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.menu_title_content {
|
|
86
|
+
height: 32px;
|
|
87
|
+
margin: 0 0 0 12px;
|
|
88
|
+
font-weight: 600;
|
|
89
|
+
font-size: 18px;
|
|
90
|
+
line-height: 49px;
|
|
91
|
+
vertical-align: middle;
|
|
92
|
+
animation: pro-layout-title-hide .3s;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.menu_title_content_img {
|
|
96
|
+
height: 32px;
|
|
97
|
+
width: 32px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.menu_title {
|
|
101
|
+
color: #1890ff;
|
|
102
|
+
height: 32px;
|
|
103
|
+
margin: 0 0 0 12px;
|
|
104
|
+
font-weight: 600;
|
|
105
|
+
font-size: 18px;
|
|
106
|
+
line-height: 32px;
|
|
107
|
+
vertical-align: middle;
|
|
108
|
+
animation: pro-layout-title-hide .3s;
|
|
109
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { Popconfirm, message, Dropdown } from 'antd';
|
|
1
|
+
import React, { Component, useEffect, useState } from 'react';
|
|
2
|
+
import { Popconfirm, message, Dropdown, Button, Select } from 'antd';
|
|
3
3
|
import { userMenuIcon } from './constData';
|
|
4
4
|
import {
|
|
5
5
|
HomeOutlined,
|
|
@@ -9,39 +9,67 @@ import {
|
|
|
9
9
|
import { Spin, Menu, Avatar } from 'antd';
|
|
10
10
|
import HeaderDropdown from './HeaderDropdown';
|
|
11
11
|
import Axios from '../util/axios';
|
|
12
|
+
import getStore, { getUserName } from '../util/userInfo';
|
|
12
13
|
import './index.less';
|
|
13
|
-
|
|
14
|
+
// stash存在则为一体化,否则为轻量级
|
|
15
|
+
const ModuleUser = ({ stash }) => {
|
|
16
|
+
const [tenantList, setTenantList] = useState([]);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (stash) {
|
|
19
|
+
getTenantList();
|
|
20
|
+
}
|
|
21
|
+
}, []);
|
|
14
22
|
const handleClickmenu = (url) => {
|
|
15
23
|
window.location.href = url;
|
|
16
24
|
};
|
|
25
|
+
|
|
17
26
|
const { PersonalCenterSrc, MessageCenterSrc, SystemManageSrc, LogoutSrc } =
|
|
18
27
|
userMenuIcon;
|
|
19
|
-
const isHaveSystemManagementPermission = sessionStorage.getItem(
|
|
20
|
-
'bigdata-isHaveSystemManagementPermission',
|
|
21
|
-
);
|
|
22
|
-
const DEFAULT_LOGOUT_URL = '/#/login';
|
|
23
28
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
const isHaveSystemManagementPermission = stash
|
|
30
|
+
? true
|
|
31
|
+
: sessionStorage.getItem('bigdata-isHaveSystemManagementPermission');
|
|
32
|
+
|
|
33
|
+
const DEFAULT_LOGOUT_URL = !stash ? '/#/login' : '/admin-ui/login';
|
|
34
|
+
|
|
35
|
+
// 跳转服务门户
|
|
36
|
+
const jumpToExterHome = () => {
|
|
37
|
+
handleClickmenu('/dataadmin/#/index');
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const curTenantId = stash ? getStore({ name: 'tenantId' }) : '';
|
|
41
|
+
const curTenantName = stash ? getStore({ name: 'tenantName' }) : '';
|
|
42
|
+
|
|
43
|
+
const getTenantList = () => {
|
|
44
|
+
Axios('get', '/admin-api/system/user/getUserTenant', '', {})
|
|
45
|
+
.then((res) => {
|
|
46
|
+
if (res.data.code === 0) {
|
|
47
|
+
let tenantLists =
|
|
48
|
+
res.data.data &&
|
|
49
|
+
res.data.data.map((item) => {
|
|
50
|
+
return {
|
|
51
|
+
id: item.id,
|
|
52
|
+
value: item.id,
|
|
53
|
+
label: item.name,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
setTenantList(tenantLists || []);
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
.catch((e) => console.log('e', e));
|
|
37
60
|
};
|
|
61
|
+
|
|
38
62
|
// 退出登录
|
|
39
63
|
const logout = () => {
|
|
40
|
-
|
|
64
|
+
const logoutUrl = !stash
|
|
65
|
+
? '/auth/token/logout'
|
|
66
|
+
: '/admin-api/system/auth/logout';
|
|
67
|
+
const logouType = !stash ? 'delete' : 'post';
|
|
68
|
+
Axios(logouType, logoutUrl, '', {})
|
|
41
69
|
.then(() => {
|
|
42
70
|
console.log('退出登录接口调用成功');
|
|
43
|
-
|
|
44
|
-
|
|
71
|
+
localStorage.clear();
|
|
72
|
+
sessionStorage.clear();
|
|
45
73
|
window.location.href = DEFAULT_LOGOUT_URL;
|
|
46
74
|
})
|
|
47
75
|
.catch((error) => {
|
|
@@ -49,11 +77,39 @@ const ModuleUser = () => {
|
|
|
49
77
|
message.error('服务器错误,请稍后重试');
|
|
50
78
|
});
|
|
51
79
|
};
|
|
80
|
+
|
|
81
|
+
// 切换租户改缓存、调接口、刷界面
|
|
82
|
+
const handleChangeTenant = (e) => {
|
|
83
|
+
let token = getStore({ name: 'access_token' });
|
|
84
|
+
Axios(
|
|
85
|
+
'get',
|
|
86
|
+
`/admin-api/system/auth/setRedisTokenOfTenant?token=${token}&tenantId=${e}`,
|
|
87
|
+
'',
|
|
88
|
+
{},
|
|
89
|
+
)
|
|
90
|
+
.then((res) => {
|
|
91
|
+
if (res.data.code === 0) {
|
|
92
|
+
console.log('接口调用成功');
|
|
93
|
+
window.localStorage.setItem('curTenantId', e);
|
|
94
|
+
window.localStorage.setItem(
|
|
95
|
+
'curTenantName',
|
|
96
|
+
tenantList.find((item) => item.id === e)?.label,
|
|
97
|
+
);
|
|
98
|
+
window.location.reload();
|
|
99
|
+
} else {
|
|
100
|
+
message.warning(res.data.msg || '租户切换失败');
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
.catch((e) => console.log('e', e));
|
|
104
|
+
};
|
|
105
|
+
|
|
52
106
|
const menu = (
|
|
53
107
|
<Menu className="menu" selectedKeys={[]}>
|
|
54
108
|
<Menu.Item
|
|
55
109
|
key="personalCenter"
|
|
56
|
-
onClick={() =>
|
|
110
|
+
onClick={() =>
|
|
111
|
+
handleClickmenu(!stash ? '/#/info/index' : '/admin-ui/user/profile')
|
|
112
|
+
}
|
|
57
113
|
>
|
|
58
114
|
<img
|
|
59
115
|
src={PersonalCenterSrc}
|
|
@@ -65,7 +121,13 @@ const ModuleUser = () => {
|
|
|
65
121
|
{isHaveSystemManagementPermission && (
|
|
66
122
|
<Menu.Item
|
|
67
123
|
key="systemManage"
|
|
68
|
-
onClick={() =>
|
|
124
|
+
onClick={() =>
|
|
125
|
+
handleClickmenu(
|
|
126
|
+
!stash
|
|
127
|
+
? '/#/admin/user/index'
|
|
128
|
+
: '/admin-ui/bpm/manager/user-group',
|
|
129
|
+
)
|
|
130
|
+
}
|
|
69
131
|
>
|
|
70
132
|
<img
|
|
71
133
|
src={SystemManageSrc}
|
|
@@ -85,8 +147,24 @@ const ModuleUser = () => {
|
|
|
85
147
|
</Menu.Item>
|
|
86
148
|
</Menu>
|
|
87
149
|
);
|
|
150
|
+
|
|
88
151
|
return (
|
|
89
152
|
<div className="right">
|
|
153
|
+
{stash && [
|
|
154
|
+
<Button type="link" onClick={jumpToExterHome}>
|
|
155
|
+
服务门户
|
|
156
|
+
</Button>,
|
|
157
|
+
<Select
|
|
158
|
+
defaultValue={curTenantId}
|
|
159
|
+
className="right-select"
|
|
160
|
+
style={{
|
|
161
|
+
width: 150,
|
|
162
|
+
border: 'none',
|
|
163
|
+
}}
|
|
164
|
+
onChange={handleChangeTenant}
|
|
165
|
+
options={tenantList}
|
|
166
|
+
/>,
|
|
167
|
+
]}
|
|
90
168
|
{getUserName() ? (
|
|
91
169
|
<HeaderDropdown overlay={menu}>
|
|
92
170
|
<span style={{ display: 'inline-block', marginLeft: '12px' }}>
|
|
@@ -1,42 +1,54 @@
|
|
|
1
1
|
.right {
|
|
2
|
+
display: flex;
|
|
3
|
+
float: right;
|
|
4
|
+
height: 48px;
|
|
5
|
+
margin-left: auto;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
align-items: center;
|
|
8
|
+
padding-right: 30px;
|
|
9
|
+
|
|
10
|
+
.action {
|
|
2
11
|
display: flex;
|
|
3
|
-
float: right;
|
|
4
|
-
height: 48px;
|
|
5
|
-
margin-left: auto;
|
|
6
|
-
overflow: hidden;
|
|
7
12
|
align-items: center;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
transition: all 0.3s;
|
|
16
|
-
> span {
|
|
17
|
-
vertical-align: middle;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
.search {
|
|
21
|
-
padding: 0 12px;
|
|
22
|
-
&:hover {
|
|
23
|
-
background: transparent;
|
|
24
|
-
}
|
|
13
|
+
height: 48px;
|
|
14
|
+
padding: 0 12px;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
transition: all 0.3s;
|
|
17
|
+
|
|
18
|
+
>span {
|
|
19
|
+
vertical-align: middle;
|
|
25
20
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.search {
|
|
24
|
+
padding: 0 12px;
|
|
25
|
+
|
|
26
|
+
&:hover {
|
|
27
|
+
background: transparent;
|
|
33
28
|
}
|
|
34
29
|
}
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
|
|
31
|
+
.account {
|
|
32
|
+
.avatar {
|
|
37
33
|
margin-right: 8px;
|
|
34
|
+
// color: @primary-color;
|
|
35
|
+
vertical-align: top;
|
|
36
|
+
background: rgba(255, 255, 255, 0.85);
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:global(.right-select> .ant-select-selector) {
|
|
42
|
+
border: none !important;
|
|
43
|
+
box-shadow: none !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.menu {
|
|
47
|
+
:global(.anticon) {
|
|
48
|
+
margin-right: 8px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:global(.ant-dropdown-menu-item) {
|
|
52
|
+
min-width: 160px;
|
|
53
|
+
}
|
|
54
|
+
}
|