fix: fieldtype of value is not changing based on selected field's fieldtype
This commit is contained in:
parent
c104b1b8b4
commit
27f87883f7
@ -88,8 +88,8 @@ const recordCount = computed(() => props.selectedValues?.size || 0)
|
|||||||
|
|
||||||
const field = ref({
|
const field = ref({
|
||||||
label: '',
|
label: '',
|
||||||
type: '',
|
fieldtype: '',
|
||||||
value: '',
|
fieldname: '',
|
||||||
options: '',
|
options: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ const loading = ref(false)
|
|||||||
|
|
||||||
function updateValues() {
|
function updateValues() {
|
||||||
let fieldVal = newValue.value
|
let fieldVal = newValue.value
|
||||||
if (field.value.type == 'Check') {
|
if (field.value.fieldtype == 'Check') {
|
||||||
fieldVal = fieldVal == 'Yes' ? 1 : 0
|
fieldVal = fieldVal == 'Yes' ? 1 : 0
|
||||||
}
|
}
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@ -111,12 +111,12 @@ function updateValues() {
|
|||||||
data: {
|
data: {
|
||||||
[field.value.fieldname]: fieldVal || null,
|
[field.value.fieldname]: fieldVal || null,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
).then(() => {
|
).then(() => {
|
||||||
field.value = {
|
field.value = {
|
||||||
label: '',
|
label: '',
|
||||||
type: '',
|
fieldtype: '',
|
||||||
value: '',
|
fieldname: '',
|
||||||
options: '',
|
options: '',
|
||||||
}
|
}
|
||||||
newValue.value = ''
|
newValue.value = ''
|
||||||
@ -143,9 +143,10 @@ function getSelectOptions(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getValueComponent(f) {
|
function getValueComponent(f) {
|
||||||
const { type, options } = f
|
const { fieldtype, options } = f
|
||||||
if (typeSelect.includes(type) || typeCheck.includes(type)) {
|
if (typeSelect.includes(fieldtype) || typeCheck.includes(fieldtype)) {
|
||||||
const _options = type == 'Check' ? ['Yes', 'No'] : getSelectOptions(options)
|
const _options =
|
||||||
|
fieldtype == 'Check' ? ['Yes', 'No'] : getSelectOptions(options)
|
||||||
return h(FormControl, {
|
return h(FormControl, {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
options: _options.map((o) => ({
|
options: _options.map((o) => ({
|
||||||
@ -154,16 +155,16 @@ function getValueComponent(f) {
|
|||||||
})),
|
})),
|
||||||
modelValue: newValue.value,
|
modelValue: newValue.value,
|
||||||
})
|
})
|
||||||
} else if (typeLink.includes(type)) {
|
} else if (typeLink.includes(fieldtype)) {
|
||||||
if (type == 'Dynamic Link') {
|
if (fieldtype == 'Dynamic Link') {
|
||||||
return h(FormControl, { type: 'text' })
|
return h(FormControl, { type: 'text' })
|
||||||
}
|
}
|
||||||
return h(Link, { class: 'form-control', doctype: options })
|
return h(Link, { class: 'form-control', doctype: options })
|
||||||
} else if (typeNumber.includes(type)) {
|
} else if (typeNumber.includes(fieldtype)) {
|
||||||
return h(FormControl, { type: 'number' })
|
return h(FormControl, { type: 'number' })
|
||||||
} else if (typeDate.includes(type)) {
|
} else if (typeDate.includes(fieldtype)) {
|
||||||
return h(DatePicker)
|
return h(DatePicker)
|
||||||
} else if (typeEditor.includes(type)) {
|
} else if (typeEditor.includes(fieldtype)) {
|
||||||
return h(TextEditor, {
|
return h(TextEditor, {
|
||||||
variant: 'outline',
|
variant: 'outline',
|
||||||
editorClass:
|
editorClass:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user