From ab42544586ceb29048e3eb4b15bfe033771a2e6b Mon Sep 17 00:00:00 2001 From: zhaochencheng Date: Fri, 30 Dec 2022 21:24:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=BB=93=E6=9E=84=E7=94=B1=E5=90=8E=E7=AB=AF=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/pms/productCategory/index.vue | 30 ------------------------- 1 file changed, 30 deletions(-) diff --git a/src/views/pms/productCategory/index.vue b/src/views/pms/productCategory/index.vue index 517351c..5a4971e 100644 --- a/src/views/pms/productCategory/index.vue +++ b/src/views/pms/productCategory/index.vue @@ -165,37 +165,7 @@ export default { this.loading = true; const query = {...this.queryParams}; listPmsProductCategory(query).then(rows => { - const map = {} - rows.forEach(it => { - let list = map[it.parentId] - if (!list) { - list = []; - map[it.parentId] = list; - } - list.push(it); - }) - const idMap = {}; - rows.forEach((it, index) => idMap[it.id] = index); - const rows1= [...rows] - const removeIndex = new Set(); - for (let i = 0; i < rows1.length; i ++) { - if (removeIndex.has(i)) { - continue; - } - let n = rows1[i]; - while (idMap[n.parentId] !== undefined) { - removeIndex.add(idMap[n.id]); - n = rows[idMap[n.parentId]]; - n.children = map[n.id]; - continue; - } - } - const idxs = [...removeIndex].sort(); - for (let i = idxs.length - 1; i >= 0; i--) { - rows.splice(idxs[i], 1); - } this.pmsProductCategoryList = rows; - debugger this.loading = false; }); },