Compare commits

..

No commits in common. "8043571cec16c529141e800dd442288a2075ea67" and "59fab7c7117ffe9863f95aa212e9fb7f9cebc656" have entirely different histories.

2 changed files with 4 additions and 41 deletions

View File

@ -14,7 +14,6 @@ const props = withDefaults(
placeholder?: string;
sysOrigin: string;
value?: any;
valueField?: 'id' | 'regionCode';
}>(),
{
clearable: false,
@ -23,7 +22,6 @@ const props = withDefaults(
multiple: false,
placeholder: '请选择',
value: '',
valueField: 'id',
},
);
@ -38,10 +36,7 @@ const selectValue = ref<any>(props.value);
const regionOptions = computed(() =>
list.value.map((item) => ({
label: item.regionName || '-',
value:
props.valueField === 'regionCode'
? (item.regionCode || item.code || item.id)
: (item.id as any),
value: item.id as any,
})),
);
@ -72,13 +67,8 @@ watch(
function emitChange(value: any) {
emit('update:value', value);
const item = list.value.find((current) => {
const currentValue =
props.valueField === 'regionCode'
? current.regionCode || current.code || current.id
: current.id;
return String(currentValue) === String(value);
}) || null;
const item =
list.value.find((current) => String(current.id) === String(value)) || null;
emit('change', value, item);
}

View File

@ -10,7 +10,6 @@ import {
startRegionBroadcastWorker,
stopRegionBroadcastWorker,
} from '#/api/legacy/region-broadcast';
import { regionConfigTable } from '#/api/legacy/system';
import { getAllowedSysOrigins } from '#/views/system/shared';
import SystemRegionSelect from './components/system-region-select.vue';
@ -70,7 +69,6 @@ const form = reactive<Record<string, any>>({
const sending = ref(false);
const workerLoading = ref(false);
const resultText = ref('');
const regionList = ref<Array<Record<string, any>>>([]);
const workerStatus = ref<Record<string, any>>({});
const workerForm = reactive<Record<string, any>>({
betAmounts: '100,200,500,1000',
@ -105,20 +103,11 @@ watch(
form.regionCode = '';
workerForm.regionCodes = [];
if (value) {
void loadRegionList();
void refreshWorkerStatus();
}
},
);
async function loadRegionList() {
if (!form.sysOrigin) {
regionList.value = [];
return;
}
regionList.value = (await regionConfigTable({ sysOrigin: form.sysOrigin })) || [];
}
function handleRegionChange(_value: any, item: Record<string, any> | null) {
form.regionCode = item?.regionCode || item?.code || String(item?.id || '');
}
@ -210,25 +199,11 @@ function buildWorkerPayload() {
maxDelaySeconds: Number(workerForm.maxDelaySeconds || 0),
minDelaySeconds: Number(workerForm.minDelaySeconds || 0),
multiples: parseFloatList(workerForm.multiples),
regionCodes: normalizeWorkerRegionCodes(workerForm.regionCodes || []),
regionCodes: workerForm.regionCodes || [],
sysOrigin: form.sysOrigin,
};
}
function normalizeWorkerRegionCodes(values: any[]) {
return values
.map((value) => {
const raw = String(value || '').trim();
const item = regionList.value.find((region) =>
[region.id, region.regionCode, region.code, region.regionName]
.filter((current) => current !== undefined && current !== null)
.some((current) => String(current).trim() === raw),
);
return String(item?.regionCode || item?.code || item?.regionName || raw).trim();
})
.filter(Boolean);
}
async function refreshWorkerStatus() {
workerLoading.value = true;
try {
@ -239,7 +214,6 @@ async function refreshWorkerStatus() {
}
async function handleStartWorker() {
await loadRegionList();
const payload = buildWorkerPayload();
if (!payload.sysOrigin) {
message.warning('请选择系统来源');
@ -368,7 +342,6 @@ async function handleStopWorker() {
v-model:value="workerForm.regionCodes"
multiple
:sys-origin="form.sysOrigin"
value-field="regionCode"
placeholder="可多选"
/>
</FormItem>