diff --git a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue index 9a2f84bfa0..c2fbe13b36 100644 --- a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue +++ b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue @@ -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 => { diff --git a/core/core-frontend/src/hooks/web/useFilter.ts b/core/core-frontend/src/hooks/web/useFilter.ts index 4116247b81..b459d20bcd 100644 --- a/core/core-frontend/src/hooks/web/useFilter.ts +++ b/core/core-frontend/src/hooks/web/useFilter.ts @@ -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 (