From 3f68396bc50764389138dc6c74c87f80a5482d76 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 28 Mar 2022 13:09:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BB=AA=E8=A1=A8=E6=9D=BF=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E5=8C=85=E5=90=ABtabs=E7=9A=84=E7=9B=AE?= =?UTF-8?q?=E6=A0=87=E4=BB=AA=E8=A1=A8=E6=9D=BF=E6=9D=A1=E4=BB=B6=E5=A4=B1?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/store/index.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index e893100ee2..9bac6b3524 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -258,6 +258,43 @@ const data = { } for (let index = 0; index < state.componentData.length; index++) { const element = state.componentData[index] + if (element.type && element.type === 'de-tabs') { + for (let idx = 0; idx < element.options.tabList.length; idx++) { + const ele = element.options.tabList[idx].content + if (!ele.type || ele.type !== 'view') continue + + const currentFilters = [] + + data.dimensionList.forEach(dimension => { + const sourceInfo = viewId + '#' + dimension.id + // 获取所有目标联动信息 + const targetInfoList = trackInfo[sourceInfo] || [] + targetInfoList.forEach(targetInfo => { + const targetInfoArray = targetInfo.split('#') + const targetViewId = targetInfoArray[0] // 目标视图 + if (ele.propValue.viewId === targetViewId) { // 如果目标视图 和 当前循环组件id相等 则进行条件增减 + const targetFieldId = targetInfoArray[1] // 目标视图列ID + const condition = new Condition('', targetFieldId, 'eq', [dimension.value], [targetViewId]) + condition.sourceViewId = viewId + let j = currentFilters.length + while (j--) { + const filter = currentFilters[j] + // 兼容性准备 viewIds 只会存放一个值 + if (targetFieldId === filter.fieldId && filter.viewIds.includes(targetViewId)) { + currentFilters.splice(j, 1) + } + } + // 不存在该条件 且 条件有效 直接保存该条件 + // !filterExist && vValid && currentFilters.push(condition) + currentFilters.push(condition) + } + }) + }) + + ele.linkageFilters = currentFilters + } + state.componentData[index] = element + } if (!element.type || element.type !== 'view') continue // const currentFilters = element.linkageFilters || [] // 当前联动filter // 联动的视图情况历史条件