From 100f44e197dd99ff63220e2fa05d5c564f278aa6 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期日, 12 一月 2025 20:54:58 +0800 Subject: [PATCH] fix 修复 切换租户 tabs过多导致卡住问题 --- src/layout/components/Navbar.vue | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 49018ce..f821448 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -9,6 +9,7 @@ <el-select v-if="userId === 1 && tenantEnabled" v-model="companyName" + class="min-w-244px" clearable filterable reserve-keyword @@ -92,11 +93,12 @@ import useAppStore from '@/store/modules/app'; import useUserStore from '@/store/modules/user'; import useSettingsStore from '@/store/modules/settings'; +import useNoticeStore from '@/store/modules/notice'; import { getTenantList } from '@/api/login'; import { dynamicClear, dynamicTenant } from '@/api/system/tenant'; import { TenantVO } from '@/api/types'; import notice from './notice/index.vue'; -import useNoticeStore from '@/store/modules/notice'; +import router from '@/router'; const appStore = useAppStore(); const userStore = useUserStore(); @@ -125,21 +127,23 @@ if (companyName.value != null && companyName.value !== '') { await dynamicTenant(tenantId); dynamic.value = true; - proxy?.$tab.closeAllPage(); - proxy?.$router.push('/'); + await proxy?.$router.push('/'); + await proxy?.$tab.closeAllPage(); + await proxy?.$tab.refreshPage(); } }; const dynamicClearEvent = async () => { await dynamicClear(); dynamic.value = false; - proxy?.$tab.closeAllPage(); - proxy?.$router.push('/'); + await proxy?.$router.push('/'); + await proxy?.$tab.closeAllPage(); + await proxy?.$tab.refreshPage(); }; /** 绉熸埛鍒楄〃 */ const initTenantList = async () => { - const { data } = await getTenantList(); + const { data } = await getTenantList(true); tenantEnabled.value = data.tenantEnabled === undefined ? true : data.tenantEnabled; if (tenantEnabled.value) { tenantList.value = data.voList; @@ -160,8 +164,14 @@ cancelButtonText: '鍙栨秷', type: 'warning' }); - await userStore.logout(); - location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index'; + userStore.logout().then(() => { + router.replace({ + path: '/login', + query: { + redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/') + } + }); + }); }; const emits = defineEmits(['setLayout']); -- Gitblit v1.9.3