Browse Source

fix: 修复切换租户的bug

louhangfei 11 months ago
parent
commit
bf7fd793eb
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/layout/components/SwitchTenant.vue

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

@@ -48,13 +48,13 @@
       currentTenant.value = nextTenantId;
       setValue(routeTenantId);
     } else {
-      currentTenant.value = getValue();
+      currentTenant.value = Number(getValue());
     }
     queryListTenant().then((res) => {
       if (!res) return;
       options.value = replaceParams(res || [], 'tenantName', 'id');
       /** 如果当前租户没选中的话,默认选中第一个 */
-      if (!currentTenant.value) {
+      if (!currentTenant.value && res.length > 1) {
         currentTenant.value = res[0].id;
       }
     });