fix: 修复单选框多选框 选择器未使用label作为选项 (#1719)
This commit is contained in:
parent
f7588c0b28
commit
46c37257bc
@ -14,7 +14,6 @@ import JsonInput from '@/components/dynamics-form/items/JsonInput.vue'
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: any
|
modelValue: any
|
||||||
}>()
|
}>()
|
||||||
const formField = ref<any>({})
|
|
||||||
const emit = defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue'])
|
||||||
const formValue = computed({
|
const formValue = computed({
|
||||||
set: (item) => {
|
set: (item) => {
|
||||||
|
|||||||
@ -63,7 +63,7 @@
|
|||||||
<el-option
|
<el-option
|
||||||
v-for="(option, index) in formValue.option_list"
|
v-for="(option, index) in formValue.option_list"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="option.value"
|
:label="option.label"
|
||||||
:value="option.value"
|
:value="option.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
@ -102,8 +102,8 @@ const getData = () => {
|
|||||||
input_type: 'MultiSelect',
|
input_type: 'MultiSelect',
|
||||||
attrs: {},
|
attrs: {},
|
||||||
default_value: formValue.value.default_value,
|
default_value: formValue.value.default_value,
|
||||||
textField: 'label',
|
text_field: 'label',
|
||||||
valueField: 'value',
|
value_field: 'value',
|
||||||
option_list: formValue.value.option_list
|
option_list: formValue.value.option_list
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,7 +55,7 @@
|
|||||||
<el-option
|
<el-option
|
||||||
v-for="(option, index) in formValue.option_list"
|
v-for="(option, index) in formValue.option_list"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="option.value"
|
:label="option.label"
|
||||||
:value="option.value"
|
:value="option.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
@ -94,8 +94,8 @@ const getData = () => {
|
|||||||
input_type: 'SingleSelect',
|
input_type: 'SingleSelect',
|
||||||
attrs: {},
|
attrs: {},
|
||||||
default_value: formValue.value.default_value,
|
default_value: formValue.value.default_value,
|
||||||
textField: 'label',
|
text_field: 'label',
|
||||||
valueField: 'value',
|
value_field: 'value',
|
||||||
option_list: formValue.value.option_list
|
option_list: formValue.value.option_list
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -113,18 +113,19 @@ import { type FormInstance } from 'element-plus'
|
|||||||
import { ref, onMounted, computed } from 'vue'
|
import { ref, onMounted, computed } from 'vue'
|
||||||
import { input_type_list } from '@/components/dynamics-form/constructor/data'
|
import { input_type_list } from '@/components/dynamics-form/constructor/data'
|
||||||
import { MsgError } from '@/utils/message'
|
import { MsgError } from '@/utils/message'
|
||||||
import { set } from 'lodash'
|
import { set,cloneDeep } from 'lodash'
|
||||||
const props = defineProps<{ nodeModel: any }>()
|
const props = defineProps<{ nodeModel: any }>()
|
||||||
const formNodeFormRef = ref<FormInstance>()
|
const formNodeFormRef = ref<FormInstance>()
|
||||||
const editFormField = (form_field_data: any, field_index: number) => {
|
const editFormField = (form_field_data: any, field_index: number) => {
|
||||||
form_data.value.form_field_list = form_data.value.form_field_list.map(
|
const _value=form_data.value.form_field_list.map(
|
||||||
(item: any, index: number) => {
|
(item: any, index: number) => {
|
||||||
if (field_index === index) {
|
if (field_index === index) {
|
||||||
return form_field_data
|
return cloneDeep(form_field_data)
|
||||||
}
|
}
|
||||||
return item
|
return cloneDeep(item)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
form_data.value.form_field_list = _value
|
||||||
sync_form_field_list()
|
sync_form_field_list()
|
||||||
}
|
}
|
||||||
const addFormField = (form_field_data: any) => {
|
const addFormField = (form_field_data: any) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user