From e94f304e4633a238e05aa449e4600746fb8f4625 Mon Sep 17 00:00:00 2001 From: weicw <594098497@qq.com> Date: Fri, 28 Jan 2022 07:12:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A9=BA=E6=B0=94=E6=95=B0=E6=8D=AE=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/atmosphere/air/statistic/base.vue | 97 +++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/src/views/atmosphere/air/statistic/base.vue b/src/views/atmosphere/air/statistic/base.vue index 040af09..c36c045 100644 --- a/src/views/atmosphere/air/statistic/base.vue +++ b/src/views/atmosphere/air/statistic/base.vue @@ -41,6 +41,9 @@ 县级模板导出 + + 站点模板导出 + @@ -382,6 +385,100 @@ export default { }) }, + exportPlaceFile() { + + const columns = [ + + { + title: "城市", + dataIndex: "city", + sorter: true, + }, + { + title: "站点名称", + dataIndex: "place", + sorter: true, + }, + { + title: "时间", + dataIndex: "monitorTime", + sorter: true, + customRender: ({text}) => moment(text).format("YYYY-MM-DD HH:mm") + }, + { + title: "二氧化硫浓度/(μg/m3)", + dataIndex: "so2", + sorter: true, + }, + { + title: "二氧化氮浓度/(μg/m3)", + dataIndex: "no2", + sorter: true, + }, + { + title: "可吸入颗粒物浓度/(μg/m3)", + dataIndex: "pm10", + sorter: true, + }, + { + title: "一氧化碳浓度/(mg/m3)", + dataIndex: "co", + sorter: true, + }, + { + title: "臭氧(O3)最大8小时滑动平均浓度/(μg/m3)", + dataIndex: "o3", + sorter: true, + }, + { + title: "细颗粒物浓度/(μg/m3)", + dataIndex: "pm25", + sorter: true, + }, + + { + title: "空气质量指数AQI", + dataIndex: "aqi", + sorter: true, + }, + { + title: "首要污染物", + dataIndex: "primaryPollutant", + sorter: true, + }, + { + title: "空气质量指数级别", + dataIndex: "aqiLevel", + sorter: true, + }, + { + title: "类别", + dataIndex: "airQualityStatus", + sorter: true, + }, + { + title: "备注", + dataIndex: "remark", + sorter: true, + }, + ]; + const arr = []; + const th = columns.map((item) => item.title); + arr.push(th); + listAllAir(this.where).then(res => { + if (res.data.code == 0) { + res.data.data.forEach((d) => { + const td = columns.map((item) => d[item.dataIndex]); + arr.push(td); + }); + let sheet = XLSX.utils.aoa_to_sheet(arr); + this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日") + "基础数据"); + + } + }) + + }, + }, };