From a7d3fc21f4fd011841a08f143f3f0bbaa83280fd Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Thu, 18 Jan 2024 10:21:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=89=E6=8B=A9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90-=E6=B2=A1=E6=9C=89=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E7=9A=84=E7=A9=BA=E6=96=87=E4=BB=B6=E5=A4=B9=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=9C=A8=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/visualized/data/dataset/form/index.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/src/views/visualized/data/dataset/form/index.vue b/core/core-frontend/src/views/visualized/data/dataset/form/index.vue index 35ede323db..1a2903c342 100644 --- a/core/core-frontend/src/views/visualized/data/dataset/form/index.vue +++ b/core/core-frontend/src/views/visualized/data/dataset/form/index.vue @@ -212,6 +212,18 @@ const dfsName = (arr, id) => { return name } +const dfsChild = arr => { + return arr.filter(ele => { + if (ele.leaf) { + return true + } + if (!!ele.children?.length) { + ele.children = dfsChild(ele.children || []) + } + return !!ele.children?.length + }) +} + const getDsName = (id: string) => { return dfsName(state.dataSourceList, id) } @@ -860,9 +872,9 @@ const getDatasource = () => { getDatasourceList().then(res => { const _list = (res as unknown as DataSource[]) || [] if (_list && _list.length > 0 && _list[0].id === '0') { - state.dataSourceList = _list[0].children + state.dataSourceList = dfsChild(_list[0].children) } else { - state.dataSourceList = _list + state.dataSourceList = dfsChild(_list) } }) }