From db5aed78bc305815558e97f9a1110cc2fa993bc9 Mon Sep 17 00:00:00 2001 From: TreeWish <1131093754@qq.com> Date: 星期二, 28 二月 2023 22:11:57 +0800 Subject: [PATCH] 处理全国项目&单个项目数据 --- src/components/chart/BaseLineChart.vue | 30 +++++++++++++++++++++--------- 1 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/components/chart/BaseLineChart.vue b/src/components/chart/BaseLineChart.vue index fb37072..6cf4063 100644 --- a/src/components/chart/BaseLineChart.vue +++ b/src/components/chart/BaseLineChart.vue @@ -11,7 +11,9 @@ countZhPipeMapLength, countLargeCategories, countProjectType, - countProjectDown + countProjectDown, + countProjectTypeNumber, + countStorageByProject, } from "@/api/screen.js" export default { props: { @@ -62,11 +64,21 @@ option() { let xAxis = [] let yAxis = [] - - this.dataList.forEach(item => { - xAxis.push(item.type) - yAxis.push(item.count) - }) + const proObj = this.dataList.find(item => item.椤圭洰鍚嶇О == this.project) + if (proObj) { + Object.keys(proObj).forEach(item => { + if (item.toString() != '椤圭洰鍚嶇О') { + xAxis.push(item) + yAxis.push(proObj[item]) + } + }) + } else { + this.dataList.forEach(item => { + let type = item.type || item.projtype + xAxis.push(type) + yAxis.push(item.count) + }) + } // let data = [220, 182, 191, 234, 290, 330, 310] // const sideData = data.map(item => { @@ -164,10 +176,10 @@ let requsetFn = null switch (newVal) { case "鍏ㄧ悆椤圭洰": - requsetFn = countLargeCategories + requsetFn = countProjectTypeNumber break case "鍏ㄥ浗椤圭洰": - requsetFn = countLargeCategories + requsetFn = countProjectTypeNumber break case "鍏ㄧ悆绠$綉鍥�": requsetFn = countZhPipeMapLength @@ -176,7 +188,7 @@ requsetFn = countZhPipeMapLength break default: - requsetFn = GetServicesVisitsCount + requsetFn = countStorageByProject break } -- Gitblit v1.9.3