diff --git a/src/permission.js b/src/permission.js index e915f903..2411ca6a 100644 --- a/src/permission.js +++ b/src/permission.js @@ -66,7 +66,7 @@ router.beforeEach((to, from, next) => { // 根据 roles 权限生成可访问的路由表 router.addRoutes(accessRoutes) // 动态添加可访问路由表 const defaultPath = findDefaultPathFromMenus(userInfo.menus) || '/' - store.commit('permission/SET_DEFAULT_PATH', defaultPath) + store.dispatch('SetDefaultPath', defaultPath) // 仅当目标为根路径 '/' 时跳默认页;否则保持当前路径(含刷新场景),避免刷新被误判为“未匹配”而跳到默认页 if (to.path === '/') { next({ path: defaultPath, replace: true }) diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index b54b1531..e27c05ea 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -52,6 +52,9 @@ const permission = { commit('SET_TOPBAR_ROUTES', sidebarRoutes) resolve(rewriteRoutes) }) + }, + SetDefaultPath({commit}, path) { + commit('SET_DEFAULT_PATH', path) } } } diff --git a/src/views/home/components/budgetDetails.vue b/src/views/home/components/budgetDetails.vue index 486ded68..bf6b600f 100644 --- a/src/views/home/components/budgetDetails.vue +++ b/src/views/home/components/budgetDetails.vue @@ -316,6 +316,7 @@ export default { this.getDataPage(); }); this.$modal.msgSuccess("保存成功"); + this.$emit('updateLeft') }).catch(() => { }); }, // 请求下拉数据和表格数据(使用动态切换的getDataList接口)