module-menu-vue 0.3.1 → 0.3.3

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-vue",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "城市大数据平台菜单--Vue版",
5
5
  "main": "/index.js",
6
6
  "scripts": {
Binary file
@@ -30,8 +30,8 @@
30
30
  <img :src="require('./../../assets/exchange_portal_logo.svg')" class="middle exchangeCss" />
31
31
  <span class="middle textPad" @click="toExchangePage()">政务共享交换平台</span>
32
32
  </span>
33
- <span v-for="child in item.children" :key="child.url">
34
- <span :key="child.childName">
33
+ <span v-for="child in item.children" :key="child.url" class="menu-item-wrapper">
34
+ <span :key="child.childName" class="menu-item-content">
35
35
  <img :src="child.url" class="middle iconPad" />
36
36
  <span :class="stash === 'LNRD' ? 'LNRD_menu_title childMenu textPad' : 'childMenu textPad middle'" @click="toModulePage(child.childName)">{{child.childName}}</span>
37
37
  </span>
@@ -44,7 +44,7 @@
44
44
  </template>
45
45
 
46
46
  <script>
47
- import { menuList as menuListInit, menuList_PANWEI, menuIconSrc, sysNameMap, lnrdMenuList, lnrdSysNameMap, menuList_HBJK} from './constant.js'
47
+ import { getMenuList as getMenuListInit, menuList_PANWEI, menuIconSrc, sysNameMap, lnrdMenuList, lnrdSysNameMap, menuList_HBJK} from './constant.js'
48
48
  import './menu.css'
49
49
  import { getMenuList, isLogoutThird, getInfoByName, getUrlByInfo } from './service.js'
50
50
  export default {
@@ -78,7 +78,7 @@ export default {
78
78
  menuIconSrc: menuIconSrc,
79
79
  menuList: [],
80
80
  sessionMenu: [],
81
- menuListInit: menuListInit,
81
+ menuListInit: getMenuListInit(this.stash),
82
82
  menuList_PANWEI,
83
83
  lnrdMenuList,
84
84
  lnrdSysNameMap,
@@ -185,6 +185,15 @@ export default {
185
185
  },
186
186
  // 跳转各个模块
187
187
  async toModulePage (nameStr) {
188
+ // 针对HBJK的标签管理,从菜单权限数据中获取动态路径
189
+ if (this.stash === 'HBJK' && nameStr === '标签管理') {
190
+ const menuItem = this.sessionMenu.find(item => item.name === '标签管理');
191
+ if (menuItem && menuItem.path) {
192
+ window.open(menuItem.path, '_blank');
193
+ return;
194
+ }
195
+ }
196
+
188
197
  let thirdPartyServiceJumpPath = ""; // 第三方服务跳转路径
189
198
  switch (nameStr) {
190
199
  case '平台运行总览':
@@ -284,13 +293,21 @@ export default {
284
293
  getNewMenuList () {
285
294
  let newMenuList = this.stash === 'LNRD' ? [...lnrdMenuList] : this.stash === 'PANWEI' ? [...this.menuList_PANWEI] : [...this.menuListInit];
286
295
  if (this.sessionMenu) {
287
- const pathList = this.sessionMenu.map(item => item.path)
296
+ const pathList = [...this.sessionMenu].map(item => item.path)
297
+ const nameList = [...this.sessionMenu].map((item) => item.name); // 添加按名称匹配的列表
298
+
288
299
  // 过滤掉没有权限的子菜单(PS:如果模块下面子菜单都没有,则不显示该模块)
289
300
  for (let index = newMenuList.length - 1; index >= 0; index--) {
290
301
  const menuItem = newMenuList[index]
291
302
  for (let index_ch = menuItem.children.length - 1; index_ch >= 0; index_ch--) {
292
303
  const child = menuItem.children[index_ch]
293
- if (!pathList.includes(child.path)) {
304
+
305
+ // 对于HBJK的标签管理,使用名称匹配而不是path匹配
306
+ const hasPermission = (this.stash === 'HBJK' && child.childName === '标签管理')
307
+ ? nameList.includes('标签管理')
308
+ : pathList.includes(child.path);
309
+
310
+ if (!hasPermission) {
294
311
  newMenuList[index].children.splice(index_ch, 1)
295
312
  }
296
313
  }
@@ -1,6 +1,35 @@
1
1
  const token = localStorage.getItem('ACCESS_TOKEN')
2
2
 
3
- export const menuList = [{
3
+ // 数据管理子菜单
4
+ const dataManageChildrenMenus = [
5
+ {
6
+ childName: '数据治理',
7
+ path: token ? '/datamanage' : '/dataManager',
8
+ url: require('../../assets/datamanager_slogo.svg'),
9
+ },
10
+ {
11
+ childName: '元数据管理',
12
+ path: '/metadata',
13
+ url: require('../../assets/metadata_slogo.svg'),
14
+ },
15
+ {
16
+ childName: '数据质量',
17
+ path: token ? '/quality' : '/quality/',
18
+ url: require('../../assets/quality_slogo.svg'),
19
+ },
20
+ {
21
+ childName: '指标管理',
22
+ path: '/indicator',
23
+ url: require('../../assets/dataApp/indicator.png'),
24
+ },
25
+ {
26
+ childName: '知识图谱',
27
+ path: '/knowledge',
28
+ url: require('../../assets/ic_zhishitupu.png'),
29
+ },
30
+ ];
31
+
32
+ export const getMenuList = (stash = '') => [{
4
33
  name: '首页',
5
34
  url: require('../../assets/home.svg'),
6
35
  children: [],
@@ -24,32 +53,12 @@ export const menuList = [{
24
53
  {
25
54
  name: '数据治理',
26
55
  url: require('../../assets/ic_shujuzhili_m.svg'),
27
- children: [{
28
- childName: '数据治理',
29
- path: token ? '/datamanage' : '/dataManager',
30
- url:require('../../assets/datamanager_slogo.svg'),
31
- },
32
- {
33
- childName: '元数据管理',
34
- path: '/metadata',
35
- url:require('../../assets/metadata_slogo.svg'),
36
- },
37
- {
38
- childName: '数据质量',
39
- path: token ? '/quality' : '/quality/',
40
- url: require('../../assets/quality_slogo.svg'),
41
- },
42
- {
43
- childName: "指标管理",
44
- path: "/indicator",
45
- url: require('../../assets/dataApp/indicator.png'),
46
- },
47
- {
48
- childName: "知识图谱",
49
- path: "/knowledge",
50
- url: require('../../assets/ic_zhishitupu.png'),
51
- }
52
- ]
56
+ children: stash === 'HBJK' ? dataManageChildrenMenus.concat([{
57
+ childName: '标签管理',
58
+ // 仅占位
59
+ path: '/tag-manage',
60
+ url: require('../../assets/tag_manage_HBJK.png'),
61
+ }]) : dataManageChildrenMenus,
53
62
  },
54
63
  {
55
64
  name: '数据开发',
@@ -48,10 +48,26 @@
48
48
  cursor: pointer;
49
49
  color: #4091f7;
50
50
  }
51
- .childMenu {
52
- width: 30%;
51
+ .menu-item-wrapper {
52
+ width: 33.33%;
53
53
  display: inline-block;
54
+ vertical-align: top;
55
+ box-sizing: border-box;
56
+ /* padding-right: 8px; */
57
+ }
58
+
59
+ .menu-item-content {
60
+ display: flex;
61
+ align-items: center;
62
+ width: 100%;
63
+ }
64
+
65
+ .childMenu {
54
66
  font-size: 14px;
67
+ white-space: nowrap;
68
+ overflow: hidden;
69
+ text-overflow: ellipsis;
70
+ flex: 1;
55
71
  }
56
72
  .middle {
57
73
  vertical-align: middle;