From 7e6c50ab8dfd5b67df1096ba8dca2949b4812219 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 18 Apr 2024 16:04:54 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E5=A4=96=E9=83=A8=E5=8F=82=E6=95=B0=E6=94=AF=E6=8C=81=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E7=BB=84=E4=BB=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/data-visualization/dvMain.ts | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/core/core-frontend/src/store/modules/data-visualization/dvMain.ts b/core/core-frontend/src/store/modules/data-visualization/dvMain.ts index 4342fcd17e..b06b47cf88 100644 --- a/core/core-frontend/src/store/modules/data-visualization/dvMain.ts +++ b/core/core-frontend/src/store/modules/data-visualization/dvMain.ts @@ -900,18 +900,36 @@ export const dvMainStore = defineStore('dataVisualization', { if (element.component === 'VQuery') { element.propValue.forEach(filterItem => { if (filterItem.id === targetViewId) { + let queryParams = paramValue + if (!['1', '7'].includes(filterItem.displayType)) { + // 查询组件除了时间组件 其他入参只支持文本 这里全部转为文本 + queryParams = paramValue.map(number => String(number)) + } filterItem.defaultValueCheck = true - if (filterItem.displayType === '0' && filterItem.multiple) { - filterItem.selectValue = paramValue - filterItem.defaultValue = paramValue - } else if (filterItem.displayType === '0' && !filterItem.multiple) { - filterItem.selectValue = paramValue[0] - filterItem.defaultValue = paramValue[0] + filterItem.timeType = 'fixed' + if (['0', '2'].includes(filterItem.displayType)) { + // 0 文本类型 1 数字类型 + if (filterItem.multiple) { + // multiple === true 多选 + filterItem.selectValue = queryParams + filterItem.defaultValue = queryParams + } else { + // 单选 + filterItem.selectValue = queryParams[0] + filterItem.defaultValue = queryParams[0] + } + } else if (filterItem.displayType === '1') { + // 1 时间类型 + filterItem.selectValue = queryParams[0] + filterItem.defaultValue = queryParams[0] + } else if (filterItem.displayType === '7') { + // 7 时间范围类型 + filterItem.selectValue = queryParams + filterItem.defaultValue = queryParams } else if (filterItem.displayType === '8') { - filterItem.conditionValueF = parmaValueSource - } else { - filterItem.selectValue = paramValue[0] - filterItem.defaultValue = paramValue[0] + // 8 文本搜索 + filterItem.conditionValueF = parmaValueSource + '' + filterItem.defaultConditionValueF = parmaValueSource + '' } } })