Skip to content

Commit 16f51ed

Browse files
committed
fix: Single line multi select cards
1 parent 67bb0a0 commit 16f51ed

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ui/src/components/dynamics-form/items/MultiRow.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,17 @@ const selected = (activeValue: string | number) => {
3737
props.modelValue.filter((i: any) => i != activeValue),
3838
)
3939
} else {
40-
emit('update:modelValue', props.modelValue ? [...props.modelValue, activeValue] : [activeValue])
40+
emit('update:modelValue', reset(activeValue))
4141
}
4242
if (elFormItem?.validate) {
4343
elFormItem.validate('change')
4444
}
4545
}
46+
const reset = (activeValue: string) => {
47+
const _result = props.modelValue ? [...props.modelValue, activeValue] : [activeValue]
48+
return _result.filter((r) => option_value_list.value.includes(r))
49+
}
50+
4651
const _value = computed(() => {
4752
return props.modelValue ? props.modelValue : []
4853
})
@@ -55,7 +60,9 @@ const textField = computed(() => {
5560
const valueField = computed(() => {
5661
return props.formField.value_field ? props.formField.value_field : 'value'
5762
})
58-
63+
const option_value_list = computed(() => {
64+
return option_list.value.map((item) => item[valueField.value])
65+
})
5966
const option_list = computed(() => {
6067
return props.formField.option_list ? props.formField.option_list : []
6168
})

0 commit comments

Comments
 (0)