|
@@ -31,11 +31,8 @@
|
|
|
|
|
|
|
|
const userStore = useUserStore();
|
|
const userStore = useUserStore();
|
|
|
const { setValue, getValue } = useTargetTenantIdSetting();
|
|
const { setValue, getValue } = useTargetTenantIdSetting();
|
|
|
- const localTId = getValue();
|
|
|
|
|
- const tenantId = computed(() => {
|
|
|
|
|
- return userStore.info.tenantId;
|
|
|
|
|
- });
|
|
|
|
|
- const currentTenant = ref(localTId ? Number(localTId) : Number(tenantId.value));
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const currentTenant = ref();
|
|
|
const options = ref<TenantOption[]>([]);
|
|
const options = ref<TenantOption[]>([]);
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
@@ -50,10 +47,16 @@
|
|
|
const nextTenantId = Number(routeTenantId);
|
|
const nextTenantId = Number(routeTenantId);
|
|
|
currentTenant.value = nextTenantId;
|
|
currentTenant.value = nextTenantId;
|
|
|
setValue(routeTenantId);
|
|
setValue(routeTenantId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ currentTenant.value = getValue();
|
|
|
}
|
|
}
|
|
|
queryListTenant().then((res) => {
|
|
queryListTenant().then((res) => {
|
|
|
if (!res) return;
|
|
if (!res) return;
|
|
|
options.value = replaceParams(res || [], 'tenantName', 'id');
|
|
options.value = replaceParams(res || [], 'tenantName', 'id');
|
|
|
|
|
+ /** 如果当前租户没选中的话,默认选中第一个 */
|
|
|
|
|
+ if (!currentTenant.value) {
|
|
|
|
|
+ currentTenant.value = res[0].id;
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|