diff --git a/frontend/src/components/business/ms-menu/index.vue b/frontend/src/components/business/ms-menu/index.vue index 0dd83c1e6b..fb35e59b95 100644 --- a/frontend/src/components/business/ms-menu/index.vue +++ b/frontend/src/components/business/ms-menu/index.vue @@ -239,7 +239,9 @@ watchEffect(() => { if (switchOrgVisible.value || menuSwitchOrgVisible.value) { - getOrgList(); + if (appStore.packageType === 'enterprise' && licenseStore.hasLicense()) { + getOrgList(); + } nextTick(() => { // 打开组织列表时,滚动到当前组织 const activeOrgDom = document.querySelector('.switch-org-dropdown-list')?.querySelector('.active-org'); diff --git a/frontend/src/components/business/ms-top-menu/index.vue b/frontend/src/components/business/ms-top-menu/index.vue index e5d134b56e..da549d7fbb 100644 --- a/frontend/src/components/business/ms-top-menu/index.vue +++ b/frontend/src/components/business/ms-top-menu/index.vue @@ -21,10 +21,12 @@ import usePermission from '@/hooks/usePermission'; import appClientMenus from '@/router/app-menus'; import { useAppStore } from '@/store'; + import useLicenseStore from '@/store/modules/setting/license'; import { listenerRouteChange } from '@/utils/route-listener'; import { RouteEnum } from '@/enums/routeEnum'; + const licenseStore = useLicenseStore(); const copyRouters = cloneDeep(appClientMenus) as RouteRecordRaw[]; const permission = usePermission(); const appStore = useAppStore(); @@ -85,9 +87,9 @@ const filterMenuTopRouter = currentParent?.children?.filter((item: any) => { if (permission.accessRouter(item) && item.meta?.isTopMenu) { - if (item.name === RouteEnum.SETTING_SYSTEM_AUTHORIZED_MANAGEMENT) { - return appStore.packageType === 'enterprise'; - } + // if (item.name === RouteEnum.SETTING_SYSTEM_AUTHORIZED_MANAGEMENT) { + // return appStore.packageType === 'enterprise'; + // } return true; } return false; @@ -112,9 +114,30 @@ activeMenus.value = [appStore.getCurrentTopMenu?.name || '']; } - onBeforeMount(() => { - appStore.initSystemPackage(); - }); + watch( + () => appStore.currentOrgId, + async () => { + await appStore.initSystemPackage(); + if (appStore.packageType === 'enterprise') { + licenseStore.getValidateLicense(); + } + }, + { + immediate: true, + } + ); + + watch( + () => appStore.packageType, + (val) => { + const topMenus = appStore.getTopMenus; + if (val === 'enterprise') { + appStore.setTopMenus(topMenus); + } else { + appStore.setTopMenus(topMenus.filter((item) => item.name !== RouteEnum.SETTING_SYSTEM_AUTHORIZED_MANAGEMENT)); + } + } + );