From c277424db3cfee12991a86246afb28519410a19d Mon Sep 17 00:00:00 2001 From: jyt <1592211625@qq.com> Date: Tue, 26 Apr 2022 17:34:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A5=BC=E7=9B=98=E7=AD=9B=E9=80=89=20?= =?UTF-8?q?=E5=90=88=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Statistics/BuildingContrast.vue | 38 +++++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/src/views/Statistics/BuildingContrast.vue b/src/views/Statistics/BuildingContrast.vue index 9f0d48b..4132a62 100644 --- a/src/views/Statistics/BuildingContrast.vue +++ b/src/views/Statistics/BuildingContrast.vue @@ -52,11 +52,10 @@
- + @@ -329,6 +328,39 @@ export default { this.gethouseData(); }, methods: { + getSummaries(param) { + const { columns, data } = param; + const sums = []; + columns.forEach((column, index) => { + if (index === 0) { + sums[index] = '总价'; + return; + } + + const values = data.map(item => Number(item[column.property])); + if (!values.every(value => isNaN(value))) { + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr); + if (!isNaN(value)) { + return prev + curr; + } else { + return prev; + } + }, 0); + // sums[index] += ' 元'; + if (index === 7) { + sums[index] += '%'; + return; + } + if (index === 8) { + sums[index] += '%'; + return; + } + } + }); + sums[1] = 'N/A'; + return sums; + }, downLoad() { let pamaet = { orgType: this.role,