imatrix-ui 2.8.7 → 2.8.8-boe10

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 (47) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.umd.min.js +5 -5
  3. package/package.json +2 -2
  4. package/src/i18n/langs/cn.js +2 -0
  5. package/src/i18n/langs/en.js +4 -2
  6. package/src/router/index.js +10 -0
  7. package/src/store/modules/tab-content.js +6 -0
  8. package/src/styles/display-layout.scss +34 -0
  9. package/src/styles/index.scss +103 -5
  10. package/src/styles/theme/black/font-style.scss +70 -0
  11. package/src/styles/theme/black/index.scss +6 -30
  12. package/src/styles/theme/blue/font-style.scss +37 -0
  13. package/src/styles/theme/blue/index.scss +2 -18
  14. package/src/styles/theme/blue2/font-style.scss +70 -0
  15. package/src/styles/theme/blue2/index.scss +3 -13
  16. package/src/styles/theme/dark-blue/button.scss +9 -0
  17. package/src/styles/theme/dark-blue/card.scss +64 -0
  18. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  19. package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
  20. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  21. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  22. package/src/styles/theme/dark-blue/font.scss +71 -0
  23. package/src/styles/theme/{gray/form-style.scss → dark-blue/form.scss} +12 -2
  24. package/src/styles/theme/dark-blue/index.scss +255 -0
  25. package/src/styles/theme/dark-blue/input.scss +15 -0
  26. package/src/styles/theme/dark-blue/pagination.scss +14 -0
  27. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  28. package/src/styles/theme/dark-blue/sidebar.scss +266 -0
  29. package/src/styles/theme/dark-blue/tab.scss +83 -0
  30. package/src/styles/theme/dark-blue/table.scss +60 -0
  31. package/src/styles/theme/dark-blue/tree.scss +31 -0
  32. package/src/styles/theme/dark-blue/var.scss +1028 -0
  33. package/src/styles/theme/gray/card-style.scss +13 -1
  34. package/src/styles/theme/gray/font-style.scss +38 -0
  35. package/src/styles/theme/gray/index.scss +13 -25
  36. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  37. package/src/styles/theme/gray/sidebar.scss +5 -0
  38. package/src/utils/common-util.js +4 -0
  39. package/src/utils/request.js +13 -0
  40. package/src/views/layout/NewLayout.vue +6 -65
  41. package/src/views/layout/components/Menubar/Item.vue +23 -7
  42. package/src/views/layout/components/Menubar/Link.vue +11 -2
  43. package/src/views/layout/components/Menubar/SidebarItem.vue +50 -7
  44. package/src/views/layout/components/Menubar/index.vue +51 -16
  45. package/src/views/layout/components/tabs/tab-content.vue +160 -0
  46. package/src/views/layout/tab-content-iframe-index.vue +31 -0
  47. package/src/views/layout/tab-content-index.vue +85 -0
@@ -38,5 +38,17 @@
38
38
 
39
39
 
40
40
  }
41
-
41
+ .gray_card_box {
42
+ border-radius: 6px;
43
+ background: #FFFFFF;
44
+ padding: 20px;
45
+ box-shadow: 0px 1px 8px 0px #00000019;
46
+ box-sizing: border-box;
47
+ overflow-y: scroll;
48
+ }
49
+ .gray_buttomBtn_box{
50
+ position: fixed;
51
+ bottom: 0;
52
+ right: 4%;
53
+ }
42
54
  }
@@ -29,4 +29,42 @@
29
29
  color: rgba(0, 13, 31, 0.85);
30
30
  }
31
31
  }
32
+
33
+ .page-layout__title {
34
+ width: 46px;
35
+ height: 16px;
36
+ font-size: 11px;
37
+ font-weight: 500;
38
+ color: #333333;
39
+ line-height: 13px;
40
+ }
41
+
42
+ .component-type-name__title {
43
+ width: 40px;
44
+ height: 14px;
45
+ font-size: 10px;
46
+ font-weight: 500;
47
+ color: #333333;
48
+ line-height: 12px;
49
+ // -webkit-background-clip: text;
50
+ // -webkit-text-fill-color: transparent;
51
+ }
52
+
53
+ .page-layout__title::before {
54
+ content: "";
55
+ text-align: center;
56
+ background: #1A6BF3;
57
+ float: left;
58
+ position: relative;
59
+ border-radius: 3px;
60
+ /** 定义成 block 元素 **/
61
+ display: block;
62
+ // height: 21px;
63
+ // width: 4px;
64
+ margin-right: 12px;
65
+
66
+ width: 2px;
67
+ height: 16px;
68
+
69
+ }
32
70
  }
@@ -3,7 +3,7 @@
3
3
  @import './card-style.scss';
4
4
  @import './tab-style.scss';
5
5
  @import './input-style.scss';
6
- @import './form-style.scss';
6
+ @import './scrollbar-style.scss';
7
7
 
8
8
  .gray {
9
9
  font-family: microsoft yahei, Arial, Helvetica, sans-serif;
@@ -76,8 +76,9 @@
76
76
  }
77
77
 
78
78
  .app-container {
79
- // padding: 20px;
80
- padding: 0px;
79
+ padding: 20px;
80
+ border-radius: 6px;
81
+ box-shadow: 0px 1px 8px 0px #00000019;
81
82
 
82
83
  .box-card {
83
84
  margin: 16px 24px;
@@ -95,26 +96,6 @@
95
96
  }
96
97
 
97
98
 
98
- .form-container {
99
- height: calc(100vh - 82px);
100
- overflow: auto;
101
- }
102
-
103
- .form-container .el-form .el-card {
104
- margin-bottom: 10px;
105
- }
106
-
107
- .form-container .el-form .el-card:last-child {
108
- margin-bottom: 0;
109
- }
110
-
111
- // 带有tab页签的表单高度
112
- .tab-form-container {
113
- height: calc(100vh - 190px);
114
- overflow: auto;
115
- }
116
-
117
-
118
99
  // 解决tab页签中内容多时没有滚动条问题
119
100
  .el-tabs__content {
120
101
  flex-grow: 1;
@@ -173,12 +154,19 @@
173
154
  .el-table th {
174
155
  padding: 0;
175
156
  }
157
+
176
158
  /**表格内容纵向分隔线去掉**/
177
- .el-table--border td, .el-table--border th, .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed {
159
+ .el-table--border td,
160
+ .el-table--border th,
161
+ .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed {
178
162
  border-right: 0px
179
163
  }
164
+
180
165
  /**表格标题纵向分隔线颜色调浅点儿**/
181
- .el-table--border td, .el-table--border th,.el-table--border th.is-leaf, .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed {
166
+ .el-table--border td,
167
+ .el-table--border th,
168
+ .el-table--border th.is-leaf,
169
+ .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed {
182
170
  border-right: 1px solid #fefefe;
183
171
  }
184
172
  }
@@ -0,0 +1,32 @@
1
+ .dark-blue {
2
+
3
+ // 滚动条基础样式
4
+ ::-webkit-scrollbar {
5
+ width: 6px; // 纵向的宽度
6
+ height: 8px; // 横向的高度
7
+ }
8
+
9
+ // 默认下滚动条的样式
10
+ ::-webkit-scrollbar-thumb {
11
+ background: #eaeaea;
12
+ border: none;
13
+ border-radius: 4px;
14
+ }
15
+
16
+ // 鼠标悬停在滚动条时的样式
17
+ ::-webkit-scrollbar-thumb:hover {
18
+ background: rgba(157, 165, 183, 0.7)
19
+ }
20
+
21
+ // 滚动条区域 空白地方的样式
22
+ ::-webkit-scrollbar-track {
23
+ background-color: transparent;
24
+ border: none;
25
+ }
26
+
27
+ // 鼠标悬停在滚动条时 滚动条区域 空白地方的样式
28
+ ::-webkit-scrollbar-track:hover {
29
+ background-color: #eaeaea;
30
+ border: none;
31
+ }
32
+ }
@@ -8,6 +8,11 @@
8
8
  transition: margin-left .28s;
9
9
  margin-left: 224px;
10
10
  position: relative;
11
+
12
+ .nav-tab {
13
+ padding-top: 5px;
14
+ padding-left: 5px;
15
+ }
11
16
  }
12
17
 
13
18
  // 侧边栏
@@ -202,3 +202,7 @@ export function getOrignUrl() {
202
202
  }
203
203
  return orignUrl
204
204
  }
205
+
206
+ export function isPromise(p) {
207
+ return p && Object.prototype.toString.call(p) === '[object Promise]'
208
+ }
@@ -112,6 +112,10 @@ service.interceptors.response.use(
112
112
  }
113
113
  console.log(message)
114
114
  let errorMsg = getI18n().t('imatrixUIMessage.internalServerError')
115
+ if (message && message !== 'Internal Server Error') {
116
+ // 表示显示原始异常
117
+ errorMsg = message
118
+ }
115
119
  if (message && (message === 'gateway.timeout' || message === 'gateway.callFailed')) {
116
120
  // 网关的fallback返回的异常信息“接口调用超时”、“接口调用失败”
117
121
  errorMsg = getI18n().t(message)
@@ -124,6 +128,15 @@ service.interceptors.response.use(
124
128
  })
125
129
  return Promise.reject(error)
126
130
  }
131
+ } else {
132
+ const errorMsg = getI18n().t('imatrixUIMessage.internalServerError')
133
+ Message({
134
+ showClose: true,
135
+ message: errorMsg,
136
+ type: 'error',
137
+ duration: 5 * 1000
138
+ })
139
+ return Promise.reject(error)
127
140
  }
128
141
  }
129
142
  )
@@ -1,77 +1,18 @@
1
1
  <template>
2
- <div :class="classObj" class="app-wrapper">
3
- <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
4
- <menubar class="sidebar-container" />
5
- <div class="main-container">
6
- <breadcrumb v-if="showMenuRoute" />
2
+ <div class="app-wrapper">
3
+ <div class="tab-main-container">
4
+ <!-- <tab-content/> -->
7
5
  <app-main />
8
6
  </div>
9
7
  </div>
10
8
  </template>
11
-
12
9
  <script>
13
- import { Menubar, AppMain, Breadcrumb } from './components'
14
- import ResizeMixin from './mixin/ResizeHandler'
15
- import { isShowMenuRoute } from '../../../src/utils/common-util'
16
-
10
+ import { AppMain } from './components'
17
11
  export default {
18
- name: 'Layout',
12
+ name: 'EmptyLayout',
19
13
  components: {
20
- Menubar,
21
- AppMain,
22
- Breadcrumb
23
- },
24
- mixins: [ResizeMixin],
25
- data() {
26
- // 是否显示菜单路径,默认是不显示
27
- const showMenuRoute = isShowMenuRoute()
28
- return {
29
- showMenuRoute
30
- }
31
- },
32
- computed: {
33
- sidebar() {
34
- return this.$store.state.app.sidebar
35
- },
36
- device() {
37
- return this.$store.state.app.device
38
- },
39
- classObj() {
40
- return {
41
- hideSidebar: !this.sidebar.opened,
42
- openSidebar: this.sidebar.opened,
43
- withoutAnimation: this.sidebar.withoutAnimation,
44
- mobile: this.device === 'mobile'
45
- }
46
- }
47
- },
48
- methods: {
49
- handleClickOutside() {
50
- this.$store.dispatch('closeSidebar', { withoutAnimation: false })
51
- }
14
+ AppMain
52
15
  }
53
16
  }
54
17
  </script>
55
18
 
56
- <style rel="stylesheet/scss" lang="scss" scoped>
57
- @import "../../styles/mixin.scss";
58
- .app-wrapper {
59
- @include clearfix;
60
- position: relative;
61
- height: 100%;
62
- width: 100%;
63
- &.mobile.openSidebar{
64
- position: fixed;
65
- top: 0;
66
- }
67
- }
68
- .drawer-bg {
69
- background: #000;
70
- opacity: 0.3;
71
- width: 100%;
72
- top: 0;
73
- height: 100%;
74
- position: absolute;
75
- z-index: 999;
76
- }
77
- </style>
@@ -14,20 +14,28 @@ export default {
14
14
  hasChildren: {
15
15
  type: Boolean,
16
16
  default: false
17
+ },
18
+ isRoot: {
19
+ type: Boolean,
20
+ default: false
17
21
  }
18
22
  },
19
23
  render(h, context) {
24
+ const { title, hasChildren, isRoot } = context.props
20
25
  let icon = context.props.icon
21
- const { title, hasChildren } = context.props
22
26
  const vnodes = []
23
-
24
27
  if (icon) {
25
28
  if (icon.indexOf('fa-') === 0) {
26
29
  // 表示以“fa-”开头,使用font-awesome中的图标
27
30
  icon = 'fa ' + icon
31
+ vnodes.push(<div style='display: inline-block;overflow:hidden;'><i class={icon}/></div>)
32
+ } else if (icon.indexOf('svg-') === 0) {
33
+ icon = icon.substring(icon.indexOf('svg-') + 4)
34
+ vnodes.push(<div style='display: inline-block;overflow:hidden;'><svg-icon icon-class={icon}/></div>)
35
+ } else {
36
+ icon += ' svg-icon'
37
+ vnodes.push(<div style='display: inline-block;overflow:hidden;'><i class={icon} /></div>)
28
38
  }
29
- icon += ' svg-icon'
30
- vnodes.push(<div style='display: inline-block;'><i class={icon}/></div>)
31
39
  }
32
40
 
33
41
  if (title) {
@@ -36,9 +44,17 @@ export default {
36
44
  // 当是父菜单时,为了使后面的三角能显示出来,需要将宽度设小点
37
45
  width = '100px'
38
46
  }
39
- vnodes.push(<div slot='title' style='display: inline-block'>
40
- <div title={title} style={'display: inline-block;width:' + width + ';overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;'}>{(title)}</div>
41
- </div>)
47
+ if (isRoot) {
48
+ // 是否是根目录,没有子菜单时
49
+ vnodes.push(<div style='display: inline-block'>
50
+ <div title={title} style={'display: inline-block;width:' + width + ';overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;'}>{(title)}</div>
51
+ </div>)
52
+ } else {
53
+ // 有子菜单时
54
+ vnodes.push(<div slot='title' style='display: inline-block'>
55
+ <div title={title} style={'display: inline-block;width:' + width + ';overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;'}>{(title)}</div>
56
+ </div>)
57
+ }
42
58
  }
43
59
  return vnodes
44
60
  }
@@ -6,9 +6,12 @@
6
6
  <slot />
7
7
  </a> -->
8
8
 
9
- <router-link :to="to">
9
+ <router-link v-if="!isOpenNewTab" :to="to">
10
10
  <slot />
11
11
  </router-link>
12
+ <div v-else>
13
+ <slot />
14
+ </div>
12
15
  </div>
13
16
  </template>
14
17
 
@@ -23,8 +26,14 @@ export default {
23
26
  },
24
27
  data() {
25
28
  const isExter = this.to.isExternal
29
+ const openWay = this.to.openWay
30
+ let isOpenNewTab = false
31
+ if (openWay && openWay === 'NEW_PAGE_OPEN') {
32
+ isOpenNewTab = true
33
+ }
26
34
  return {
27
- isExter
35
+ isExter,
36
+ isOpenNewTab
28
37
  }
29
38
  }
30
39
  }
@@ -1,16 +1,16 @@
1
1
  <template>
2
2
  <div class="menu-wrapper">
3
3
  <template v-if="!item.children || item.children.lenght === 0">
4
- <app-link :to="toPath(item)">
4
+ <app-link :to="toPath(item)" @click.native="clickMenu(toPath(item))">
5
5
  <el-menu-item :index="item.fullPath+'~~'+item.i18nValue" :class="{'submenu-title-noDropdown':!isNest}">
6
- <item :icon="item.iconName" :title="item.i18nValue" />
6
+ <item :icon="item.iconName" :title="getI18nName(item)" :is-root="true" />
7
7
  </el-menu-item>
8
8
  </app-link>
9
9
  </template>
10
10
 
11
11
  <el-submenu v-else :index="item.fullPath+'~~'+item.i18nValue">
12
12
  <template slot="title">
13
- <item :icon="item.iconName" :title="item.i18nValue" :has-children="item.children.length > 0?true:false" />
13
+ <item :icon="item.iconName" :title="getI18nName(item)" :has-children="item.children.length > 0?true:false" />
14
14
  </template>
15
15
 
16
16
  <template v-for="child in item.children">
@@ -21,9 +21,9 @@
21
21
  :item="child"
22
22
  class="nest-menu"
23
23
  />
24
- <app-link v-else :key="child.code" :to="toPath(child)">
24
+ <app-link v-else :key="child.code" :to="toPath(child)" @click.native="clickMenu(toPath(child))">
25
25
  <el-menu-item :index="child.fullPath+'~~'+child.i18nValue">
26
- <item :icon="child.iconName" :title="child.i18nValue" />
26
+ <item :icon="child.iconName" :title="getI18nName(child)" />
27
27
  </el-menu-item>
28
28
  </app-link>
29
29
  </template>
@@ -34,6 +34,9 @@
34
34
  <script>
35
35
  import Item from './Item'
36
36
  import AppLink from './Link'
37
+ import Vue from 'vue'
38
+ import { getI18nName } from 'imatrix-ui/src/utils/menu'
39
+ import tabJs from '../../../../api/tab'
37
40
 
38
41
  export default {
39
42
  name: 'SidebarItem',
@@ -59,6 +62,7 @@ export default {
59
62
  }
60
63
  },
61
64
  methods: {
65
+ ...tabJs,
62
66
  hasOneShowingChild(children, parent) {
63
67
  if (children && children.length > 0) {
64
68
  this.onlyOneChild = children[0]
@@ -80,13 +84,24 @@ export default {
80
84
  toPath(menu) {
81
85
  const toPathObj = {}
82
86
  const routePath = menu.fullPath
87
+ toPathObj.openWay = menu.openWay
83
88
  if (this.isExternalLink(menu.pageType)) {
84
- toPathObj.path = '/iframe-page/page'
89
+ toPathObj.path = '/tab-content-iframe-index'
90
+ toPathObj.tabPath = '/iframe-page/page'
85
91
  toPathObj.query = {}
86
92
  toPathObj.query.src = routePath
87
93
  toPathObj.isExternal = true
94
+ // 如果路径中没有拼系统编码,才需要把系统编码放到参数中
95
+ toPathObj.query.customSystem = Vue.prototype.customSystem
96
+ toPathObj.query._menuCode = menu.code
97
+ toPathObj.query._menuName = getI18nName(menu)
88
98
  } else {
89
- toPathObj.path = routePath
99
+ toPathObj.path = '/tab-content-index'
100
+ toPathObj.tabPath = routePath
101
+ toPathObj.query = {}
102
+ toPathObj.query.customSystem = Vue.prototype.customSystem
103
+ toPathObj.query._menuCode = menu.code
104
+ toPathObj.query._menuName = getI18nName(menu)
90
105
  }
91
106
  return toPathObj
92
107
  },
@@ -95,6 +110,34 @@ export default {
95
110
  return true
96
111
  }
97
112
  return false
113
+ },
114
+ clickMenu(toPathObj) {
115
+ // console.log('clickMenu----toPathObj=', toPathObj)
116
+ if (toPathObj.openWay && toPathObj.openWay === 'NEW_PAGE_OPEN' && toPathObj.query) {
117
+ // 新页签打开菜单
118
+ let url = toPathObj.query.src
119
+ if (url && url.indexOf('?') > 0) {
120
+ url += '&'
121
+ } else {
122
+ url += '?'
123
+ }
124
+ if (toPathObj.query.customSystem) {
125
+ url += 'customSystem=' + toPathObj.query.customSystem
126
+ }
127
+ if (toPathObj.query._menuCode) {
128
+ url += '_menuCode=' + toPathObj.query._menuCode
129
+ }
130
+ if (toPathObj.query._menuCode) {
131
+ url += '_menuName=' + toPathObj.query._menuName
132
+ }
133
+ window.open(url, toPathObj.query._menuCode)
134
+ } else {
135
+ // 刷新页签打开菜单
136
+ this.addTabs(toPathObj.query, this.$store.state.tabContent.openTab, toPathObj.tabPath)
137
+ }
138
+ },
139
+ getI18nName(menu) {
140
+ return getI18nName(menu)
98
141
  }
99
142
  }
100
143
  }
@@ -24,6 +24,8 @@ import SidebarItem from './SidebarItem'
24
24
  import Vue from 'vue'
25
25
  import { getLanguageWithLocale } from '../../../../utils/util'
26
26
  import { isShowSystemMenu } from '../../../../utils/common-util'
27
+ import tabJs from '../../../../api/tab'
28
+ import { getI18nName } from '../../../../utils/menu'
27
29
  import Cookies from 'js-cookie'
28
30
  import { getMenus } from '../../../../utils/permissionAuth'
29
31
  export default {
@@ -31,6 +33,16 @@ export default {
31
33
  components: {
32
34
  SidebarItem
33
35
  },
36
+ props: {
37
+ systemCode: {
38
+ type: String,
39
+ default: null
40
+ },
41
+ collapse: {
42
+ type: Boolean,
43
+ default: false
44
+ }
45
+ },
34
46
  data() {
35
47
  let systemName
36
48
  if (isShowSystemMenu() === true) {
@@ -53,7 +65,10 @@ export default {
53
65
  'sidebar'
54
66
  ]),
55
67
  isCollapse() {
56
- return !this.sidebar.opened
68
+ if (this.collapse === false) {
69
+ return !this.sidebar.opened
70
+ }
71
+ return true
57
72
  }
58
73
  },
59
74
  watch: {
@@ -77,13 +92,22 @@ export default {
77
92
  // 跳转到第一个页面
78
93
  if (this.firstLeafMenu.pageType && this.firstLeafMenu.pageType === 'iframe') {
79
94
  const iframeSrc = this.firstLeafMenu.fullPath
80
- this.$router.push({ path: '/iframe-page/page', query: { src: iframeSrc }})
95
+ // this.$router.push({ path: '/iframe-page/page', query: { src: iframeSrc }})
96
+ const query = { src: iframeSrc, customSystem: this.systemCode, _menuCode: this.firstLeafMenu.code, _menuName: getI18nName(this.firstLeafMenu) }
97
+ this.addTabs(query, this.$store.state.tabContent.openTab, '/iframe-page/page', '/iframe-page/page')
98
+ // this.$router.push({ path: '/iframe-page/page', query: query })
99
+ this.$router.push({ path: '/tab-content-iframe-index', query: query })
81
100
  } else {
82
- this.$router.push({ path: this.firstLeafMenu.fullPath })
101
+ const query = { customSystem: this.systemCode, _menuCode: this.firstLeafMenu.code, _menuName: getI18nName(this.firstLeafMenu) }
102
+ const path = this.firstLeafMenu.fullPath
103
+ this.addTabs(query, this.$store.state.tabContent.openTab, path, path)
104
+ this.$router.push({ path: '/tab-content-index', query: query })
105
+ // this.$router.push({ path: this.firstLeafMenu.fullPath })
83
106
  }
84
107
  }
85
108
  },
86
109
  methods: {
110
+ ...tabJs,
87
111
  toggleSideBar() {
88
112
  this.$store.dispatch('toggleSidebar')
89
113
  },
@@ -102,31 +126,42 @@ export default {
102
126
  break
103
127
  }
104
128
  }
105
- if (!shouldSelectMenu) {
106
- // 如果没有获得默认选中的菜单,则默认选中第一个菜单
107
- shouldSelectMenu = this.getSelectMenuWithFirstMenu(menus[0])
108
- }
129
+ // if (!shouldSelectMenu) {
130
+ // // 如果没有获得默认选中的菜单,则默认选中第一个菜单
131
+ // shouldSelectMenu = this.getSelectMenuWithFirstMenu(menus[0])
132
+ // }
109
133
  return shouldSelectMenu
110
134
  }
111
135
  },
112
136
  getShouldSelectMenu(menu) {
113
- if (menu) {
114
- const cookieMenu = Cookies.get('selectMenu')
115
- let currentRoute = this.$route.path
116
- if (cookieMenu && cookieMenu.indexOf('~~') > 0) {
117
- // cookie中记录了选中的菜单路径
118
- const path = cookieMenu.substring(0, cookieMenu.lastIndexOf('~~'))
119
- currentRoute = path
120
- }
137
+ const currentMenuCode = this.$route.query ? this.$route.query._menuCode : null
138
+ if (menu && currentMenuCode) {
121
139
  let shouldSelectMenu
122
140
  const children = menu.children
123
141
  if (children && children.length > 0) {
124
142
  shouldSelectMenu = this.getFirstMenu(children)
125
- } else if (menu.fullPath && menu.fullPath === currentRoute) {
143
+ } else if (menu.code && menu.code === currentMenuCode) {
126
144
  shouldSelectMenu = menu
127
145
  }
128
146
  return shouldSelectMenu
129
147
  }
148
+ // if (menu) {
149
+ // const cookieMenu = Cookies.get('selectMenu')
150
+ // let currentRoute = this.$route.path
151
+ // if (cookieMenu && cookieMenu.indexOf('~~') > 0) {
152
+ // // cookie中记录了选中的菜单路径
153
+ // const path = cookieMenu.substring(0, cookieMenu.lastIndexOf('~~'))
154
+ // currentRoute = path
155
+ // }
156
+ // let shouldSelectMenu
157
+ // const children = menu.children
158
+ // if (children && children.length > 0) {
159
+ // shouldSelectMenu = this.getFirstMenu(children)
160
+ // } else if (menu.fullPath && menu.fullPath === currentRoute) {
161
+ // shouldSelectMenu = menu
162
+ // }
163
+ // return shouldSelectMenu
164
+ // }
130
165
  },
131
166
  getSelectMenuWithFirstMenu(menu) {
132
167
  if (menu) {