From 69c7d5486c6d5addebc09a07941cb17129f918fe Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 3 Jan 2025 12:10:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF=E3=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=94=AF=E6=8C=81=E4=BC=A0=E5=85=A5=E6=AF=94?= =?UTF-8?q?=E5=AF=B9=E6=93=8D=E4=BD=9C=E6=A8=A1=E5=BC=8F=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=97=A5=E6=9C=9F=E8=B7=B3=E8=BD=AC=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=97=A0=E6=B3=95=E6=9F=A5=E8=AF=A2=E5=88=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=97=AE=E9=A2=98,=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/visualization/LinkJumpSet.vue | 2 +- .../modules/data-visualization/dvMain.ts | 41 +++++++++++++++---- core/core-frontend/src/utils/canvasUtils.ts | 2 +- .../views/chart/components/views/index.vue | 6 ++- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/core/core-frontend/src/components/visualization/LinkJumpSet.vue b/core/core-frontend/src/components/visualization/LinkJumpSet.vue index 2b9c3baa9b..438168e316 100644 --- a/core/core-frontend/src/components/visualization/LinkJumpSet.vue +++ b/core/core-frontend/src/components/visualization/LinkJumpSet.vue @@ -872,7 +872,7 @@ const save = () => { } } if (subCheckCount > 0) { - ElMessage.error(t('visualization.delete_warn', [linkJumpInfo.sourceFieldName])) + ElMessage.error(t('visualization.jump_null_tips', [linkJumpInfo.sourceFieldName])) } } }) 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 b052c194b3..f6fb2275af 100644 --- a/core/core-frontend/src/store/modules/data-visualization/dvMain.ts +++ b/core/core-frontend/src/store/modules/data-visualization/dvMain.ts @@ -1042,6 +1042,7 @@ export const dvMainStore = defineStore('dataVisualization', { addOuterParamsFilter(paramsPre, curComponentData = this.componentData, source = 'inner') { // params 结构 {key1:value1,key2:value2} const params = {} + const paramsVersion = (paramsPre && paramsPre['outerParamsVersion']) || 'v1' if (this.nowPanelOuterParamsBaseInfo) { let errorCount = 0 let errorMes = '' @@ -1079,7 +1080,14 @@ export const dvMainStore = defineStore('dataVisualization', { for (let index = 0; index < curComponentData.length; index++) { const element = curComponentData[index] if (['UserView', 'VQuery'].includes(element.component)) { - this.trackOuterFilterCursor(element, params, preActiveComponentIds, trackInfo, source) + this.trackOuterFilterCursor( + element, + params, + preActiveComponentIds, + trackInfo, + source, + paramsVersion + ) this.componentData[index] = element } else if (element.component === 'Group') { element.propValue.forEach((groupItem, index) => { @@ -1088,7 +1096,8 @@ export const dvMainStore = defineStore('dataVisualization', { params, preActiveComponentIds, trackInfo, - source + source, + paramsVersion ) element.propValue[index] = groupItem }) @@ -1100,7 +1109,8 @@ export const dvMainStore = defineStore('dataVisualization', { params, preActiveComponentIds, trackInfo, - source + source, + paramsVersion ) tabItem.componentData[index] = tabComponent }) @@ -1115,7 +1125,14 @@ export const dvMainStore = defineStore('dataVisualization', { useEmitt().emitter.emit('query-data-' + element.id) } }, - trackOuterFilterCursor(element, params, preActiveComponentIds, trackInfo, source) { + trackOuterFilterCursor( + element, + params, + preActiveComponentIds, + trackInfo, + source, + outerParamsVersion = 'v1' + ) { // 弹窗区域禁用时 在弹窗区域的组件不生效 if ( !['UserView', 'VQuery'].includes(element.component) || @@ -1127,9 +1144,17 @@ export const dvMainStore = defineStore('dataVisualization', { // 外部参数 可能会包含多个参数 Object.keys(params).forEach(function (sourceInfo) { // 获取外部参数的值 sourceInfo 是外部参数名称 支持数组传入 - let paramValue = params[sourceInfo] - let paramValueStr = params[sourceInfo] - const parmaValueSource = params[sourceInfo] + let operatorV2, paramValue, paramValueStr, parmaValueSource + if (outerParamsVersion === 'v2') { + operatorV2 = params[sourceInfo].operator + paramValue = params[sourceInfo].value + paramValueStr = params[sourceInfo].value + parmaValueSource = params[sourceInfo].value + } else { + paramValue = params[sourceInfo] + paramValueStr = params[sourceInfo] + parmaValueSource = params[sourceInfo] + } let operator = 'in' if (paramValue && !Array.isArray(paramValue)) { paramValue = [paramValue] @@ -1157,7 +1182,7 @@ export const dvMainStore = defineStore('dataVisualization', { const targetFieldId = targetInfoArray[1] // 目标图表列ID const condition = { fieldId: targetFieldId, - operator: operator, + operator: operatorV2 || operator, value: paramValue, viewIds: [targetViewId] } diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts index a931b584e9..6f3846cfdf 100644 --- a/core/core-frontend/src/utils/canvasUtils.ts +++ b/core/core-frontend/src/utils/canvasUtils.ts @@ -516,7 +516,7 @@ export function checkCanvasChangePre(callBack) { const tips = (dvInfo.value.type === 'dashboard' ? t('work_branch.dashboard') - : t('work_branch.big_data_screen')) + t('work_branch.save_conflict_tips') + : t('work_branch.big_data_screen')) + t('visualization.save_conflict_tips') checkCanvasChange(params).then(rsp => { if (rsp && rsp.data === 'Repeat') { ElMessageBox.confirm(tips, { diff --git a/core/core-frontend/src/views/chart/components/views/index.vue b/core/core-frontend/src/views/chart/components/views/index.vue index 4669ed2196..f76367c61b 100644 --- a/core/core-frontend/src/views/chart/components/views/index.vue +++ b/core/core-frontend/src/views/chart/components/views/index.vue @@ -495,13 +495,17 @@ const jumpClick = param => { curFilter.filter.forEach(filterItem => { targetViewInfoList.forEach(targetViewInfo => { if (targetViewInfo.sourceFieldActiveId === filterItem.filterId) { - filterOuterParams[targetViewInfo.outerParamsName] = filterItem.value + filterOuterParams[targetViewInfo.outerParamsName] = { + operator: filterItem.operator, + value: filterItem.value + } } }) }) } let attachParamsInfo if (Object.keys(filterOuterParams).length > 0) { + filterOuterParams['outerParamsVersion'] = 'v2' attachParamsInfo = '&attachParams=' + encodeURIComponent(Base64.encode(JSON.stringify(filterOuterParams))) }