区域识别

This commit is contained in:
zhx 2026-05-09 17:44:21 +08:00
parent 1c3c0f072c
commit 200e1c6fad

View File

@ -547,13 +547,17 @@ async function loadImGroupList() {
listVoiceRoomRegionImGroups({ sysOrigin: imGroupQuery.sysOrigin }),
]);
const groupMap = new Map(
(groups || []).map((item) => [String(item.regionCode || ''), item]),
(groups || []).map((item) => [
normalizeRegionCodeKey(item.regionCode),
item,
]),
);
const seen = new Set<string>();
const rows: Array<Record<string, any>> = (regions || []).map((region) => {
const regionCode = String(region.regionCode || '');
const group = groupMap.get(regionCode) || {};
seen.add(regionCode);
const regionKey = normalizeRegionCodeKey(regionCode);
const group = groupMap.get(regionKey) || {};
seen.add(regionKey);
return {
...region,
configured: Boolean(group.configured),
@ -566,7 +570,8 @@ async function loadImGroupList() {
});
for (const group of groups || []) {
const regionCode = String(group.regionCode || '');
if (seen.has(regionCode)) {
const regionKey = normalizeRegionCodeKey(regionCode);
if (seen.has(regionKey)) {
continue;
}
rows.push({
@ -587,6 +592,10 @@ async function loadImGroupList() {
}
}
function normalizeRegionCodeKey(value: unknown) {
return String(value ?? '').trim().toUpperCase();
}
async function loadCountryOptions() {
countries.value = (await getCountryAlls()) || [];
}