空气数据导出
This commit is contained in:
@@ -35,7 +35,12 @@
|
|||||||
<a-space>
|
<a-space>
|
||||||
<a-button type="primary" @click="reload">查询</a-button>
|
<a-button type="primary" @click="reload">查询</a-button>
|
||||||
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置</a-button>
|
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置</a-button>
|
||||||
<a-button @click="exportFile" style="background: #2FA524FF; border-color: #2FA524FF;color: #FFFFFF">导出Excel</a-button>
|
<a-button @click="exportCityFile" style="background: #2FA524FF; border-color: #2FA524FF;color: #FFFFFF">
|
||||||
|
市级模板导出
|
||||||
|
</a-button>
|
||||||
|
<a-button @click="exportCountyFile" style="background: #2FA524FF; border-color: #2FA524FF;color: #FFFFFF">
|
||||||
|
县级模板导出
|
||||||
|
</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-form>
|
</a-form>
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
@@ -161,8 +166,8 @@ export default {
|
|||||||
{label: "县区", value: "county"},
|
{label: "县区", value: "county"},
|
||||||
{label: "站点", value: "place"},
|
{label: "站点", value: "place"},
|
||||||
],
|
],
|
||||||
placeOptions:[],
|
placeOptions: [],
|
||||||
time:[],
|
time: [],
|
||||||
// 表格搜索条件
|
// 表格搜索条件
|
||||||
where: {
|
where: {
|
||||||
checked: 1,
|
checked: 1,
|
||||||
@@ -202,42 +207,38 @@ export default {
|
|||||||
};
|
};
|
||||||
this.reload();
|
this.reload();
|
||||||
},
|
},
|
||||||
exportFile() {
|
exportCityFile() {
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
|
||||||
title: "监测日期",
|
|
||||||
dataIndex: "monitorTime",
|
|
||||||
sorter: true,
|
|
||||||
customRender: ({text}) => moment(text).format("YYYY-MM-DD HH:mm")
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: "城市",
|
title: "城市",
|
||||||
dataIndex: "city",
|
dataIndex: "city",
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "测点名称",
|
title: "时间",
|
||||||
dataIndex: "place",
|
dataIndex: "monitorTime",
|
||||||
sorter: true,
|
sorter: true,
|
||||||
|
customRender: ({text}) => moment(text).format("YYYY-MM-DD HH:mm")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "SO2/(μg/m3)",
|
title: "二氧化硫浓度/(μg/m3)",
|
||||||
dataIndex: "so2",
|
dataIndex: "so2",
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "NO2/(μg/m3)",
|
title: "二氧化氮浓度/(μg/m3)",
|
||||||
dataIndex: "no2",
|
dataIndex: "no2",
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "PM10/(μg/m3)",
|
title: "可吸入颗粒物浓度/(μg/m3)",
|
||||||
dataIndex: "pm10",
|
dataIndex: "pm10",
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "CO/(mg/m3)",
|
title: "一氧化碳浓度/(mg/m3)",
|
||||||
dataIndex: "co",
|
dataIndex: "co",
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
@@ -247,10 +248,11 @@ export default {
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "PM2.5",
|
title: "细颗粒物浓度/(μg/m3)",
|
||||||
dataIndex: "pm25",
|
dataIndex: "pm25",
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: "空气质量指数AQI",
|
title: "空气质量指数AQI",
|
||||||
dataIndex: "aqi",
|
dataIndex: "aqi",
|
||||||
@@ -266,11 +268,98 @@ export default {
|
|||||||
dataIndex: "aqiLevel",
|
dataIndex: "aqiLevel",
|
||||||
sorter: true,
|
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日") + "基础数据");
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
exportCountyFile() {
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: "测点名称",
|
||||||
|
dataIndex: "place",
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "日期",
|
||||||
|
dataIndex: "monitorTime",
|
||||||
|
sorter: true,
|
||||||
|
customRender: ({text}) => moment(text).format("YYYY-MM-DD")
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "空气质量状况",
|
title: "空气质量状况",
|
||||||
dataIndex: "airQualityStatus",
|
dataIndex: "airQualityStatus",
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "空气质量指数级别",
|
||||||
|
dataIndex: "aqiLevel",
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "AQI",
|
||||||
|
dataIndex: "aqi",
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "首要污染物",
|
||||||
|
dataIndex: "primaryPollutant",
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "SO2)",
|
||||||
|
dataIndex: "so2",
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "NO2",
|
||||||
|
dataIndex: "no2",
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "PM10",
|
||||||
|
dataIndex: "pm10",
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "CO",
|
||||||
|
dataIndex: "co",
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "O3-8h",
|
||||||
|
dataIndex: "o3",
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "PM2.5",
|
||||||
|
dataIndex: "pm25",
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "备注",
|
title: "备注",
|
||||||
dataIndex: "remark",
|
dataIndex: "remark",
|
||||||
|
|||||||
Reference in New Issue
Block a user