fix(查询组件): 修复查询组件设置绑定值和显示值,查询结果错误的问题

This commit is contained in:
dataeaseShu 2024-04-28 10:35:34 +08:00
parent eb9ec20bee
commit e7438c7f2c
2 changed files with 27 additions and 9 deletions

View File

@ -437,6 +437,23 @@ const validate = () => {
return false
}
if (!ele.defaultValueCheck) {
const isMultiple = +ele.displayType === 7 || ele.multiple
ele.selectValue = isMultiple ? [] : undefined
ele.defaultValue = isMultiple ? [] : undefined
return false
}
if (ele.displayType === '1') {
if (!ele.defaultValueCheck) return false
if (ele.timeType === 'fixed') {
if (!ele.defaultValue) {
ElMessage.error('默认时间不能为空!')
return true
}
}
}
if (+ele.displayType === 7) {
if (!ele.defaultValueCheck) return false
if (ele.timeType === 'fixed') {
@ -520,12 +537,6 @@ const validate = () => {
return true
}
if (!ele.defaultValueCheck) {
const isMultiple = +ele.displayType === 7 || ele.multiple
ele.selectValue = isMultiple ? [] : undefined
ele.defaultValue = isMultiple ? [] : undefined
}
let displayTypeField = null
if (
ele.checkedFields.some(id => {

View File

@ -85,9 +85,14 @@ const getValueByDefaultValueCheckOrFirstLoad = (
defaultMapValue: any,
optionValueSource: number,
mapValue: any,
displayType: string
displayType: string,
displayId: string
) => {
if (optionValueSource === 1 && defaultMapValue?.length && ![1, 7].includes(+displayType)) {
if (
optionValueSource === 1 &&
(defaultMapValue?.length || displayId) &&
![1, 7].includes(+displayType)
) {
if (firstLoad) {
return defaultValueCheck ? defaultMapValue : multiple ? [] : ''
}
@ -208,6 +213,7 @@ export const searchQuery = (queryComponentList, filter, curComponentId, firstLoa
isTree = false,
timeGranularity = 'date',
displayType,
displayId,
multiple
} = item
@ -271,7 +277,8 @@ export const searchQuery = (queryComponentList, filter, curComponentId, firstLoa
defaultMapValue,
optionValueSource,
mapValue,
displayType
displayType,
displayId
)
}
if (