This commit is contained in:
weicw
2021-08-06 17:56:36 +08:00
parent 5bc27cb0ee
commit 29fbf507ae
3 changed files with 34 additions and 8 deletions

View File

@@ -33,8 +33,13 @@
</a-col>
</a-row>
</a-form>
<ele-pro-table ref="table" row-key="id" :datasource="url" :columns="columns" :where="where"
:scroll="{x: 'max-content'}" :rowClassName="(record, index) => (index % 2 === 1 ? 'table-striped' : null)">
<ele-pro-table ref="table" row-key="id" :datasource="url" :columns="columns" :where="where" :needPage="false"
@done="(d)=>data = d.data" :scroll="{x: 'max-content'}">
<template #toolbar>
<a-space>
<a-button @click="exportFile">导出excel</a-button>
</a-space>
</template>
</ele-pro-table>
</a-card>
@@ -44,6 +49,7 @@
<script>
import _ from "lodash";
import XLSX from 'xlsx';
import {
pageRoadNoiseStatisticUrl
} from "@/api/ecology/road-sound"
@@ -152,7 +158,7 @@
]
},
{
title: "SD",
title: "SDdB(A)",
children: [{
title: '平均',
dataIndex: 'avgSD',
@@ -177,7 +183,7 @@
]
},
{
title: "L10",
title: "L10dB(A)",
children: [
{
@@ -203,7 +209,7 @@
},
]
}, {
title: 'L50',
title: 'L50dB(A)',
children: [{
title: '平均',
dataIndex: 'avgL50',
@@ -228,7 +234,7 @@
]
},
{
title: "L90",
title: "L90dB(A)",
children: [
{
@@ -255,7 +261,7 @@
]
},
{
title: "Lmin",
title: "LmindB(A)",
children: [{
title: '平均',
dataIndex: 'avgLmin',
@@ -279,7 +285,7 @@
},
]
}, {
title: 'Lmax',
title: 'LmaxdB(A)',
children: [{
title: '平均',
dataIndex: 'avgLmax',
@@ -315,6 +321,7 @@
data() {
return {
url: pageRoadNoiseStatisticUrl,
data: [],
where: {
model: "place"
},
@@ -372,6 +379,21 @@
this.reload();
},
exportFile() {
let array = [
['测点', '路段', '城区', '路长', '路宽', '平均Leq', '平均SD']
];
this.data.forEach(d => {
array.push([d.place, d.road, d.area, d.roadLength, d.roadWidth, d.avgLeq, d.avgSD]);
});
let sheet = XLSX.utils.aoa_to_sheet(array);
// sheet['!merges'] = [
// {s: {r: 0, c: 1}, e: {r: 0, c: 5}}, // 合并第0行第1列到第0行第5列
// {s: {r: 0, c: 0}, e: {r: 1, c: 0}}, // 合并第0行第0列到第1行第0列
// {s: {r: 0, c: 6}, e: {r: 1, c: 6}} // 合并第0行第6列到第1行第6列
// ];
this.$util.exportSheet(XLSX, sheet, '道路交通噪声统计表');
}
}
}