区域飘屏
This commit is contained in:
parent
59fab7c711
commit
0ddf3bd3bd
@ -14,6 +14,7 @@ const props = withDefaults(
|
|||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
sysOrigin: string;
|
sysOrigin: string;
|
||||||
value?: any;
|
value?: any;
|
||||||
|
valueField?: 'id' | 'regionCode';
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
clearable: false,
|
clearable: false,
|
||||||
@ -22,6 +23,7 @@ const props = withDefaults(
|
|||||||
multiple: false,
|
multiple: false,
|
||||||
placeholder: '请选择',
|
placeholder: '请选择',
|
||||||
value: '',
|
value: '',
|
||||||
|
valueField: 'id',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -36,7 +38,10 @@ const selectValue = ref<any>(props.value);
|
|||||||
const regionOptions = computed(() =>
|
const regionOptions = computed(() =>
|
||||||
list.value.map((item) => ({
|
list.value.map((item) => ({
|
||||||
label: item.regionName || '-',
|
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) {
|
function emitChange(value: any) {
|
||||||
emit('update:value', value);
|
emit('update:value', value);
|
||||||
const item =
|
const item = list.value.find((current) => {
|
||||||
list.value.find((current) => String(current.id) === String(value)) || null;
|
const currentValue =
|
||||||
|
props.valueField === 'regionCode'
|
||||||
|
? current.regionCode || current.code || current.id
|
||||||
|
: current.id;
|
||||||
|
return String(currentValue) === String(value);
|
||||||
|
}) || null;
|
||||||
emit('change', value, item);
|
emit('change', value, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -342,6 +342,7 @@ async function handleStopWorker() {
|
|||||||
v-model:value="workerForm.regionCodes"
|
v-model:value="workerForm.regionCodes"
|
||||||
multiple
|
multiple
|
||||||
:sys-origin="form.sysOrigin"
|
:sys-origin="form.sysOrigin"
|
||||||
|
value-field="regionCode"
|
||||||
placeholder="可多选"
|
placeholder="可多选"
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user