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,