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({
|
||||
label: '',
|
||||
type: '',
|
||||
value: '',
|
||||
fieldtype: '',
|
||||
fieldname: '',
|
||||
options: '',
|
||||
})
|
||||
|
||||
@ -98,7 +98,7 @@ const loading = ref(false)
|
||||
|
||||
function updateValues() {
|
||||
let fieldVal = newValue.value
|
||||
if (field.value.type == 'Check') {
|
||||
if (field.value.fieldtype == 'Check') {
|
||||
fieldVal = fieldVal == 'Yes' ? 1 : 0
|
||||
}
|
||||
loading.value = true
|
||||
@ -111,12 +111,12 @@ function updateValues() {
|
||||
data: {
|
||||
[field.value.fieldname]: fieldVal || null,
|
||||
},
|
||||
}
|
||||
},
|
||||
).then(() => {
|
||||
field.value = {
|
||||
label: '',
|
||||
type: '',
|
||||
value: '',
|
||||
fieldtype: '',
|
||||
fieldname: '',
|
||||
options: '',
|
||||
}
|
||||
newValue.value = ''
|
||||
@ -143,9 +143,10 @@ function getSelectOptions(options) {
|
||||
}
|
||||
|
||||
function getValueComponent(f) {
|
||||
const { type, options } = f
|
||||
if (typeSelect.includes(type) || typeCheck.includes(type)) {
|
||||
const _options = type == 'Check' ? ['Yes', 'No'] : getSelectOptions(options)
|
||||
const { fieldtype, options } = f
|
||||
if (typeSelect.includes(fieldtype) || typeCheck.includes(fieldtype)) {
|
||||
const _options =
|
||||
fieldtype == 'Check' ? ['Yes', 'No'] : getSelectOptions(options)
|
||||
return h(FormControl, {
|
||||
type: 'select',
|
||||
options: _options.map((o) => ({
|
||||
@ -154,16 +155,16 @@ function getValueComponent(f) {
|
||||
})),
|
||||
modelValue: newValue.value,
|
||||
})
|
||||
} else if (typeLink.includes(type)) {
|
||||
if (type == 'Dynamic Link') {
|
||||
} else if (typeLink.includes(fieldtype)) {
|
||||
if (fieldtype == 'Dynamic Link') {
|
||||
return h(FormControl, { type: 'text' })
|
||||
}
|
||||
return h(Link, { class: 'form-control', doctype: options })
|
||||
} else if (typeNumber.includes(type)) {
|
||||
} else if (typeNumber.includes(fieldtype)) {
|
||||
return h(FormControl, { type: 'number' })
|
||||
} else if (typeDate.includes(type)) {
|
||||
} else if (typeDate.includes(fieldtype)) {
|
||||
return h(DatePicker)
|
||||
} else if (typeEditor.includes(type)) {
|
||||
} else if (typeEditor.includes(fieldtype)) {
|
||||
return h(TextEditor, {
|
||||
variant: 'outline',
|
||||
editorClass:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user