feat: 统一IM后台商户文案和默认选择

This commit is contained in:
richjohnrambo
2026-09-09 14:28:44 +08:00
parent da60b52be2
commit 27a368b386
76 changed files with 272 additions and 186 deletions
+8
View File
@@ -3,11 +3,19 @@ import { List as TenantList } from '@/api/imTenant';
export const policyTenantOptions = ref<any[]>([{ label: '全局默认', value: 0 }]);
export function getDefaultTenantValue(options: any[]) {
const defaultTenant = options.find(
(item) => item.code === 'default' || String(item.label || '').includes('(default)')
);
return defaultTenant?.value || options.find((item) => Number(item.value) > 0)?.value || 0;
}
export async function loadPolicyTenantOptions(includeGlobal = true) {
const res = await TenantList({ page: 1, perPage: 100 });
const tenants = (res?.list || []).map((item) => ({
label: `${item.name}(${item.code})`,
value: item.id,
code: item.code,
}));
policyTenantOptions.value = includeGlobal
? [{ label: '全局默认', value: 0 }, ...tenants]