区域识别
This commit is contained in:
parent
1c3c0f072c
commit
200e1c6fad
@ -547,13 +547,17 @@ async function loadImGroupList() {
|
|||||||
listVoiceRoomRegionImGroups({ sysOrigin: imGroupQuery.sysOrigin }),
|
listVoiceRoomRegionImGroups({ sysOrigin: imGroupQuery.sysOrigin }),
|
||||||
]);
|
]);
|
||||||
const groupMap = new Map(
|
const groupMap = new Map(
|
||||||
(groups || []).map((item) => [String(item.regionCode || ''), item]),
|
(groups || []).map((item) => [
|
||||||
|
normalizeRegionCodeKey(item.regionCode),
|
||||||
|
item,
|
||||||
|
]),
|
||||||
);
|
);
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
const rows: Array<Record<string, any>> = (regions || []).map((region) => {
|
const rows: Array<Record<string, any>> = (regions || []).map((region) => {
|
||||||
const regionCode = String(region.regionCode || '');
|
const regionCode = String(region.regionCode || '');
|
||||||
const group = groupMap.get(regionCode) || {};
|
const regionKey = normalizeRegionCodeKey(regionCode);
|
||||||
seen.add(regionCode);
|
const group = groupMap.get(regionKey) || {};
|
||||||
|
seen.add(regionKey);
|
||||||
return {
|
return {
|
||||||
...region,
|
...region,
|
||||||
configured: Boolean(group.configured),
|
configured: Boolean(group.configured),
|
||||||
@ -566,7 +570,8 @@ async function loadImGroupList() {
|
|||||||
});
|
});
|
||||||
for (const group of groups || []) {
|
for (const group of groups || []) {
|
||||||
const regionCode = String(group.regionCode || '');
|
const regionCode = String(group.regionCode || '');
|
||||||
if (seen.has(regionCode)) {
|
const regionKey = normalizeRegionCodeKey(regionCode);
|
||||||
|
if (seen.has(regionKey)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
rows.push({
|
rows.push({
|
||||||
@ -587,6 +592,10 @@ async function loadImGroupList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeRegionCodeKey(value: unknown) {
|
||||||
|
return String(value ?? '').trim().toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
async function loadCountryOptions() {
|
async function loadCountryOptions() {
|
||||||
countries.value = (await getCountryAlls()) || [];
|
countries.value = (await getCountryAlls()) || [];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user