fix(系统设置): 修复修改权限后刷新页面菜单没有及时刷新的问题
--bug=1018835 --user=刘瑞斌 【系统设置】修改用户组权限后,刷新页面没生效,需要退出重新登录才行 https://www.tapd.cn/55049933/s/1295159
This commit is contained in:
parent
33b064b94c
commit
9039113a2e
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<el-menu menu-trigger="click" :default-active="$route.path"
|
||||
:default-openeds="opends"
|
||||
:key="menuKey"
|
||||
router class="setting">
|
||||
<el-submenu index="1" v-permission="systemPermission">
|
||||
<template v-slot:title>
|
||||
|
@ -27,11 +28,10 @@
|
|||
|
||||
<script>
|
||||
import Setting from "@/router/modules/setting";
|
||||
import {LicenseKey} from 'metersphere-frontend/src/utils/constants';
|
||||
import {hasLicense} from 'metersphere-frontend/src/utils/permission';
|
||||
|
||||
const component = null;
|
||||
import {hasLicense, hasPermission} from 'metersphere-frontend/src/utils/permission';
|
||||
import {useUserStore} from "@/store";
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
export default {
|
||||
name: "MsSettingMenu",
|
||||
|
@ -54,7 +54,7 @@ export default {
|
|||
return menus;
|
||||
};
|
||||
return {
|
||||
opends: ['0','1','2'],
|
||||
opends: ['0', '1', '2'],
|
||||
systems: getMenus('system'),
|
||||
workspaces: getMenus('workspace'),
|
||||
project: getMenus('project'),
|
||||
|
@ -66,32 +66,15 @@ export default {
|
|||
],
|
||||
workspacePermission: ['WORKSPACE_USER:READ', 'WORKSPACE_SERVICE:READ',
|
||||
'WORKSPACE_PROJECT_MANAGER:READ', 'WORKSPACE_PROJECT_ENVIRONMENT:READ',
|
||||
'WORKSPACE_OPERATING_LOG:READ']
|
||||
'WORKSPACE_OPERATING_LOG:READ'],
|
||||
menuKey: 0
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
valid() {
|
||||
Promise.all([component.default.valid(this)]).then(() => {
|
||||
let license = localStorage.getItem(LicenseKey);
|
||||
if (license !== "valid") {
|
||||
this.systems.forEach(item => {
|
||||
if (item.valid === true) {
|
||||
this.systems.splice(this.systems.indexOf(item), 1);
|
||||
}
|
||||
});
|
||||
this.workspaces.forEach(item => {
|
||||
if (item.valid === true) {
|
||||
this.workspaces.splice(this.workspaces.indexOf(item), 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {},
|
||||
mounted() {
|
||||
if (component != null) {
|
||||
this.valid();
|
||||
}
|
||||
userStore.$subscribe((mutation, state) => {
|
||||
this.menuKey++;
|
||||
});
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue