From 30d1e7dda2438203e7e0908718b2de2afcdbe305 Mon Sep 17 00:00:00 2001 From: Ming <739803697@qq.com> Date: Tue, 9 May 2023 10:09:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BA=A4=E4=BA=92=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=EF=BC=8C=E5=8F=AF=E4=BB=A5=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E5=88=86=E7=BB=84=E5=86=85=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChartEventInteraction/index.vue | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteraction/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteraction/index.vue index 636414ed..79928dba 100644 --- a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteraction/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteraction/index.vue @@ -169,7 +169,27 @@ const fnDimensionsAndSource = (interactOn: InteractEventOn | undefined) => { // 绑定组件列表 const fnEventsOptions = (): Array => { - const filterOptionList = chartEditStore.componentList.filter(item => { + // 扁平化树形数据 + const fnFlattern = ( + data: Array + ): Array => { + return data.reduce( + ( + iter: Array, + val: CreateComponentType | CreateComponentGroupType + ) => { + if (val.groupList && val.groupList.length > 0) { + iter.push(val) + } else { + iter.push(val) + } + return val.groupList ? [...iter, ...fnFlattern(val.groupList)] : iter + }, + [] + ) + } + + const filterOptionList = fnFlattern(chartEditStore.componentList).filter(item => { // 排除自己 const isNotSelf = item.id !== targetData.value.id // 排除静态组件