From 111e0f77b1db42925eed1e9e6d673c759bba6ba0 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 16 Oct 2024 14:39:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=A4=96=E9=83=A8=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=BB=98=E8=AE=A4=E5=80=BC=E9=85=8D=E7=BD=AE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=A0=BC=E5=BC=8F=E6=A0=A1=E9=AA=8C=E7=AD=89=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E8=A7=84=E8=8C=83=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../visualization/OuterParamsSet.vue | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/src/components/visualization/OuterParamsSet.vue b/core/core-frontend/src/components/visualization/OuterParamsSet.vue index 5a76a3a111..8e7ceecbe8 100644 --- a/core/core-frontend/src/components/visualization/OuterParamsSet.vue +++ b/core/core-frontend/src/components/visualization/OuterParamsSet.vue @@ -258,10 +258,20 @@ 默认值 + + + + + + { state.outerParamsSetVisible = false } +const jsonArrayCheck = params => { + try { + const result = JSON.parse(params) + return result instanceof Array + } catch (error) { + return false + } +} + const save = () => { const outerParamsCopy = deepCopy(state.outerParams) + let checkErrorNum = 0 + let checkMessage = '' outerParamsCopy.outerParamsInfoArray?.forEach(outerParamsInfo => { + if (outerParamsInfo.defaultValue && !jsonArrayCheck(outerParamsInfo.defaultValue)) { + checkErrorNum++ + checkMessage = checkMessage + `【${outerParamsInfo.paramName}】` + } outerParamsInfo.targetViewInfoList = [] outerParamsInfo.filterInfo?.forEach(baseFilterInfo => { // 存在过滤器选项被选 @@ -601,6 +628,14 @@ const save = () => { } }) }) + if (checkErrorNum > 0) { + ElMessage({ + message: `参数${checkMessage}默认值格式不正确!`, + type: 'warning', + showClose: true + }) + return + } updateOuterParamsSet(outerParamsCopy).then(() => { ElMessage({ message: t('commons.save_success'), @@ -1075,4 +1110,11 @@ defineExpose({ margin-bottom: 12px; margin-right: -80px; } + +.hint-icon { + cursor: pointer; + font-size: 14px; + color: #646a73; + margin: 10px 0 0 4px; +}