From 2f4933fcccbdee42f4d4b3510959ff4a7ceb1c8d Mon Sep 17 00:00:00 2001 From: dy-hu Date: Thu, 20 Jun 2024 10:42:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=9B=86=E5=90=88=E5=AD=90?= =?UTF-8?q?=E9=9B=86=E7=A9=BA=E6=95=B0=E7=BB=84=E4=B8=BAundefined=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=B9=B3=E5=8F=B0=E5=88=86=E7=B1=BB=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=97=B6=E5=8F=AF=E9=80=89=E5=88=B0=E5=AD=90=E5=88=86?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/renovation/commoditySystem/index.vue | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/views/renovation/commoditySystem/index.vue b/src/views/renovation/commoditySystem/index.vue index cb284fa..d1a4c2a 100644 --- a/src/views/renovation/commoditySystem/index.vue +++ b/src/views/renovation/commoditySystem/index.vue @@ -459,20 +459,19 @@ export default { page: 1, pageSize: 1000 }) - this.classList = res.data.list + this.classList = this.filterList(res.data.list) + }, - //处理集合子集空数组为undefined,解决平台分类选择时可选到分类 - this.classList.forEach(firstClass => { - if (firstClass.childs.length === 0) { - firstClass.childs = undefined - }else { - firstClass.childs.forEach(secondClass => { - if (secondClass.childs.length === 0){ - secondClass.childs = undefined - } - }) + //处理集合子集空数组为undefined,解决平台分类选择时可选到子分类 + filterList(data) { + data.forEach(i => { + if (i.childs.length) { + this.filterList(i.childs) + } else { + i.childs = null } }) + return data }, showClassSet(prod) {