Kaynağa Gözat

fix: 租户切换返回首页失败

lfeish 1 yıl önce
ebeveyn
işleme
d6799d3b2e
1 değiştirilmiş dosya ile 4 ekleme ve 2 silme
  1. 4 2
      src/layout/components/Header/SwitchTenant.vue

+ 4 - 2
src/layout/components/Header/SwitchTenant.vue

@@ -20,6 +20,7 @@
   import { queryListTenant } from '@/api/tenant';
   import { useTargetTenantIdSetting } from '@/utils/useTargetTenantIdSetting';
   import { replaceParams } from '@/utils/helper/treeHelper';
+  import router from '@/router';
 
   interface TenantOption {
     label: string;
@@ -58,11 +59,12 @@
       cancelButtonText: '取消',
       type: 'warning',
     })
-      .then(() => {
+      .then(async () => {
         setValue(targetTenantId);
         currentTenant.value = Number(targetTenantId);
         // 统一返回首页
-        window.location.href = '/';
+        await router.push({ name: 'DashboardConsole' });
+        window.location.reload();
       })
       .catch(() => {
         ElMessage({