module-menu 0.3.17 → 0.3.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "module-menu",
3
- "version": "0.3.17",
3
+ "version": "0.3.19",
4
4
  "description": "城市大数据平台公共头部及尾部",
5
5
  "main": "src/pages/index.jsx",
6
6
  "scripts": {
@@ -393,6 +393,11 @@ export const sysNameMap = (stash = '') => [
393
393
  ? require('../../assets/dataManager_logo.svg')
394
394
  : require('../../assets/dataManager_logo_LNRD.svg'),
395
395
  },
396
+ {
397
+ sysName: 'datastandard',
398
+ title: '数据标准',
399
+ logoSrc: require('../../assets/datastandard.svg'),
400
+ },
396
401
  {
397
402
  sysName: 'metadata',
398
403
  title: '元数据管理',
@@ -1,424 +1,499 @@
1
- import { useState, useEffect, useRef, useMemo } from 'react';
2
- import { Popconfirm, message, Popover } from 'antd';
3
- import { menuList as menuListInit, menuIconSrc, sysNameMap, menuList_HBJK} from './constData';
4
- import HeaderDropdown from '../ModuleUser/HeaderDropdown';
5
- import { getInfoByName, getUrlByInfo } from './service.js'
6
- import Axios from '../util/axios';
7
- import _ from 'lodash';
8
- import './index.less';
9
- import cn from 'classnames'
10
- /*
11
- *stash:
12
- 一体化 integration
13
- 一体化 - 辽宁人大 LNRD
14
- 一体化 - 河北疾控 HBJK
15
- 轻量级 不传
16
- 轻量级-国资委 GZW
17
- *
18
- */
19
- const ModuleMenu = ({ sysName, stash = '' }) => {
20
- const [sessionMenu, setSessionMenu] = useState([]);
21
- const [showMenuList, setshowMenuList] = useState(false);
22
- const [menuList, setMenuList] = useState([]);
23
- const [canOperatExchange, setCanOperatExchange] = useState(false); //是否具有政务共享平台权限
24
- useEffect(() => {
25
- localStorage.setItem('stash', stash)
26
- getSessionMenu();
27
- }, []);
28
-
29
- const getSessionMenu = () => {
30
- if(['integration', 'LNRD', 'HBJK'].includes(stash)){
31
- Axios(
32
- 'get',
33
- '/admin-api/system/user/get-user-menu-List?menuName=数据平台',
34
- '',
35
- {},
36
- )
37
- .then((res) => {
38
- // const resD = JSON.parse(localStorage.getItem('moduleRoutes'))
39
- // let menuGet =
40
- // (resD?.map((item) => {
41
- // return {
42
- // ...item,
43
- // path:
44
- // item.path.indexOf('/') !== -1
45
- // ? item.path
46
- // : '/' + item.path,
47
- // };
48
- // })) ||
49
- // [];
50
- // console.log('menuGet', menuGet)
51
- // setSessionMenu(menuGet);
52
- // const menuLists = getNewMenuList(menuGet);
53
- // setMenuList(menuLists);
54
-
55
- if (res.data.code === 0) {
56
- let menuGet =
57
- (res.data.data &&
58
- res.data.data[0]?.routes?.map((item) => {
59
- return {
60
- ...item,
61
- path:
62
- item.path.indexOf('/') !== -1
63
- ? item.path
64
- : '/' + item.path,
65
- };
66
- })) ||
67
- [];
68
- console.log('menuGet', menuGet)
69
- setSessionMenu(menuGet);
70
- const menuLists = getNewMenuList(menuGet);
71
- setMenuList(menuLists);
72
- }
73
- })
74
- .catch((e) => console.log('e', e));
75
- }else{
76
- const menuObj = JSON.parse(sessionStorage.getItem('bigdata-menu'));
77
- let menuGet = menuObj?.content || [];
78
- setSessionMenu(menuGet);
79
- const menuLists = getNewMenuList(menuGet);
80
- setMenuList(menuLists);
81
- let exchangeInfo =
82
- menuGet && menuGet.find((item) => item.path === '/exchange');
83
- if (exchangeInfo) {
84
- setCanOperatExchange(true);
85
- }
86
- }
87
- };
88
-
89
- // 获取系统logo及title
90
- const getLogoAndTitle = () => {
91
- let sysInfo = sysNameMap(stash).find((item) => item.sysName === sysName);
92
- let logoAndTitle = { logoSrc: '', title: '' };
93
- if (sysInfo) {
94
- logoAndTitle.logoSrc = sysInfo.logoSrc;
95
- logoAndTitle.title = sysInfo.title;
96
- }
97
- return logoAndTitle;
98
- };
99
-
100
- const getUrl = async (name) => {
101
- let res = null;
102
- let obj = {}
103
- res = await getInfoByName(name)
104
- obj = {
105
- clientId: res.data.data.clientId,
106
- redirectUrl: encodeURIComponent(res.data.data.redirectUris[0]),
107
- }
108
- res = await getUrlByInfo(obj)
109
- return res.data.data
110
- };
111
-
112
-
113
- // 跳转各个模块
114
- const toModulePage = async (nameStr) => {
115
- if (!sessionMenu || sessionMenu.length === 0) {
116
- message.destroy();
117
- message.warning('没有获取到菜单列表,请联系管理员添加权限');
118
- return;
119
- }
120
-
121
- // 针对HBJK的标签管理,从菜单权限数据中获取动态路径
122
- if (stash === 'HBJK' && nameStr === '标签管理') {
123
- const menuItem = sessionMenu?.find(item => item.name === '标签管理');
124
- if (menuItem && menuItem.path) {
125
- window.open(menuItem.path, '_blank');
126
- return;
127
- }
128
- }
129
-
130
- if (nameStr === '政务共享交换平台') {
131
- Axios('get', '/admin/social/logoutUri', '', {})
132
- .then((res) => {
133
- if (res.data.code === 0) {
134
- if (res.data.data.search('http') !== -1) {
135
- window.location.href = res.data.data;
136
- }
137
- } else {
138
- message.warning(res.data.msg || '获取信息失败');
139
- }
140
- })
141
- .catch((error) => {
142
- console.error('Error while logging out, error:', error);
143
- message.error('服务器错误,请稍后重试');
144
- });
145
- } else {
146
- let thirdPartyServiceJumpPath = ''; // 第三方服务跳转路径
147
- switch (nameStr) {
148
- case '平台运行总览':
149
- thirdPartyServiceJumpPath = '/dataadmin/#/overview';
150
- break;
151
- case '数据集成':
152
- thirdPartyServiceJumpPath = '/datacollect/';
153
- break;
154
- case '数据治理':
155
- thirdPartyServiceJumpPath = '/datamanage/';
156
- break;
157
- case '元数据管理':
158
- thirdPartyServiceJumpPath = '/metadata/';
159
- break;
160
- case '数据质量':
161
- thirdPartyServiceJumpPath = '/quality/';
162
- break;
163
- case '离线开发':
164
- thirdPartyServiceJumpPath = '/datadev/';
165
- break;
166
- case '实时开发':
167
- thirdPartyServiceJumpPath = '/dataanalytic/';
168
- break;
169
- case '数据服务':
170
- thirdPartyServiceJumpPath = '/dataservice/';
171
- break;
172
- case '数据资产':
173
- thirdPartyServiceJumpPath = '/dataasset/';
174
- break;
175
- case '数据共享':
176
- thirdPartyServiceJumpPath = '/datasharing/';
177
- break;
178
- case '运维中心':
179
- thirdPartyServiceJumpPath = '/operate/';
180
- break;
181
- case '消息中心':
182
- thirdPartyServiceJumpPath = '/alert/';
183
- break;
184
- case '数据安全':
185
- thirdPartyServiceJumpPath = '/datasecurity/';
186
- break;
187
- case '目录管理':
188
- thirdPartyServiceJumpPath = '/admin-ui/catalog';
189
- break;
190
- case '资源管理':
191
- thirdPartyServiceJumpPath = '/admin-ui/resource/tableResource/list';
192
- break;
193
- case '供需对接':
194
- thirdPartyServiceJumpPath =
195
- '/admin-ui/supply-and-demand-docking/dataRequirement/propose/list';
196
- break;
197
- case '数据直达':
198
- thirdPartyServiceJumpPath = '/admin-ui/cascade';
199
- break;
200
- case '综合评价系统':
201
- thirdPartyServiceJumpPath = '/admin-ui/evaluate';
202
- break;
203
- case '数据标签':
204
- thirdPartyServiceJumpPath = '/datatag/';
205
- break;
206
- case '数据可视化':
207
- thirdPartyServiceJumpPath = await getUrl('dataview')
208
- break;
209
- case '数据填报':
210
- thirdPartyServiceJumpPath = await getUrl('datafill')
211
- break;
212
- case '知识图谱':
213
- thirdPartyServiceJumpPath = await getUrl('knowledge')
214
- break;
215
- case '指标管理':
216
- thirdPartyServiceJumpPath = await getUrl('indicator')
217
- break;
218
- default:
219
- break;
220
- }
221
- if (['公共卫生监测人口库', '电子传染病档案库', '应急资源库', '传染病防控知识库', '主题库'].includes(nameStr)) {
222
- thirdPartyServiceJumpPath = `/data-resource-center/data-source/list?menuName=${nameStr}`
223
- }
224
- // 判断第三方服务是否有对应服务的菜单权限
225
- // window.location.href = thirdPartyServiceJumpPath;
226
- if (
227
- ['平台运行总览', '知识图谱', '数据可视化', '数据填报', '指标管理'].includes(nameStr)
228
- ) {
229
- window.open(thirdPartyServiceJumpPath, '_blank')
230
- } else {
231
- window.location.href = thirdPartyServiceJumpPath
232
- }
233
- }
234
- };
235
- // 跳转首页
236
- const toHomePage = (index) => {
237
- if (index === 0) {
238
- window.location.href = ['integration', 'LNRD', 'HBJK'].includes(stash) ? '/dataadmin/#/index' : (stash === 'GZW' ? '/data-platform/#/index' : '/#/index')
239
- }
240
- };
241
- const getNewMenuList = (menuGet) => {
242
- let newMenuList = _.cloneDeep(menuListInit(stash));
243
- if (menuGet) {
244
- const pathList = menuGet.map((item) => item.path);
245
- const nameList = menuGet.map((item) => item.name); // 添加按名称匹配的列表
246
-
247
- // 过滤掉没有权限的子菜单(PS:如果模块下面子菜单都没有,则不显示该模块)
248
- for (let index = newMenuList.length - 1; index >= 0; index--) {
249
- const menuItem = newMenuList[index];
250
- for (
251
- let index_ch = menuItem.children.length - 1;
252
- index_ch >= 0;
253
- index_ch--
254
- ) {
255
- const child = menuItem.children[index_ch];
256
-
257
- // 对于HBJK的标签管理,使用名称匹配而不是path匹配
258
- const hasPermission = (stash === 'HBJK' && child.childName === '标签管理')
259
- ? nameList.includes('标签管理')
260
- : pathList.includes(child.path);
261
-
262
- if (!hasPermission) {
263
- newMenuList[index].children.splice(index_ch, 1);
264
- }
265
- }
266
- if (menuItem.children.length === 0 && menuItem.name !== '首页') {
267
- newMenuList.splice(index, 1);
268
- }
269
- }
270
- }
271
- if (stash === 'HBJK') {
272
- newMenuList = newMenuList.concat(menuList_HBJK);
273
- }
274
- return newMenuList;
275
- };
276
- const menu = menuList.map((item, index) => {
277
- return (
278
- <div
279
- key={item.name}
280
- className="cardLine"
281
- style={{
282
- height:
283
- item.children.length > 6
284
- ? '140px'
285
- : item.children.length > 3
286
- ? '90px'
287
- : '',
288
- }}
289
- >
290
- <div
291
- className={stash === 'HBJK' ? 'leftMenu_HBJK' : 'leftMenu'}
292
- style={{
293
- height:
294
- item.children.length > 6
295
- ? '140px'
296
- : item.children.length > 3
297
- ? '96px'
298
- : '70px',
299
- lineHeight:
300
- item.children.length > 6
301
- ? '140px'
302
- : item.children.length > 3
303
- ? '45px'
304
- : '70px',
305
- }}
306
- >
307
- <img src={item.url} className={
308
- stash === 'HBJK' ? 'middle_HBJK' :
309
- stash !== 'LNRD' ? 'middle' : 'middle_LNRD'
310
- } />
311
- <span
312
- className={cn(stash !== 'LNRD'? 'middle' : 'middle_LNRD', 'textPad')}
313
- // className=`${{stash !== 'LNRD'? 'middle' : 'middle_LNRD'}} textPad`
314
- onClick={() => {
315
- toHomePage(index);
316
- }}
317
- >
318
- {item.name}
319
- </span>
320
- </div>
321
- <div
322
- className={stash === 'HBJK' ? 'rightMenu_HBJK' : 'rightMenu'}
323
- style={{
324
- height:
325
- item.children.length > 6
326
- ? '140px'
327
- : item.children.length > 3
328
- ? '96px'
329
- : '70px',
330
- lineHeight:
331
- item.children.length > 6
332
- ? '45px'
333
- : item.children.length > 3
334
- ? '45px'
335
- : '70px',
336
- borderBottom:
337
- index === menuList.length - 1 ? '0px' : '1px solid #E9E9E9',
338
- }}
339
- >
340
- {index === 0 && canOperatExchange ? (
341
- <div key={'政务共享交换平台'}>
342
- <img
343
- src={require('../../assets/exchange_slogo.svg')}
344
- className="middle exchangeIcon"
345
- />
346
- <span
347
- className="middle exchangeCss"
348
- onClick={() => {
349
- toModulePage('政务共享交换平台');
350
- }}
351
- >
352
- 政务共享交换平台
353
- </span>
354
- </div>
355
- ) : (
356
- item.children.map((child, idx) => {
357
- return (
358
- <span key={child.childName}>
359
- <img src={child.url}
360
- className ={cn(stash !== 'LNRD'? 'middle': 'middle_LNRD', 'iconPad')}
361
- // className="middle iconPad"
362
- />
363
- <span
364
- className ={cn(stash !== 'LNRD'? 'childMenu' : 'childMenu_LNRD', stash !== 'LNRD'? 'middle' : 'middle_LNRD','textPad')}
365
- // className="childMenu textPad middle"
366
- onClick={() => {
367
- toModulePage(child.childName);
368
- }}
369
- >
370
- {child.childName}
371
- </span>
372
- </span>
373
- );
374
- })
375
- )}
376
- </div>
377
- </div>
378
- );
379
- });
380
-
381
- return (
382
- <div>
383
- <div className="menuPopupAndTitle">
384
- <div
385
- className={cn(stash !== 'LNRD'? 'menuIcon_size':'menuIcon_size_LNRD', 'menuIcon')}
386
- onMouseOver={() => setshowMenuList(true)}
387
- style={{
388
- // backgroundImage: `url(${menuIconSrc})`,
389
- backgroundRepeat: 'no-repeat',
390
- backgroundSize: '50%',
391
- backgroundPosition: 'center',
392
- backgroundColor: stash === 'LNRD'? '#EA1A1A': stash === 'HBJK'? '#1373FF' : '#4091F7'
393
-
394
- }}
395
- >
396
- <img src={menuIconSrc} className={cn(stash !== 'LNRD'? null:'menuIcon_img')}></img>
397
- </div>
398
- <div className={cn(stash !== 'LNRD'? 'menu_title_content_size':'menu_title_content_size_LNRD', 'menu_title_content')}
399
-
400
- >
401
- {stash !== 'HBJK' && <img
402
- className="menu_title_content_img"
403
- src={getLogoAndTitle().logoSrc}
404
- alt="logo"
405
- />}
406
- <span
407
- className={cn(['LNRD','HBJK'].includes(stash)? 'menu_title_color_LNRD':'menu_title_color', 'menu_title')}
408
- // className="menu_title"
409
- >{getLogoAndTitle().title}</span>
410
- </div>
411
- </div>
412
- <div
413
- className={cn(stash !== 'LNRD'? 'menu_list_content_top':'menu_list_content_top_LNRD', 'menu_list_content')}
414
- // className="menu_list_content"
415
- style={{ display: showMenuList ? 'block' : 'none' }}
416
- onMouseOver={() => setshowMenuList(true)}
417
- onMouseOut={() => setshowMenuList(false)}
418
- >
419
- {menu}
420
- </div>
421
- </div>
422
- );
423
- };
424
- export default ModuleMenu;
1
+ import { useState, useEffect, useRef, useMemo } from 'react';
2
+ import { Popconfirm, message, Popover } from 'antd';
3
+ import {
4
+ menuList as menuListInit,
5
+ menuIconSrc,
6
+ sysNameMap,
7
+ menuList_HBJK,
8
+ } from './constData';
9
+ import HeaderDropdown from '../ModuleUser/HeaderDropdown';
10
+ import { getInfoByName, getUrlByInfo } from './service.js';
11
+ import Axios from '../util/axios';
12
+ import _ from 'lodash';
13
+ import './index.less';
14
+ import cn from 'classnames';
15
+ /*
16
+ *stash:
17
+ 一体化 integration
18
+ 一体化 - 辽宁人大 LNRD
19
+ 一体化 - 河北疾控 HBJK
20
+ 轻量级 不传
21
+ 轻量级-国资委 GZW
22
+ *
23
+ */
24
+ const ModuleMenu = ({ sysName, stash = '' }) => {
25
+ const [sessionMenu, setSessionMenu] = useState([]);
26
+ const [showMenuList, setshowMenuList] = useState(false);
27
+ const [menuList, setMenuList] = useState([]);
28
+ const [canOperatExchange, setCanOperatExchange] = useState(false); //是否具有政务共享平台权限
29
+ useEffect(() => {
30
+ localStorage.setItem('stash', stash);
31
+ getSessionMenu();
32
+ }, []);
33
+
34
+ const getSessionMenu = () => {
35
+ if (['integration', 'LNRD', 'HBJK'].includes(stash)) {
36
+ Axios(
37
+ 'get',
38
+ '/admin-api/system/user/get-user-menu-List?menuName=数据平台',
39
+ '',
40
+ {},
41
+ )
42
+ .then((res) => {
43
+ // const resD = JSON.parse(localStorage.getItem('moduleRoutes'))
44
+ // let menuGet =
45
+ // (resD?.map((item) => {
46
+ // return {
47
+ // ...item,
48
+ // path:
49
+ // item.path.indexOf('/') !== -1
50
+ // ? item.path
51
+ // : '/' + item.path,
52
+ // };
53
+ // })) ||
54
+ // [];
55
+ // console.log('menuGet', menuGet)
56
+ // setSessionMenu(menuGet);
57
+ // const menuLists = getNewMenuList(menuGet);
58
+ // setMenuList(menuLists);
59
+
60
+ if (res.data.code === 0) {
61
+ let menuGet =
62
+ (res.data.data &&
63
+ res.data.data[0]?.routes?.map((item) => {
64
+ return {
65
+ ...item,
66
+ path:
67
+ item.path.indexOf('/') !== -1
68
+ ? item.path
69
+ : '/' + item.path,
70
+ };
71
+ })) ||
72
+ [];
73
+ console.log('menuGet', menuGet);
74
+ setSessionMenu(menuGet);
75
+ const menuLists = getNewMenuList(menuGet);
76
+ setMenuList(menuLists);
77
+ }
78
+ })
79
+ .catch((e) => console.log('e', e));
80
+ } else {
81
+ const menuObj = JSON.parse(sessionStorage.getItem('bigdata-menu'));
82
+ let menuGet = menuObj?.content || [];
83
+ setSessionMenu(menuGet);
84
+ const menuLists = getNewMenuList(menuGet);
85
+ setMenuList(menuLists);
86
+ let exchangeInfo =
87
+ menuGet && menuGet.find((item) => item.path === '/exchange');
88
+ if (exchangeInfo) {
89
+ setCanOperatExchange(true);
90
+ }
91
+ }
92
+ };
93
+
94
+ // 获取系统logo及title
95
+ const getLogoAndTitle = () => {
96
+ let sysInfo = sysNameMap(stash).find((item) => item.sysName === sysName);
97
+ let logoAndTitle = { logoSrc: '', title: '' };
98
+ if (sysInfo) {
99
+ logoAndTitle.logoSrc = sysInfo.logoSrc;
100
+ logoAndTitle.title = sysInfo.title;
101
+ }
102
+ return logoAndTitle;
103
+ };
104
+
105
+ const getUrl = async (name) => {
106
+ let res = null;
107
+ let obj = {};
108
+ res = await getInfoByName(name);
109
+ obj = {
110
+ clientId: res.data.data.clientId,
111
+ redirectUrl: encodeURIComponent(res.data.data.redirectUris[0]),
112
+ };
113
+ res = await getUrlByInfo(obj);
114
+ return res.data.data;
115
+ };
116
+
117
+ // 跳转各个模块
118
+ const toModulePage = async (nameStr) => {
119
+ if (!sessionMenu || sessionMenu.length === 0) {
120
+ message.destroy();
121
+ message.warning('没有获取到菜单列表,请联系管理员添加权限');
122
+ return;
123
+ }
124
+
125
+ // 针对HBJK的标签管理,从菜单权限数据中获取动态路径
126
+ if (stash === 'HBJK' && nameStr === '标签管理') {
127
+ const menuItem = sessionMenu?.find((item) => item.name === '标签管理');
128
+ if (menuItem && menuItem.path) {
129
+ window.open(menuItem.path, '_blank');
130
+ return;
131
+ }
132
+ }
133
+
134
+ if (nameStr === '政务共享交换平台') {
135
+ Axios('get', '/admin/social/logoutUri', '', {})
136
+ .then((res) => {
137
+ if (res.data.code === 0) {
138
+ if (res.data.data.search('http') !== -1) {
139
+ window.location.href = res.data.data;
140
+ }
141
+ } else {
142
+ message.warning(res.data.msg || '获取信息失败');
143
+ }
144
+ })
145
+ .catch((error) => {
146
+ console.error('Error while logging out, error:', error);
147
+ message.error('服务器错误,请稍后重试');
148
+ });
149
+ } else {
150
+ let thirdPartyServiceJumpPath = ''; // 第三方服务跳转路径
151
+ switch (nameStr) {
152
+ case '平台运行总览':
153
+ thirdPartyServiceJumpPath = '/dataadmin/#/overview';
154
+ break;
155
+ case '数据集成':
156
+ thirdPartyServiceJumpPath = '/datacollect/';
157
+ break;
158
+ case '数据标准':
159
+ thirdPartyServiceJumpPath = '/datastandard/';
160
+ break;
161
+ case '数据治理':
162
+ thirdPartyServiceJumpPath = '/datamanage/';
163
+ break;
164
+ case '元数据管理':
165
+ thirdPartyServiceJumpPath = '/metadata/';
166
+ break;
167
+ case '数据质量':
168
+ thirdPartyServiceJumpPath = '/quality/';
169
+ break;
170
+ case '离线开发':
171
+ thirdPartyServiceJumpPath = '/datadev/';
172
+ break;
173
+ case '实时开发':
174
+ thirdPartyServiceJumpPath = '/dataanalytic/';
175
+ break;
176
+ case '数据服务':
177
+ thirdPartyServiceJumpPath = '/dataservice/';
178
+ break;
179
+ case '数据资产':
180
+ thirdPartyServiceJumpPath = '/dataasset/';
181
+ break;
182
+ case '数据共享':
183
+ thirdPartyServiceJumpPath = '/datasharing/';
184
+ break;
185
+ case '运维中心':
186
+ thirdPartyServiceJumpPath = '/operate/';
187
+ break;
188
+ case '消息中心':
189
+ thirdPartyServiceJumpPath = '/alert/';
190
+ break;
191
+ case '数据安全':
192
+ thirdPartyServiceJumpPath = '/datasecurity/';
193
+ break;
194
+ case '目录编制':
195
+ thirdPartyServiceJumpPath = '/admin-ui/catalog';
196
+ break;
197
+ case '目录中心':
198
+ thirdPartyServiceJumpPath = '/admin-ui/catalog-center';
199
+ break;
200
+ case '资源管理':
201
+ thirdPartyServiceJumpPath = '/admin-ui/resource/tableResource/list';
202
+ break;
203
+ case '供需对接':
204
+ thirdPartyServiceJumpPath =
205
+ '/admin-ui/supply-and-demand-docking/dataRequirement/propose/list';
206
+ break;
207
+ case '数据直达':
208
+ thirdPartyServiceJumpPath = '/admin-ui/cascade';
209
+ break;
210
+ case '综合评价系统':
211
+ thirdPartyServiceJumpPath = '/admin-ui/evaluate';
212
+ break;
213
+ case '数据标签':
214
+ thirdPartyServiceJumpPath = '/datatag/';
215
+ break;
216
+ case '数据可视化':
217
+ thirdPartyServiceJumpPath = await getUrl('dataview');
218
+ break;
219
+ case '数据填报':
220
+ thirdPartyServiceJumpPath = await getUrl('datafill');
221
+ break;
222
+ case '知识图谱':
223
+ thirdPartyServiceJumpPath = await getUrl('knowledge');
224
+ break;
225
+ case '指标管理':
226
+ thirdPartyServiceJumpPath = await getUrl('indicator');
227
+ break;
228
+ default:
229
+ break;
230
+ }
231
+ if (
232
+ [
233
+ '公共卫生监测人口库',
234
+ '电子传染病档案库',
235
+ '应急资源库',
236
+ '传染病防控知识库',
237
+ '主题库',
238
+ ].includes(nameStr)
239
+ ) {
240
+ thirdPartyServiceJumpPath = `/data-resource-center/data-source/list?menuName=${nameStr}`;
241
+ }
242
+ // 判断第三方服务是否有对应服务的菜单权限
243
+ // window.location.href = thirdPartyServiceJumpPath;
244
+ if (
245
+ [
246
+ '平台运行总览',
247
+ '知识图谱',
248
+ '数据可视化',
249
+ '数据填报',
250
+ '指标管理',
251
+ ].includes(nameStr)
252
+ ) {
253
+ window.open(thirdPartyServiceJumpPath, '_blank');
254
+ } else {
255
+ window.location.href = thirdPartyServiceJumpPath;
256
+ }
257
+ }
258
+ };
259
+ // 跳转首页
260
+ const toHomePage = (index) => {
261
+ if (index === 0) {
262
+ window.location.href = ['integration', 'LNRD', 'HBJK'].includes(stash)
263
+ ? '/dataadmin/#/index'
264
+ : stash === 'GZW'
265
+ ? '/data-platform/#/index'
266
+ : '/#/index';
267
+ }
268
+ };
269
+ const getNewMenuList = (menuGet) => {
270
+ let newMenuList = _.cloneDeep(menuListInit(stash));
271
+ if (menuGet) {
272
+ const pathList = menuGet.map((item) => item.path);
273
+ const nameList = menuGet.map((item) => item.name); // 添加按名称匹配的列表
274
+
275
+ // 过滤掉没有权限的子菜单(PS:如果模块下面子菜单都没有,则不显示该模块)
276
+ for (let index = newMenuList.length - 1; index >= 0; index--) {
277
+ const menuItem = newMenuList[index];
278
+ for (
279
+ let index_ch = menuItem.children.length - 1;
280
+ index_ch >= 0;
281
+ index_ch--
282
+ ) {
283
+ const child = menuItem.children[index_ch];
284
+
285
+ // 对于HBJK的标签管理,使用名称匹配而不是path匹配
286
+ const hasPermission =
287
+ stash === 'HBJK' && child.childName === '标签管理'
288
+ ? nameList.includes('标签管理')
289
+ : pathList.includes(child.path);
290
+
291
+ if (!hasPermission) {
292
+ newMenuList[index].children.splice(index_ch, 1);
293
+ }
294
+ }
295
+ if (menuItem.children.length === 0 && menuItem.name !== '首页') {
296
+ newMenuList.splice(index, 1);
297
+ }
298
+ }
299
+ }
300
+ if (stash === 'HBJK') {
301
+ newMenuList = newMenuList.concat(menuList_HBJK);
302
+ }
303
+ return newMenuList;
304
+ };
305
+ const menu = menuList.map((item, index) => {
306
+ return (
307
+ <div
308
+ key={item.name}
309
+ className="cardLine"
310
+ style={{
311
+ height:
312
+ item.children.length > 6
313
+ ? '140px'
314
+ : item.children.length > 3
315
+ ? '90px'
316
+ : '',
317
+ }}
318
+ >
319
+ <div
320
+ className={stash === 'HBJK' ? 'leftMenu_HBJK' : 'leftMenu'}
321
+ style={{
322
+ height:
323
+ item.children.length > 6
324
+ ? '140px'
325
+ : item.children.length > 3
326
+ ? '96px'
327
+ : '70px',
328
+ lineHeight:
329
+ item.children.length > 6
330
+ ? '140px'
331
+ : item.children.length > 3
332
+ ? '45px'
333
+ : '70px',
334
+ }}
335
+ >
336
+ <img
337
+ src={item.url}
338
+ className={
339
+ stash === 'HBJK'
340
+ ? 'middle_HBJK'
341
+ : stash !== 'LNRD'
342
+ ? 'middle'
343
+ : 'middle_LNRD'
344
+ }
345
+ />
346
+ <span
347
+ className={cn(
348
+ stash !== 'LNRD' ? 'middle' : 'middle_LNRD',
349
+ 'textPad',
350
+ )}
351
+ // className=`${{stash !== 'LNRD'? 'middle' : 'middle_LNRD'}} textPad`
352
+ onClick={() => {
353
+ toHomePage(index);
354
+ }}
355
+ >
356
+ {item.name}
357
+ </span>
358
+ </div>
359
+ <div
360
+ className={stash === 'HBJK' ? 'rightMenu_HBJK' : 'rightMenu'}
361
+ style={{
362
+ height:
363
+ item.children.length > 6
364
+ ? '140px'
365
+ : item.children.length > 3
366
+ ? '96px'
367
+ : '70px',
368
+ lineHeight:
369
+ item.children.length > 6
370
+ ? '45px'
371
+ : item.children.length > 3
372
+ ? '45px'
373
+ : '70px',
374
+ borderBottom:
375
+ index === menuList.length - 1 ? '0px' : '1px solid #E9E9E9',
376
+ }}
377
+ >
378
+ {index === 0 && canOperatExchange ? (
379
+ <div key={'政务共享交换平台'}>
380
+ <img
381
+ src={require('../../assets/exchange_slogo.svg')}
382
+ className="middle exchangeIcon"
383
+ />
384
+ <span
385
+ className="middle exchangeCss"
386
+ onClick={() => {
387
+ toModulePage('政务共享交换平台');
388
+ }}
389
+ >
390
+ 政务共享交换平台
391
+ </span>
392
+ </div>
393
+ ) : (
394
+ item.children.map((child, idx) => {
395
+ return (
396
+ <span key={child.childName}>
397
+ <img
398
+ src={child.url}
399
+ className={cn(
400
+ stash !== 'LNRD' ? 'middle' : 'middle_LNRD',
401
+ 'iconPad',
402
+ )}
403
+ // className="middle iconPad"
404
+ />
405
+ <span
406
+ className={cn(
407
+ stash !== 'LNRD' ? 'childMenu' : 'childMenu_LNRD',
408
+ stash !== 'LNRD' ? 'middle' : 'middle_LNRD',
409
+ 'textPad',
410
+ )}
411
+ // className="childMenu textPad middle"
412
+ onClick={() => {
413
+ toModulePage(child.childName);
414
+ }}
415
+ >
416
+ {child.childName}
417
+ </span>
418
+ </span>
419
+ );
420
+ })
421
+ )}
422
+ </div>
423
+ </div>
424
+ );
425
+ });
426
+
427
+ return (
428
+ <div>
429
+ <div className="menuPopupAndTitle">
430
+ <div
431
+ className={cn(
432
+ stash !== 'LNRD' ? 'menuIcon_size' : 'menuIcon_size_LNRD',
433
+ 'menuIcon',
434
+ )}
435
+ onMouseOver={() => setshowMenuList(true)}
436
+ style={{
437
+ // backgroundImage: `url(${menuIconSrc})`,
438
+ backgroundRepeat: 'no-repeat',
439
+ backgroundSize: '50%',
440
+ backgroundPosition: 'center',
441
+ backgroundColor:
442
+ stash === 'LNRD'
443
+ ? '#EA1A1A'
444
+ : stash === 'HBJK'
445
+ ? '#1373FF'
446
+ : '#4091F7',
447
+ }}
448
+ >
449
+ <img
450
+ src={menuIconSrc}
451
+ className={cn(stash !== 'LNRD' ? null : 'menuIcon_img')}
452
+ ></img>
453
+ </div>
454
+ <div
455
+ className={cn(
456
+ stash !== 'LNRD'
457
+ ? 'menu_title_content_size'
458
+ : 'menu_title_content_size_LNRD',
459
+ 'menu_title_content',
460
+ )}
461
+ >
462
+ {stash !== 'HBJK' && (
463
+ <img
464
+ className="menu_title_content_img"
465
+ src={getLogoAndTitle().logoSrc}
466
+ alt="logo"
467
+ />
468
+ )}
469
+ <span
470
+ className={cn(
471
+ ['LNRD', 'HBJK'].includes(stash)
472
+ ? 'menu_title_color_LNRD'
473
+ : 'menu_title_color',
474
+ 'menu_title',
475
+ )}
476
+ // className="menu_title"
477
+ >
478
+ {getLogoAndTitle().title}
479
+ </span>
480
+ </div>
481
+ </div>
482
+ <div
483
+ className={cn(
484
+ stash !== 'LNRD'
485
+ ? 'menu_list_content_top'
486
+ : 'menu_list_content_top_LNRD',
487
+ 'menu_list_content',
488
+ )}
489
+ // className="menu_list_content"
490
+ style={{ display: showMenuList ? 'block' : 'none' }}
491
+ onMouseOver={() => setshowMenuList(true)}
492
+ onMouseOut={() => setshowMenuList(false)}
493
+ >
494
+ {menu}
495
+ </div>
496
+ </div>
497
+ );
498
+ };
499
+ export default ModuleMenu;