From d740fb786aa96422e2cf4e33023f63e599197ba6 Mon Sep 17 00:00:00 2001 From: xuxiaoming Date: Wed, 29 Dec 2021 00:06:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7=E6=A0=91?= =?UTF-8?q?=E5=8F=B6=E5=AD=90=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workbench/homePage/customer/index.vue | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/views/plan/workbench/homePage/customer/index.vue b/src/views/plan/workbench/homePage/customer/index.vue index 9ab3847..b297a1f 100644 --- a/src/views/plan/workbench/homePage/customer/index.vue +++ b/src/views/plan/workbench/homePage/customer/index.vue @@ -41,16 +41,7 @@ import { get } from "@/server/api.js"; // 获取客户列表树状图 get(`/admin/base/customer/customertree`).then(({ code, data }) => { if (code === 200) { - console.log('%cindex.vue line:44 data', 'color: #007acc;', data); - data.forEach(item => { - item.Children.forEach( child => { - child.Children.forEach( ch => { - ch.Label = ch.CustomerId + "-" + ch.Label - }) - }) - }) - this.customerData = data - + this.customerData = this.editTreeNode(data) if (this.currentCustomId) { data[0].Children.forEach(el => { el.Children.forEach(elChild => { @@ -68,7 +59,16 @@ import { get } from "@/server/api.js"; }) }, methods: { - + editTreeNode(data){ + data.forEach(item => { + if(!item.Children && typeof(item.Children) != 'undefined' && item.children != 0) { + item.Label = item.CustomerId + "-" + item.Label + } else { + this.editTreeNode(item.Children) + } + }) + return data + }, filterNode(value, data) { if (!value) return true return data.Label.indexOf(value) !== -1