1
This commit is contained in:
@@ -44,7 +44,7 @@ export default {
|
|||||||
menuList: state => state.menuList
|
menuList: state => state.menuList
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async setAuthorityMenus({ state, commit }, { Main, ParentView, Page404, authorityMenus, menuIds }) {
|
async setAuthorityMenus({ state, commit }, { Main, ParentView, Page404, HomePage, authorityMenus, menuIds }) {
|
||||||
// 如果传入了 authorityMenus,直接使用;否则从接口获取
|
// 如果传入了 authorityMenus,直接使用;否则从接口获取
|
||||||
let menus = authorityMenus
|
let menus = authorityMenus
|
||||||
|
|
||||||
@@ -95,9 +95,9 @@ export default {
|
|||||||
commit('setAuthorityMenus', JSON.stringify(menus))
|
commit('setAuthorityMenus', JSON.stringify(menus))
|
||||||
|
|
||||||
// 生成路由菜单(传递 HomePage 组件)
|
// 生成路由菜单(传递 HomePage 组件)
|
||||||
// 从框架实例中获取 HomePage
|
// 优先使用传入的 HomePage,如果没有则从框架实例中获取
|
||||||
const HomePage = (window.framework && window.framework.HomePage) || null
|
const homePageComponent = HomePage || (window.framework && window.framework.HomePage) || null
|
||||||
let mainMenu = uiTool.getRoutes(Main, ParentView, Page404, HomePage)
|
let mainMenu = uiTool.getRoutes(Main, ParentView, Page404, homePageComponent)
|
||||||
console.log('生成的主菜单:', mainMenu)
|
console.log('生成的主菜单:', mainMenu)
|
||||||
|
|
||||||
if (mainMenu && mainMenu.children) {
|
if (mainMenu && mainMenu.children) {
|
||||||
@@ -182,10 +182,13 @@ export default {
|
|||||||
|
|
||||||
// 调用 authorityMenus 接口获取完整菜单数据
|
// 调用 authorityMenus 接口获取完整菜单数据
|
||||||
// 如果接口失败,会使用默认菜单配置和 menuIds 进行过滤
|
// 如果接口失败,会使用默认菜单配置和 menuIds 进行过滤
|
||||||
|
// 从框架实例获取 HomePage
|
||||||
|
const HomePage = (window.framework && window.framework.HomePage) || null
|
||||||
await dispatch('setAuthorityMenus', {
|
await dispatch('setAuthorityMenus', {
|
||||||
Main,
|
Main,
|
||||||
ParentView,
|
ParentView,
|
||||||
Page404,
|
Page404,
|
||||||
|
HomePage,
|
||||||
menuIds
|
menuIds
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -251,7 +251,16 @@ export default {
|
|||||||
let menuTree = uiTool.transformTree(menuRows)
|
let menuTree = uiTool.transformTree(menuRows)
|
||||||
this.gridOption.menuData = this.mapTree(menuTree)
|
this.gridOption.menuData = this.mapTree(menuTree)
|
||||||
|
|
||||||
this.$store.dispatch('setAuthorityMenus')
|
// 菜单更新后重新加载权限菜单
|
||||||
|
const framework = this.$framework || window.framework
|
||||||
|
if (framework) {
|
||||||
|
this.$store.dispatch('user/setAuthorityMenus', {
|
||||||
|
Main: framework.components.Main,
|
||||||
|
ParentView: framework.components.ParentView,
|
||||||
|
Page404: framework.pages.Page404,
|
||||||
|
HomePage: framework.HomePage
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
async initCol() {
|
async initCol() {
|
||||||
|
|||||||
Reference in New Issue
Block a user