From dd470ba3282bd7e6f56a12088b49621942e9ec40 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Fri, 1 Mar 2024 13:38:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=A8=E5=B1=80bug=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/business/ms-menu/index.vue | 4 ++- .../components/business/ms-top-menu/index.vue | 35 +++++++++++++++---- .../pure/ms-form-create/locale/zh-CN.ts | 2 +- frontend/src/components/pure/navbar/index.vue | 3 ++ frontend/src/router/guard/userLoginInfo.ts | 4 --- frontend/src/store/modules/app/index.ts | 2 -- frontend/src/store/modules/setting/license.ts | 11 +++--- frontend/src/store/modules/user/index.ts | 3 +- .../components/caseTable.vue | 2 +- .../components/recycleCaseTable.vue | 8 ++--- .../template/components/fieldSetting.ts | 6 +++- .../organization/template/locale/en-US.ts | 4 +-- .../organization/template/locale/zh-CN.ts | 4 +-- 13 files changed, 55 insertions(+), 33 deletions(-) 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)); + } + } + );