区域飘屏
This commit is contained in:
parent
59fab7c711
commit
0ddf3bd3bd
@ -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<any>(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);
|
||||
}
|
||||
|
||||
|
||||
@ -342,6 +342,7 @@ async function handleStopWorker() {
|
||||
v-model:value="workerForm.regionCodes"
|
||||
multiple
|
||||
:sys-origin="form.sysOrigin"
|
||||
value-field="regionCode"
|
||||
placeholder="可多选"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user