From 0ddf3bd3bd95dd84998bfb4378765f347692e2a8 Mon Sep 17 00:00:00 2001 From: zhx Date: Mon, 25 May 2026 21:59:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E9=A3=98=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/components/system-region-select.vue | 16 +++++++++++++--- apps/src/views/operate/region-broadcast.vue | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/src/views/operate/components/system-region-select.vue b/apps/src/views/operate/components/system-region-select.vue index e321570..4aa81ba 100644 --- a/apps/src/views/operate/components/system-region-select.vue +++ b/apps/src/views/operate/components/system-region-select.vue @@ -14,6 +14,7 @@ const props = withDefaults( placeholder?: string; sysOrigin: string; value?: any; + valueField?: 'id' | 'regionCode'; }>(), { clearable: false, @@ -22,6 +23,7 @@ const props = withDefaults( multiple: false, placeholder: '请选择', value: '', + valueField: 'id', }, ); @@ -36,7 +38,10 @@ const selectValue = ref(props.value); const regionOptions = computed(() => list.value.map((item) => ({ label: item.regionName || '-', - value: item.id as any, + value: + props.valueField === 'regionCode' + ? (item.regionCode || item.code || item.id) + : (item.id as any), })), ); @@ -67,8 +72,13 @@ watch( function emitChange(value: any) { emit('update:value', value); - const item = - list.value.find((current) => String(current.id) === String(value)) || null; + 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; emit('change', value, item); } diff --git a/apps/src/views/operate/region-broadcast.vue b/apps/src/views/operate/region-broadcast.vue index 379b350..2d104b1 100644 --- a/apps/src/views/operate/region-broadcast.vue +++ b/apps/src/views/operate/region-broadcast.vue @@ -342,6 +342,7 @@ async function handleStopWorker() { v-model:value="workerForm.regionCodes" multiple :sys-origin="form.sysOrigin" + value-field="regionCode" placeholder="可多选" />