|
|
@@ -86,9 +86,15 @@ const Scan = defineAsyncComponent(() => import('./component/scan.vue'));
|
|
|
const route = useRoute();
|
|
|
const storesThemeConfig = useThemeConfig();
|
|
|
const { themeConfig } = storeToRefs(storesThemeConfig);
|
|
|
+type TenantOption = {
|
|
|
+ label: string;
|
|
|
+ host?: string | null;
|
|
|
+ value: string;
|
|
|
+};
|
|
|
+
|
|
|
const tenantInfo = ref({
|
|
|
id: undefined as number | undefined,
|
|
|
- list: [],
|
|
|
+ list: [] as TenantOption[],
|
|
|
});
|
|
|
|
|
|
const state = reactive({
|
|
|
@@ -115,9 +121,12 @@ const getTenantInfo = async () => {
|
|
|
return tenantInfo.value;
|
|
|
}
|
|
|
const host = location.host.toLowerCase();
|
|
|
- tenantInfo.value.list = await getAPI(SysTenantApi).apiSysTenantListGet().then(res => res.data.result ?? null);
|
|
|
- const tenant = tenantInfo.value.list.find((item: any) => !item.host && item.host === host) as any;
|
|
|
- if (tenant?.value) tenantInfo.value.id = parseInt(tenant?.value);
|
|
|
+ const result = await getAPI(SysTenantApi)
|
|
|
+ .apiSysTenantListGet()
|
|
|
+ .then((res) => res.data.result);
|
|
|
+ tenantInfo.value.list = Array.isArray(result) ? result : [];
|
|
|
+ const tenant = tenantInfo.value.list.find((item) => String(item?.host ?? '').trim().toLowerCase() === host);
|
|
|
+ if (tenant?.value) tenantInfo.value.id = parseInt(tenant.value);
|
|
|
return tenantInfo.value;
|
|
|
}
|
|
|
|