From 0f509983f99371896bdf03709d7e865941bf4d49 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Tue, 25 Jun 2024 18:35:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6):=20?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v-query/ConditionDefaultConfiguration.vue | 2 + .../v-query/QueryConditionConfiguration.vue | 21 ++- .../src/custom-component/v-query/Tree.vue | 162 ++++++++++++++---- core/core-frontend/src/hooks/web/useFilter.ts | 24 ++- 4 files changed, 166 insertions(+), 43 deletions(-) diff --git a/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue b/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue index c4e1b55d2a..a1e4da2c58 100644 --- a/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue +++ b/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue @@ -194,10 +194,12 @@ const multipleChange = (val: boolean, isMultipleChange = false) => { : [] : defaultValue } + if (curComponent.value.field.deType === 1) { curComponent.value.multiple = val return } + curComponent.value.multiple = val } 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 18bc7f0316..cb7c45e7a3 100644 --- a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue +++ b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue @@ -364,7 +364,26 @@ const handleValueSourceChange = () => { } const multipleChange = (val: boolean, isMultipleChange = false) => { - defaultConfigurationRef.value?.multipleChange(val, isMultipleChange) + if (isMultipleChange) { + curComponent.value.defaultValue = val ? [] : undefined + } + const { defaultValue } = curComponent.value + if (Array.isArray(defaultValue)) { + curComponent.value.selectValue = val ? defaultValue : undefined + } else { + curComponent.value.selectValue = val + ? defaultValue !== undefined + ? [defaultValue] + : [] + : defaultValue + } + + if (curComponent.value.field.deType === 1) { + curComponent.value.multiple = val + return + } + + curComponent.value.multiple = val } const isInRange = (ele, startWindowTime, timeStamp) => { diff --git a/core/core-frontend/src/custom-component/v-query/Tree.vue b/core/core-frontend/src/custom-component/v-query/Tree.vue index 2179cef19f..44a2032f66 100644 --- a/core/core-frontend/src/custom-component/v-query/Tree.vue +++ b/core/core-frontend/src/custom-component/v-query/Tree.vue @@ -1,5 +1,5 @@ diff --git a/core/core-frontend/src/hooks/web/useFilter.ts b/core/core-frontend/src/hooks/web/useFilter.ts index c1273a2c82..cfa364e3e3 100644 --- a/core/core-frontend/src/hooks/web/useFilter.ts +++ b/core/core-frontend/src/hooks/web/useFilter.ts @@ -88,6 +88,20 @@ const getValueByDefaultValueCheckOrFirstLoad = ( displayType: string, displayId: string ) => { + if (+displayType === 9) { + if (firstLoad) { + return defaultValueCheck + ? multiple + ? defaultValue.map(ele => ele.split('-de-').join(',')) + : (defaultValue || '').split('-de-').join(',') + : [] + } + return selectValue?.length + ? multiple + ? selectValue.map(ele => ele.split('-de-').join(',')) + : (selectValue || '').split('-de-').join(',') + : [] + } if ( optionValueSource === 1 && (defaultMapValue?.length || displayId) && @@ -186,9 +200,8 @@ export const searchQuery = (queryComponentList, filter, curComponentId, firstLoa const { selectValue: value, timeGranularityMultiple, - parametersStart, - parametersEnd, conditionType = 0, + treeFieldList = [], defaultConditionValueOperatorF = 'eq', defaultConditionValueF = '', defaultConditionValueOperatorS = 'like', @@ -204,13 +217,14 @@ export const searchQuery = (queryComponentList, filter, curComponentId, firstLoa defaultMapValue, mapValue, parameters = [], - isTree = false, timeGranularity = 'date', displayType, displayId, multiple } = item + const isTree = +displayType === 9 + if (timeType === 'dynamic' && [1, 7].includes(+displayType) && firstLoad) { if (+displayType === 1) { selectValue = getDynamicRange(item) @@ -303,7 +317,9 @@ export const searchQuery = (queryComponentList, filter, curComponentId, firstLoa if (result?.length) { filter.push({ componentId: ele.id, - fieldId: item.checkedFieldsMap[curComponentId], + fieldId: isTree + ? treeFieldList.map(ele => ele.id).join(',') + : item.checkedFieldsMap[curComponentId], operator, value: result, parameters,