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