agilebuilder-ui 1.0.39 → 1.0.40
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
|
@@ -63,12 +63,14 @@ export default {
|
|
|
63
63
|
systemName = systemNameObj[language]
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
const isSelectFirst = window.$vueApp.config.globalProperties.showFirstMenu === undefined || window.$vueApp.config.globalProperties.showFirstMenu === null? true : window.$vueApp.config.globalProperties.showFirstMenu
|
|
66
67
|
const menus = getMenus()
|
|
67
68
|
return {
|
|
68
69
|
firstLeafMenu: null, // 第一个有权限的叶子菜单,用于默认展开第一个父菜单
|
|
69
70
|
systemName,
|
|
70
71
|
defaultActive: '',
|
|
71
72
|
menus,
|
|
73
|
+
isSelectFirst
|
|
72
74
|
}
|
|
73
75
|
},
|
|
74
76
|
computed: {
|
|
@@ -144,67 +146,47 @@ export default {
|
|
|
144
146
|
Cookies.set('selectMenu', index)
|
|
145
147
|
},
|
|
146
148
|
getFirstMenu(menus) {
|
|
147
|
-
|
|
149
|
+
const currentMenuCode = this.$route.query
|
|
150
|
+
? this.$route.query._menuCode
|
|
151
|
+
: null
|
|
152
|
+
if(currentMenuCode){
|
|
153
|
+
// 表示需要选中指定的菜单
|
|
154
|
+
this.isSelectFirst = true
|
|
155
|
+
}
|
|
156
|
+
if (this.isSelectFirst && menus && menus.length > 0) {
|
|
148
157
|
let shouldSelectMenu
|
|
149
158
|
for (let i = 0; i < menus.length; i++) {
|
|
150
159
|
const menu = menus[i]
|
|
151
|
-
shouldSelectMenu = this.getShouldSelectMenu(menu)
|
|
160
|
+
shouldSelectMenu = this.getShouldSelectMenu(menu, currentMenuCode)
|
|
152
161
|
if (shouldSelectMenu) {
|
|
153
162
|
// 表示获得到了应该选中的菜单
|
|
154
163
|
break
|
|
155
164
|
}
|
|
156
165
|
}
|
|
157
|
-
// if (!shouldSelectMenu) {
|
|
158
|
-
// // 如果没有获得默认选中的菜单,则默认选中第一个菜单
|
|
159
|
-
// shouldSelectMenu = this.getSelectMenuWithFirstMenu(menus[0])
|
|
160
|
-
// }
|
|
161
|
-
return shouldSelectMenu
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
getShouldSelectMenu(menu) {
|
|
165
|
-
const currentMenuCode = this.$route.query
|
|
166
|
-
? this.$route.query._menuCode
|
|
167
|
-
: null
|
|
168
|
-
if (menu && currentMenuCode) {
|
|
169
|
-
let shouldSelectMenu
|
|
170
|
-
const children = menu.children
|
|
171
|
-
if (children && children.length > 0) {
|
|
172
|
-
shouldSelectMenu = this.getFirstMenu(children)
|
|
173
|
-
} else if (menu.code && menu.code === currentMenuCode) {
|
|
174
|
-
shouldSelectMenu = menu
|
|
175
|
-
}
|
|
176
166
|
return shouldSelectMenu
|
|
177
167
|
}
|
|
178
|
-
// if (menu) {
|
|
179
|
-
// const cookieMenu = Cookies.get('selectMenu')
|
|
180
|
-
// let currentRoute = this.$route.path
|
|
181
|
-
// if (cookieMenu && cookieMenu.indexOf('~~') > 0) {
|
|
182
|
-
// // cookie中记录了选中的菜单路径
|
|
183
|
-
// const path = cookieMenu.substring(0, cookieMenu.lastIndexOf('~~'))
|
|
184
|
-
// currentRoute = path
|
|
185
|
-
// }
|
|
186
|
-
// let shouldSelectMenu
|
|
187
|
-
// const children = menu.children
|
|
188
|
-
// if (children && children.length > 0) {
|
|
189
|
-
// shouldSelectMenu = this.getFirstMenu(children)
|
|
190
|
-
// } else if (menu.fullPath && menu.fullPath === currentRoute) {
|
|
191
|
-
// shouldSelectMenu = menu
|
|
192
|
-
// }
|
|
193
|
-
// return shouldSelectMenu
|
|
194
|
-
// }
|
|
195
168
|
},
|
|
196
|
-
|
|
169
|
+
getShouldSelectMenu(menu, currentMenuCode) {
|
|
197
170
|
if (menu) {
|
|
198
171
|
let shouldSelectMenu
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
172
|
+
if(currentMenuCode){
|
|
173
|
+
const children = menu.children
|
|
174
|
+
if (children && children.length > 0) {
|
|
175
|
+
shouldSelectMenu = this.getFirstMenu(children)
|
|
176
|
+
} else if (menu.code && menu.code === currentMenuCode) {
|
|
177
|
+
shouldSelectMenu = menu
|
|
178
|
+
}
|
|
202
179
|
} else {
|
|
203
|
-
|
|
180
|
+
const children = menu.children
|
|
181
|
+
if (children && children.length > 0) {
|
|
182
|
+
shouldSelectMenu = this.getFirstMenu(children)
|
|
183
|
+
} else {
|
|
184
|
+
shouldSelectMenu = menu
|
|
185
|
+
}
|
|
204
186
|
}
|
|
205
187
|
return shouldSelectMenu
|
|
206
188
|
}
|
|
207
|
-
}
|
|
189
|
+
}
|
|
208
190
|
},
|
|
209
191
|
}
|
|
210
192
|
</script>
|