module-menu 0.1.36 → 0.2.2

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.
Files changed (105) hide show
  1. package/dist/index.html +22 -0
  2. package/dist/static/admin_logo.436045b7.svg +48 -0
  3. package/dist/static/admin_slogo.cc12b7d8.svg +48 -0
  4. package/dist/static/alert_logo.461428a2.svg +26 -0
  5. package/dist/static/alert_slogo.d7000af9.svg +26 -0
  6. package/dist/static/dataManager_logo.e27b3137.svg +42 -0
  7. package/dist/static/dataanalytic_logo.76dd2fda.svg +44 -0
  8. package/dist/static/dataanalytic_slogo.69fa2eee.svg +47 -0
  9. package/dist/static/dataasset_logo.9f1e48b2.svg +52 -0
  10. package/dist/static/dataasset_slogo.84d16e23.svg +52 -0
  11. package/dist/static/datacollection_logo.348102ed.svg +70 -0
  12. package/dist/static/datacollection_slogo.743ac405.svg +70 -0
  13. package/dist/static/datadev_logo.e57f9325.svg +26 -0
  14. package/dist/static/datadev_slogo.db9ce68f.svg +26 -0
  15. package/dist/static/datalabel_slogo.62e8f571.svg +26 -0
  16. package/dist/static/datamanager_slogo.8028bc5f.svg +42 -0
  17. package/dist/static/dataservice_logo.9a737452.svg +209 -0
  18. package/dist/static/dataservice_slogo.b9f136dc.svg +209 -0
  19. package/dist/static/datasharing_logo.6c828c61.svg +28 -0
  20. package/dist/static/datasharing_slogo.d0ccda7a.svg +28 -0
  21. package/dist/static/home.c9f8fbce.svg +12 -0
  22. package/dist/static/ic_gonggongmokuai_m.870acd57.svg +5 -0
  23. package/dist/static/ic_shujuhuiju_m.aceecaa1.svg +5 -0
  24. package/dist/static/ic_shujukaifa_m.a1b978b5.svg +15 -0
  25. package/dist/static/ic_shujukaifang_m.205ec04f.svg +5 -0
  26. package/dist/static/ic_shujuyingyong_m.4fed335c.svg +5 -0
  27. package/dist/static/ic_shujuzhili_m.9762b4f0.svg +5 -0
  28. package/dist/static/menuIcon.a281e69f.svg +1 -0
  29. package/dist/static/messageCenter.87236800.svg +1 -0
  30. package/dist/static/metadata_logo.45d05339.svg +25 -0
  31. package/dist/static/metadata_slogo.64e545f1.svg +25 -0
  32. package/dist/static/operate_logo.2a7ee3a9.svg +63 -0
  33. package/dist/static/operate_slogo.b46625a9.svg +63 -0
  34. package/dist/static/personalCenter.40f40e04.svg +16 -0
  35. package/dist/static/quality_logo.ef4e102a.svg +26 -0
  36. package/dist/static/quality_slogo.3557a527.svg +26 -0
  37. package/dist/static/systemManage.cc20d139.svg +16 -0
  38. package/dist/static/workorder_slogo.72b76127.svg +54 -0
  39. package/dist/umi.css +1 -0
  40. package/dist/umi.js +1 -0
  41. package/package.json +3 -2
  42. package/src/.umi/.cache/babel-loader/0cf458567cfdaa4bcc98ad17f126d505.json.gz +0 -0
  43. package/src/.umi/.cache/babel-loader/172487ddf659c5e5ed4c4cc43ab177d9.json.gz +0 -0
  44. package/src/.umi/.cache/babel-loader/1d496c36e309d0a102e0dac5294c7868.json.gz +0 -0
  45. package/src/.umi/.cache/babel-loader/1d61f257af04e239d0ea836688a06494.json.gz +0 -0
  46. package/src/.umi/.cache/babel-loader/2778829a08334bd378a2fdd98391a43c.json.gz +0 -0
  47. package/src/.umi/.cache/babel-loader/2a52a607066a02cb72bc9f72140998a3.json.gz +0 -0
  48. package/src/.umi/.cache/babel-loader/3076ff60b33bd715e63da884712660ff.json.gz +0 -0
  49. package/src/.umi/.cache/babel-loader/35fcc056042728656dfce9dd67b6bbc6.json.gz +0 -0
  50. package/src/.umi/.cache/babel-loader/382b0d400111ab0b80c259db1aa480ae.json.gz +0 -0
  51. package/src/.umi/.cache/babel-loader/38966e8352b47ea30f67e98ce8dfbce1.json.gz +0 -0
  52. package/src/.umi/.cache/babel-loader/61ed376d37914f796e6ee3e7206c53bd.json.gz +0 -0
  53. package/src/.umi/.cache/babel-loader/66357c799ae9dc8d0fdcab0abb98e3be.json.gz +0 -0
  54. package/src/.umi/.cache/babel-loader/713975e5f8979c076b77105bcc664433.json.gz +0 -0
  55. package/src/.umi/.cache/babel-loader/737e9e5ca4f0aa3883a7d8623a1560f3.json.gz +0 -0
  56. package/src/.umi/.cache/babel-loader/78278b5a6929a5a79cdf84421140a995.json.gz +0 -0
  57. package/src/.umi/.cache/babel-loader/80e5871bc78e732263638960b11de875.json.gz +0 -0
  58. package/src/.umi/.cache/babel-loader/8ce21ab4f5fb95407c2f635f6e0e9713.json.gz +0 -0
  59. package/src/.umi/.cache/babel-loader/8e6fb4487c51c552ca584b2f53dc3810.json.gz +0 -0
  60. package/src/.umi/.cache/babel-loader/8e7e40a2e6770c8f279024db25bc8fcf.json.gz +0 -0
  61. package/src/.umi/.cache/babel-loader/91ab7e7c6e4b220534b7b8dde5825001.json.gz +0 -0
  62. package/src/.umi/.cache/babel-loader/956e66fcc9441e07247197b2ecf6b440.json.gz +0 -0
  63. package/src/.umi/.cache/babel-loader/975afa5d1bc90c4c8f37aa402468675d.json.gz +0 -0
  64. package/src/.umi/.cache/babel-loader/a320cf81322ac1c1440132f0a1713345.json.gz +0 -0
  65. package/src/.umi/.cache/babel-loader/ae4616202782e31e14cf4b17641b1fe6.json.gz +0 -0
  66. package/src/.umi/.cache/babel-loader/b501b37dd395c6fe3df5b9f9f2217710.json.gz +0 -0
  67. package/src/.umi/.cache/babel-loader/c052495a4884502f57654ee834ae0a85.json.gz +0 -0
  68. package/src/.umi/.cache/babel-loader/c1062507fd6703590141de4c872c47de.json.gz +0 -0
  69. package/src/.umi/.cache/babel-loader/c14e03befcbd217f8aa57a7a7600590c.json.gz +0 -0
  70. package/src/.umi/.cache/babel-loader/c84d64ffe481659b495089907db80c2c.json.gz +0 -0
  71. package/src/.umi/.cache/babel-loader/d55b6d19818be24dbc615a2bf90f5c53.json.gz +0 -0
  72. package/src/.umi/.cache/babel-loader/de423f345d70a7488000626c81305752.json.gz +0 -0
  73. package/src/.umi/.cache/babel-loader/ec3a1cda1f0c32a803e9a9140d97110d.json.gz +0 -0
  74. package/src/.umi/.cache/babel-loader/f5c49dbe2f3c9fbba9c8b04c3254d7bb.json.gz +0 -0
  75. package/src/.umi/core/history.ts +21 -0
  76. package/src/.umi/core/plugin.ts +8 -0
  77. package/src/.umi/core/pluginConfig.d.ts +304 -0
  78. package/src/.umi/core/pluginRegister.ts +15 -0
  79. package/src/.umi/core/polyfill.ts +4 -0
  80. package/src/.umi/core/routes.ts +24 -0
  81. package/src/.umi/core/umiExports.ts +7 -0
  82. package/src/.umi/plugin-helmet/exports.ts +3 -0
  83. package/src/.umi/plugin-initial-state/Provider.tsx +37 -0
  84. package/src/.umi/plugin-initial-state/exports.ts +7 -0
  85. package/src/.umi/plugin-initial-state/models/initialState.ts +2 -0
  86. package/src/.umi/plugin-initial-state/runtime.tsx +13 -0
  87. package/src/.umi/plugin-model/Provider.tsx +39 -0
  88. package/src/.umi/plugin-model/helpers/constant.tsx +4 -0
  89. package/src/.umi/plugin-model/helpers/dispatcher.tsx +19 -0
  90. package/src/.umi/plugin-model/helpers/executor.tsx +83 -0
  91. package/src/.umi/plugin-model/runtime.tsx +12 -0
  92. package/src/.umi/plugin-model/useModel.tsx +71 -0
  93. package/src/.umi/plugin-request/request.ts +278 -0
  94. package/src/.umi/umi.ts +58 -0
  95. package/src/assets/muluguanli_slogo.png +0 -0
  96. package/src/assets/ziyuanguanli_slogo.png +0 -0
  97. package/src/pages/ModuleMenu/constData.jsx +15 -5
  98. package/src/pages/ModuleMenu/index.jsx +38 -73
  99. package/src/pages/ModuleMenu/index.less +109 -90
  100. package/src/pages/ModuleUser/index.jsx +103 -25
  101. package/src/pages/ModuleUser/index.less +46 -34
  102. package/src/pages/util/axios.js +35 -10
  103. package/src/pages/util/config.js +4 -8
  104. package/src/pages/util/permessionUtils.js +1 -19
  105. package/src/pages/util/userInfo.js +64 -39
@@ -2,27 +2,44 @@ 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 }) => {
8
- const [sessionMenu, setsessionMenu] = useState([]);
9
+ const ModuleMenu = ({ sysName, stash }) => {
10
+ const [sessionMenu, setSessionMenu] = useState([]);
9
11
  const [showMenuList, setshowMenuList] = useState(false);
10
12
  const [menuList, setMenuList] = useState([]);
11
13
 
12
14
  useEffect(() => {
13
- let newSessionMenu = getSessionMenu();
14
- setsessionMenu(newSessionMenu);
15
- let newMenuList = getNewMenuList();
16
- // let newMenuList = menuListInit;
17
- setMenuList(newMenuList);
15
+ getSessionMenu();
18
16
  }, []);
19
17
 
20
18
  const getSessionMenu = () => {
21
- const menuObj = JSON.parse(sessionStorage.getItem('bigdata-menu'));
22
- if (menuObj) {
23
- return menuObj.content || [];
19
+ if (!stash) {
20
+ const menuObj = JSON.parse(sessionStorage.getItem('bigdata-menu'));
21
+ let menuGet = menuObj?.content || [];
22
+ setSessionMenu(menuGet);
23
+ getNewMenuList(menuGet);
24
+ } else {
25
+ Axios('get', '/admin-api/system/user/getUserMenusList', '', {})
26
+ .then((res) => {
27
+ if (res.data.code === 0) {
28
+ let menuGet =
29
+ res.data.data &&
30
+ res.data.data.map((item) => {
31
+ return {
32
+ ...item,
33
+ path:
34
+ item.path.indexOf('/') !== -1 ? item.path : '/' + item.path,
35
+ };
36
+ });
37
+ }
38
+ setSessionMenu(menuGet);
39
+ getNewMenuList(menuGet);
40
+ })
41
+ .catch((e) => console.log('e', e));
24
42
  }
25
- return [];
26
43
  };
27
44
 
28
45
  // 获取系统logo及title
@@ -36,39 +53,6 @@ const ModuleMenu = ({ sysName }) => {
36
53
  return logoAndTitle;
37
54
  };
38
55
 
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
56
  // 跳转各个模块
73
57
  const toModulePage = (nameStr) => {
74
58
  if (!sessionMenu || sessionMenu.length === 0) {
@@ -76,72 +60,54 @@ const ModuleMenu = ({ sysName }) => {
76
60
  message.warning('没有获取到菜单列表,请联系管理员添加权限');
77
61
  return;
78
62
  }
79
- console.log('nameStr', nameStr);
80
63
  let thirdPartyServiceJumpPath = ''; // 第三方服务跳转路径
81
- let thirdPartyServiceRootMenuPath = ''; // 第三方服务根菜单路径
82
64
  switch (nameStr) {
83
65
  case '数据集成':
84
66
  thirdPartyServiceJumpPath = '/datacollect/';
85
- thirdPartyServiceRootMenuPath = '/datacollection';
86
67
  break;
87
68
  case '数据治理':
88
69
  thirdPartyServiceJumpPath = '/datamanage/';
89
- thirdPartyServiceRootMenuPath = '/dataManager';
90
70
  break;
91
71
  case '元数据管理':
92
72
  thirdPartyServiceJumpPath = '/metadata/';
93
- thirdPartyServiceRootMenuPath = '/metadata';
94
73
  break;
95
74
  case '数据质量':
96
75
  thirdPartyServiceJumpPath = '/quality/';
97
- thirdPartyServiceRootMenuPath = '/quality/';
98
76
  break;
99
77
  case '离线开发':
100
78
  thirdPartyServiceJumpPath = '/datadev/';
101
- thirdPartyServiceRootMenuPath = '/datadev/';
102
79
  break;
103
80
  case '实时开发':
104
81
  thirdPartyServiceJumpPath = '/dataanalytic/';
105
- thirdPartyServiceRootMenuPath = '/dataanalytic';
106
82
  break;
107
83
  case '数据服务':
108
84
  thirdPartyServiceJumpPath = '/dataservice/';
109
- thirdPartyServiceRootMenuPath = '/dataservice';
110
85
  break;
111
86
  case '数据资产':
112
87
  thirdPartyServiceJumpPath = '/dataasset/';
113
- thirdPartyServiceRootMenuPath = '/dataasset';
114
88
  break;
115
89
  case '数据共享':
116
90
  thirdPartyServiceJumpPath = '/datasharing/';
117
- thirdPartyServiceRootMenuPath = '/datasharing';
118
91
  break;
119
92
  case '运维中心':
120
93
  thirdPartyServiceJumpPath = '/operate/';
121
- thirdPartyServiceRootMenuPath = '/operate';
122
94
  break;
123
95
  case '消息中心':
124
96
  thirdPartyServiceJumpPath = '/alert/';
125
- thirdPartyServiceRootMenuPath = '/alert';
126
97
  break;
127
98
  case '数据安全':
128
99
  thirdPartyServiceJumpPath = '/datasecurity/';
129
- thirdPartyServiceRootMenuPath = '/datasecurity';
100
+ break;
101
+ case '目录管理':
102
+ thirdPartyServiceJumpPath = '/admin-ui/catalog/menuClassify/list';
103
+ break;
104
+ case '资源管理':
105
+ thirdPartyServiceJumpPath = '/admin-ui/resource/tableResource/list';
130
106
  break;
131
107
  default:
132
108
  break;
133
109
  }
134
110
  // 判断第三方服务是否有对应服务的菜单权限
135
- if (
136
- !judgeThirdPartyServiceIsHaveMenus(
137
- sessionMenu,
138
- thirdPartyServiceRootMenuPath,
139
- )
140
- ) {
141
- message.destroy();
142
- message.warning('您没有权限,请联系管理员添加权限。');
143
- return;
144
- }
145
111
  window.location.href = thirdPartyServiceJumpPath;
146
112
  };
147
113
  // 跳转首页
@@ -150,11 +116,10 @@ const ModuleMenu = ({ sysName }) => {
150
116
  window.location.href = '/#/index';
151
117
  }
152
118
  };
153
- const getNewMenuList = () => {
154
- const sessionMenu = getSessionMenu();
155
- let newMenuList = [...menuListInit];
156
- if (sessionMenu) {
157
- const pathList = sessionMenu.map((item) => item.path);
119
+ const getNewMenuList = (menuGet) => {
120
+ let newMenuList = _.cloneDeep(menuListInit(stash));
121
+ if (menuGet) {
122
+ const pathList = menuGet.map((item) => item.path);
158
123
  // 过滤掉没有权限的子菜单(PS:如果模块下面子菜单都没有,则不显示该模块)
159
124
  for (let index = newMenuList.length - 1; index >= 0; index--) {
160
125
  const menuItem = newMenuList[index];
@@ -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
- .cardLine{
14
- padding: 5px 0px;
15
- }
16
- .textPad{
17
- padding-left: 10px;
18
- }
19
- .leftMenu{
20
- width: 100px;
21
- float: left;
22
- color: rgba(0, 0, 0, 0.85);
23
- font-size: 16px;
24
- cursor: pointer;
25
- text-align: left;
26
- font-weight: 400;
27
- }
28
- .rightMenu{
29
- width: 460px;
30
- float: left;
31
- vertical-align: middle;
32
- font-size: 14px;
33
- color: rgba(0,0,0,0.65);
34
- font-weight: 400;
35
- margin-left: 15px;
36
- }
37
- .childMenu:hover{
38
- cursor: pointer;
39
- color: #4091F7;
40
- }
41
- .childMenu{
42
- width: 29%;
43
- display: inline-block;
44
- }
45
- .middle{
46
- vertical-align: middle;
47
- }
48
- .middle:hover{
49
- color: #4091F7;
50
- }
51
- .menuPopupAndTitle{
52
- display: flex;
53
- justify-content: flex-start;
54
- }
55
- .menuIcon{
56
- text-align: center;
57
- line-height: 49px;
58
- display: inline-block;
59
- cursor: pointer;
60
- width: 60px;
61
- height: 49px;
62
- background-color: #4091F7;
63
- }
64
- .menuIcon_img{
65
- height: 25px;
66
- width: 25px;
67
- }
68
- .menu_title_content{
69
- height: 32px;
70
- margin: 0 0 0 12px;
71
- font-weight: 600;
72
- font-size: 18px;
73
- line-height: 49px;
74
- vertical-align: middle;
75
- animation: pro-layout-title-hide .3s;
76
- }
77
- .menu_title_content_img{
78
- height: 32px;
79
- width: 32px;
80
- }
81
- .menu_title{
82
- color: #1890ff;
83
- height: 32px;
84
- margin: 0 0 0 12px;
85
- font-weight: 600;
86
- font-size: 18px;
87
- line-height: 32px;
88
- vertical-align: middle;
89
- animation: pro-layout-title-hide .3s;
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
- const ModuleUser = () => {
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 getUserName = () => {
25
- const userInfo = JSON.parse(
26
- sessionStorage.getItem('bigdata-userInfo') || '{}',
27
- );
28
- if (
29
- userInfo &&
30
- userInfo.content &&
31
- Object.keys(userInfo.content).length > 0 &&
32
- userInfo.content.username
33
- ) {
34
- return userInfo.content.username;
35
- }
36
- return '';
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
- Axios('delete', '/auth/token/logout', '', {})
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
- // localStorage.clear();
44
- // sessionStorage.clear();
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={() => handleClickmenu('/#/info/index')}
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={() => handleClickmenu('/#/admin/user/index')}
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
- padding-right: 30px;
9
- .action {
10
- display: flex;
11
- align-items: center;
12
- height: 48px;
13
- padding: 0 12px;
14
- cursor: pointer;
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
- .account {
27
- .avatar {
28
- margin-right: 8px;
29
- // color: @primary-color;
30
- vertical-align: top;
31
- background: rgba(255, 255, 255, 0.85);
32
- }
21
+ }
22
+
23
+ .search {
24
+ padding: 0 12px;
25
+
26
+ &:hover {
27
+ background: transparent;
33
28
  }
34
29
  }
35
- .menu {
36
- :global(.anticon) {
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
- :global(.ant-dropdown-menu-item) {
40
- min-width: 160px;
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
+ }