This commit is contained in:
weicw
2021-10-06 06:07:11 +08:00
parent dffbbb2763
commit 2a59762ef5
12 changed files with 1357 additions and 642 deletions

View File

@@ -66,6 +66,15 @@ const statisticUrl = "/ambientAir/ambientAir/statistic";
//城区统计 //城区统计
const statisticAreaBase = "/ambientAir/ambientAir/statistic/areaBase"; const statisticAreaBase = "/ambientAir/ambientAir/statistic/areaBase";
const statisticArea = "/ambientAir/ambientAir/statistic/area"; const statisticArea = "/ambientAir/ambientAir/statistic/area";
// 排行
const airDayRankUrl = "/zhenQiWang/ambientAirZhenqiCityDayAqiRankData";
const airMonthRankUrl = "/zhenQiWang/ambientAirZhenqiCityMonthComprehensiveAqiRankData/page";
const airMonthProvincialCapitalRankUrl = "/zhenQiWang/ambientAirZhenqiCityMonthComprehensiveAqiRankData/listProvincialCapitalRank";
const airYearRankUrl = "/zhenQiWang/ambientAirZhenqiCityYearComprehensiveAqiRankData/page";
const airYearProvincialCapitalRankUrl = "/zhenQiWang/ambientAirZhenqiCityYearComprehensiveAqiRankData/listProvincialCapitalRank";
const airPm25YearRankUrl = "/zhenQiWang/ambientAirZhenqiCityYearPm25RankData/page";
const airPm25YearProvincialCapitalRankUrl = "/zhenQiWang/ambientAirZhenqiCityYearPm25RankData/listProvincialCapitalRank";
export { export {
pageBillUrl, pageBillUrl,
saveAirBill, saveAirBill,
@@ -84,6 +93,13 @@ export {
statisticAvg, statisticAvg,
statisticUrl, statisticUrl,
statisticAreaBase, statisticAreaBase,
statisticArea statisticArea,
airDayRankUrl,
airMonthRankUrl,
airYearRankUrl,
airPm25YearRankUrl,
airYearProvincialCapitalRankUrl,
airPm25YearProvincialCapitalRankUrl,
airMonthProvincialCapitalRankUrl
} }

View File

@@ -41,11 +41,11 @@ export default {
}, },
methods: { methods: {
/* 导入本地excel文件 */ /* 导入本地excel文件 */
importFileCity(file) { async importFileCity(file) {
const hide = this.$message.loading("导入中..", 0); const hide = this.$message.loading("导入中..", 0);
let reader = new FileReader(); let reader = new FileReader();
reader.onload = (e) => { reader.onload = async (e) => {
try { try {
let data = new Uint8Array(e.target.result); let data = new Uint8Array(e.target.result);
let workbook = XLSX.read(data, { let workbook = XLSX.read(data, {
@@ -64,7 +64,7 @@ export default {
}); });
// 解析成对象数组 // 解析成对象数组
const billName = aoa[0][0] + aoa[1][0]; const billName = aoa[0][0] + aoa[1][0];
const billData = utils.toObjData(acidList, new Date(reportDate).getFullYear()); const billData = await utils.toObjData(acidList, new Date(reportDate).getFullYear());
if ( if (
!billData || !billData ||

View File

@@ -1,6 +1,13 @@
import moment from "moment"; import moment from "moment"
import axios from "axios";
import {listAllUrl} from "@/api/ecology/atmosphere/acid-rain-plcae"
export default { export default {
toObjData(excelData,monitorYear) { async toObjData(excelData,monitorYear) {
const res = await axios.get(listAllUrl,{params:{year:monitorYear}})
if(res.data.code !=0){
return Promise.reject(monitorYear +"点位字典未设置");
}
const dict = res.data.data;
return excelData.map(item => { return excelData.map(item => {
const monitorTime = moment(monitorYear + "."+item[1],"Y.M.D"); const monitorTime = moment(monitorYear + "."+item[1],"Y.M.D");
const monitorStartTime = moment(`${monitorYear}.${item[2]}.${item[3]} ${item[4]}:${item[5]}`,"Y.M.D H:m"); const monitorStartTime = moment(`${monitorYear}.${item[2]}.${item[3]} ${item[4]}:${item[5]}`,"Y.M.D H:m");
@@ -8,6 +15,7 @@ export default {
console.log(item); console.log(item);
const row = { const row = {
city: "南宁市", city: "南宁市",
place: dict.find(p=>p.placeCode = item[0].split("~")[0]).place,
code: item[0], code: item[0],
precipitationType:item[10], precipitationType:item[10],
precipitation:item[11], precipitation:item[11],

View File

@@ -44,13 +44,13 @@
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" :wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
> >
<a-form-item label="新年份" name="nYear"> <a-form-item label="新年份" name="nYear">
<a-input-number id="inputNumber" v-model:value="nYear" :min="1970" :max="2050" /> <a-input-number id="inputNumber" v-model:value="nYear" :min="1970" :max="2050"/>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
<a-modal <a-modal
v-model:visible="showEdit" v-model:visible="showEdit"
:title="form.roadNoisePlaceId !== undefined ? '修改' : '添加'" :title="form.acidRainPlaceBaseInfoDictId !== undefined ? '修改' : '添加'"
:confirm-loading="loading" :confirm-loading="loading"
:width="800" :width="800"
:body-style="{ paddingBottom: '8px' }" :body-style="{ paddingBottom: '8px' }"
@@ -64,55 +64,25 @@
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" :wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
> >
<a-form-item label="年份" name="year"> <a-form-item label="年份" name="year">
<a-input-number v-model:value="form.year" :min="1970" :max="2050" /> <a-input-number v-model:value="form.year" :min="1970" :max="2050"/>
</a-form-item> </a-form-item>
<a-form-item label="点名称" name="placeName"> <a-form-item label="点名称" name="place">
<a-input v-model:value="form.placeName" placeholder="请输入点名称" allow-clear/> <a-input v-model:value="form.place" placeholder="请输入点名称" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="测点经度" name="placeLng"> <a-form-item label="属性" name="attribute">
<a-input v-model:value="form.placeLng" placeholder="请输入测点经度" allow-clear/> <a-input v-model:value="form.attribute" placeholder="请输入点位属性" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="测点纬度" name="placeLat"> <a-form-item label="ph限值" name="ph">
<a-input v-model:value="form.placeLat" placeholder="请输入测点纬度" allow-clear/> <a-input type="number" v-model:value="form.ph" placeholder="请输入ph限值" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="机动车车道数" name="motorway"> <a-form-item label="点位编号" name="placeCode">
<a-input type="number" v-model:value="form.motorway" placeholder="请输入机动车车道数" allow-clear/> <a-input v-model:value="form.placeCode" placeholder="请输入点位编号" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="车道类别" name="motorwayType"> <a-form-item label="点位经度" name="longitude">
<a-input v-model:value="form.motorwayType" placeholder="请输入车道类别" allow-clear/> <a-input type="number" v-model:value="form.longitude" placeholder="请输入点位经度" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="道路等级" name="motorwayLevel"> <a-form-item label="点位纬度" name="latitude">
<a-input v-model:value="form.motorwayLevel" placeholder="请输入道路等级" allow-clear/> <a-input type="number" v-model:value="form.latitude" placeholder="请输入点位纬度" allow-clear/>
</a-form-item>
<a-form-item label="测点参照物" name="refObj">
<a-input v-model:value="form.refObj" placeholder="请输入测点参照物" allow-clear/>
</a-form-item>
<a-form-item label="道路覆盖人口(万人)" name="people">
<a-input v-model:value="form.people" placeholder="请输入道路覆盖人口(万人)" allow-clear/>
</a-form-item>
<a-form-item label="监测站名" name="station">
<a-input v-model:value="form.station" placeholder="请输入监测站名" allow-clear/>
</a-form-item>
<a-form-item label="监测仪器型号" name="monitorInstrumentModel">
<a-input v-model:value="form.monitorInstrumentModel" placeholder="请输入测监测仪器型号" allow-clear/>
</a-form-item>
<a-form-item label="监测仪器编号" name="monitorInstrumentCode">
<a-input v-model:value="form.monitorInstrumentCode" placeholder="请输入监测仪器编号" allow-clear/>
</a-form-item>
<a-form-item label="监测前校准值" name="beforeMonitorValue">
<a-input v-model:value="form.beforeMonitorValue" placeholder="请输入监测前校准值" allow-clear/>
</a-form-item>
<a-form-item label="监测后校准值" name="afterMonitorValue">
<a-input v-model:value="form.afterMonitorValue" placeholder="请输入监测后校准值" allow-clear/>
</a-form-item>
<a-form-item label="声校准器测量声压值" name="soundPressureValue">
<a-input v-model:value="form.soundPressureValue" placeholder="请输入声校准器测量声压值" allow-clear/>
</a-form-item>
<a-form-item label="声校准仪器型号" name="soundInstrumentModel">
<a-input v-model:value="form.soundInstrumentModel" placeholder="请输入声校准仪器型号" allow-clear/>
</a-form-item>
<a-form-item label="声校准仪器编号" name="soundInstrumentCode">
<a-input v-model:value="form.soundInstrumentCode" placeholder="请输入声校准仪器编号" allow-clear/>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
@@ -120,13 +90,13 @@
<ele-pro-table <ele-pro-table
v-model:selection="selectionList" v-model:selection="selectionList"
ref="table" ref="table"
row-key="roadNoisePlaceId"
:datasource="url" :datasource="url"
:columns="columns" :columns="columns"
:where="where" :where="where"
:scroll="{ x: 'max-content' }" :scroll="{ x: 'max-content' }"
:need-page="false" :need-page="false"
@done="(d) => (data = d.data)" @done="(d) => (data = d.data)"
> >
<template #toolbar> <template #toolbar>
<a-space> <a-space>
@@ -211,6 +181,8 @@ export default {
data() { data() {
return { return {
data: [], data: [],
// 表格数据接口 // 表格数据接口
url: listAllUrl, url: listAllUrl,
selection: [], selection: [],
@@ -226,6 +198,21 @@ export default {
dataIndex: "place", dataIndex: "place",
sorter: true, sorter: true,
}, },
{
title: "点位编号",
dataIndex: "placeCode",
sorter: true,
},
{
title: "属性",
dataIndex: "attribute",
sorter: true,
},
{
title: "ph限值",
dataIndex: "ph",
sorter: true,
},
{ {
title: "经度", title: "经度",
dataIndex: "longitude", dataIndex: "longitude",
@@ -254,17 +241,17 @@ export default {
selectionList: [], selectionList: [],
// 是否显示编辑弹窗 // 是否显示编辑弹窗
showEdit: false, showEdit: false,
showNYear:false, showNYear: false,
cYear: undefined, cYear: undefined,
nYear:undefined, nYear: undefined,
// 表单数据 // 表单数据
form: {}, form: {},
loading: false, loading: false,
rules: { rules: {
year: [{required: true, message: '请输入年份'}], year: [{required: true, message: '请输入年份'}],
placeName: [{required: true, message: '请选择点名称'}], placeName: [{required: true, message: '请选择点名称'}],
placeLng: [{required: true, message: '请输入点经度',},], placeLng: [{required: true, message: '请输入点经度',},],
placeLat: [{required: true, message: '请输入点纬度',},], placeLat: [{required: true, message: '请输入点纬度',},],
}, },
}; };
}, },
@@ -272,6 +259,10 @@ export default {
this.getOptions(); this.getOptions();
}, },
methods: { methods: {
parseData:(res)=>{
console.log(res)
return [];
},
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {
@@ -279,7 +270,7 @@ export default {
where: this.where, where: this.where,
}); });
}, },
getOptions(){ getOptions() {
getColumnOptions("year").then(res => { getColumnOptions("year").then(res => {
console.log(res) console.log(res)
if (res.data.code == 0) { if (res.data.code == 0) {
@@ -306,11 +297,12 @@ export default {
this.$refs.form.clearValidate(); // 清除表单验证信息 this.$refs.form.clearValidate(); // 清除表单验证信息
}); });
}, },
async save() { async save() {
await this.$refs.form.validate(); await this.$refs.form.validate();
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
const form = this.form; const form = this.form;
if (form.roadNoisePlaceId) { if (form.acidRainPlaceBaseInfoDictId) {
updatePlace(form) updatePlace(form)
.then((res) => { .then((res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
@@ -351,7 +343,7 @@ export default {
/* 删除单个 */ /* 删除单个 */
remove(row) { remove(row) {
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
removePlace(row.roadNoisePlaceId).then((res) => { removePlace(row.acidRainPlaceBaseInfoDictId).then((res) => {
hide(); hide();
if (res.data.code === 0) { if (res.data.code === 0) {
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
@@ -367,7 +359,7 @@ export default {
/* 批量删除 */ /* 批量删除 */
removeBatch() { removeBatch() {
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
const ids = this.selectionList.map((item) => item.roadNoisePlaceId); const ids = this.selectionList.map((item) => item.acidRainPlaceBaseInfoDictId);
removeBatchPlace(ids).then((res) => { removeBatchPlace(ids).then((res) => {
if (res.data.code === 0) { if (res.data.code === 0) {
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
@@ -381,13 +373,13 @@ export default {
hide(); hide();
}) })
}, },
setCYear(e){ setCYear(e) {
this.cYear = e.key; this.cYear = e.key;
this.showNYear = true; this.showNYear = true;
}, },
copyBatch(){ copyBatch() {
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
copyBatchPlace({cyear:Number(this.cYear),nyear:this.nYear}).then(res=>{ copyBatchPlace({cyear: Number(this.cYear), nyear: this.nYear}).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
@@ -402,8 +394,8 @@ export default {
hide(); hide();
}) })
}, },
exportData(){ exportData() {
const columns = this.columns.filter(item=>item.dataIndex); const columns = this.columns.filter(item => item.dataIndex);
const arr = []; const arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
arr.push(th); arr.push(th);

View File

@@ -9,21 +9,21 @@
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" :wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
> >
<a-row> <a-row>
<!-- <a-col :lg="6" :md="12" :sm="24" :xs="24">--> <!-- <a-col :lg="6" :md="12" :sm="24" :xs="24">-->
<!-- <a-form-item label="区域等级:">--> <!-- <a-form-item label="区域等级:">-->
<!-- <a-select v-model:value="where.regionLevel">--> <!-- <a-select v-model:value="where.regionLevel">-->
<!-- <a-select-option--> <!-- <a-select-option-->
<!-- v-for="(item) in modelOptions"--> <!-- v-for="(item) in modelOptions"-->
<!-- :key="item.value"--> <!-- :key="item.value"-->
<!-- >{{ item.label }}--> <!-- >{{ item.label }}-->
<!-- </a-select-option>--> <!-- </a-select-option>-->
<!-- </a-select>--> <!-- </a-select>-->
<!-- </a-form-item>--> <!-- </a-form-item>-->
<!-- </a-col>--> <!-- </a-col>-->
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="时间范围:"> <a-form-item label="时间范围:">
<a-range-picker v-model:value="time"/> <a-range-picker format="YYYY-MM" :mode="mode" @panelChange="handlePanelChange" @change="handleChange" v-model:value="time"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -49,6 +49,7 @@
:scroll="{ x: 'max-content' }" :scroll="{ x: 'max-content' }"
:init-load="false" :init-load="false"
@done="(d) => (data = d.data)" @done="(d) => (data = d.data)"
:parseData="parseData"
method="POST" method="POST"
> >
@@ -62,7 +63,7 @@
import _ from "lodash"; import _ from "lodash";
import XLSX from "xlsx"; import XLSX from "xlsx";
import {statisticCity, getColumnOptions} from "@/api/ecology/acid"; import {statisticCity, getColumnOptions} from "@/api/ecology/acid";
import { Modal } from "ant-design-vue"; import {Modal} from "ant-design-vue";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN"; import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment"; import moment from "moment";
@@ -73,6 +74,7 @@ export default {
data() { data() {
return { return {
data: [], data: [],
mode:['month', 'month'],
locale, locale,
bill: {}, bill: {},
// 表格数据接口 // 表格数据接口
@@ -82,17 +84,22 @@ export default {
{label: "市", value: "city"}, {label: "市", value: "city"},
{label: "县", value: "county"}, {label: "县", value: "county"},
{label: "站点", value: "place"}, {label: "站点", value: "place"},
], ],
// 表格列配置 // 表格列配置
columns: [ columns: [
{title: "xx", dataIndex: "place",align:"center"}, {title: "县城", dataIndex: "place", align: "center"},
{title: "项目", dataIndex: "periodType", align: "center"},
{title: "降水样品(个)", dataIndex: "precipitationSampleAcount", align: "center"},
{title: "酸雨样品(个)", dataIndex: "acidRainSampleAcount", align: "center"},
{title: "最小pH值", dataIndex: "minPh", align: "center"},
{title: "最大pH值", dataIndex: "maxPh", align: "center"},
{title: "酸雨频率(%", dataIndex: "acidRainFrequency", align: "center"},
{title: "降水pH值无量纲", dataIndex: "precipitationPh", align: "center"},
], ],
regionLevelOptions: [], regionLevelOptions: [],
time: undefined, time: undefined,
// 表格搜索条件 // 表格搜索条件
where: { where: {},
},
// 表格选中数据 // 表格选中数据
selectionList: [], selectionList: [],
}; };
@@ -102,6 +109,29 @@ export default {
this.reload(); this.reload();
}, },
methods: { methods: {
parseData(res) {
if (res.code == 0) {
const list = [];
console.log(res.data[0])
res.data.forEach(item => {
const key = Object.keys(item)[0]
list.push(...item[key])
})
res.data = list;
return res;
}
},
handleChange(val){
this.time = val;
},
handlePanelChange(val,mode){
this.time = val;
this.mode = [
mode[0] === 'date' ? 'month' : mode[0],
mode[1] === 'date' ? 'month' : mode[1],
]
},
/**获取下来框数据 */ /**获取下来框数据 */
loadOptionData() { loadOptionData() {
getColumnOptions("region_level").then((res) => { getColumnOptions("region_level").then((res) => {
@@ -121,15 +151,15 @@ export default {
where.timeStart = `${year}-01-01 00:00:00`; where.timeStart = `${year}-01-01 00:00:00`;
where.timeEnd = moment(Date.now()).format("YYYY-MM-DD 00:00:00") where.timeEnd = moment(Date.now()).format("YYYY-MM-DD 00:00:00")
} else { } else {
if(this.time[0].year() != this.time[1].year()){ if (this.time[0].year() != this.time[1].year()) {
Modal.error({ Modal.error({
title: "查询失败", title: "查询失败",
content: "开始时间与结束时间年份不一致", content: "开始时间与结束时间年份不一致",
}) })
return; return;
} }
where.timeStart = this.time[0].format("YYYY-MM-DD 00:00:00"); where.timeStart = this.time[0].format("YYYY-MM-01 00:00:00");
where.timeEnd = this.time[1].format("YYYY-MM-DD 00:00:00"); where.timeEnd = this.time[1].format("YYYY-MM-01 00:00:00");
} }
this.$refs.table.reload({ this.$refs.table.reload({
where where
@@ -137,8 +167,7 @@ export default {
}, },
/* 重置搜索 */ /* 重置搜索 */
reset() { reset() {
this.where = { this.where = {};
};
this.time = undefined; this.time = undefined;
this.reload(); this.reload();
}, },
@@ -148,22 +177,22 @@ export default {
const th2 = []; const th2 = [];
const merges = []; // 合并 const merges = []; // 合并
const columnsTemp = []; // 树形结构整理成list const columnsTemp = []; // 树形结构整理成list
this.columns.forEach((item,index)=>{ this.columns.forEach((item, index) => {
if(item.children){ if (item.children) {
item.children.forEach((citem)=>{ item.children.forEach((citem) => {
th1.push(item.title) th1.push(item.title)
th2.push(citem.title) th2.push(citem.title)
columnsTemp.push(citem) columnsTemp.push(citem)
}) })
merges.push({s: {r: 0, c: th1.length-item.children.length}, e: {r: 0, c: th1.length-1}}) merges.push({s: {r: 0, c: th1.length - item.children.length}, e: {r: 0, c: th1.length - 1}})
}else{ } else {
th1.push(item.title) th1.push(item.title)
th2.push("") th2.push("")
columnsTemp.push(item) columnsTemp.push(item)
merges.push({s: {r: 0, c: index}, e: {r: 1, c: index}}) merges.push({s: {r: 0, c: index}, e: {r: 1, c: index}})
} }
}) })
arr.push(th1,th2); arr.push(th1, th2);
this.data.forEach((d) => { this.data.forEach((d) => {
const td = columnsTemp.map((item) => d[item.dataIndex]); const td = columnsTemp.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);

View File

@@ -23,7 +23,7 @@
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="时间范围:"> <a-form-item label="时间范围:">
<a-range-picker v-model:value="time"/> <a-range-picker format="YYYY-MM" :mode="mode" @panelChange="handlePanelChange" @change="handleChange" v-model:value="time"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -50,6 +50,7 @@
:init-load="false" :init-load="false"
@done="(d) => (data = d.data)" @done="(d) => (data = d.data)"
method="POST" method="POST"
:parseData="parseData"
> >
</ele-pro-table> </ele-pro-table>
@@ -86,7 +87,14 @@ export default {
], ],
// 表格列配置 // 表格列配置
columns: [ columns: [
{title: "xx", dataIndex: "place",align:"center"}, {title: "县城", dataIndex: "place", align: "center"},
{title: "项目", dataIndex: "periodType", align: "center"},
{title: "降水样品(个)", dataIndex: "precipitationSampleAcount", align: "center"},
{title: "酸雨样品(个)", dataIndex: "acidRainSampleAcount", align: "center"},
{title: "最小pH值", dataIndex: "minPh", align: "center"},
{title: "最大pH值", dataIndex: "maxPh", align: "center"},
{title: "酸雨频率(%", dataIndex: "acidRainFrequency", align: "center"},
{title: "降水pH值无量纲", dataIndex: "precipitationPh", align: "center"},
], ],
regionLevelOptions: [], regionLevelOptions: [],
time: undefined, time: undefined,
@@ -113,6 +121,29 @@ export default {
}); });
}); });
}, },
parseData(res) {
if (res.code == 0) {
const list = [];
console.log(res.data[0])
res.data.forEach(item => {
const key = Object.keys(item)[0]
list.push(...item[key])
})
res.data = list;
return res;
}
},
handleChange(val){
this.time = val;
},
handlePanelChange(val,mode){
this.time = val;
this.mode = [
mode[0] === 'date' ? 'month' : mode[0],
mode[1] === 'date' ? 'month' : mode[1],
]
},
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {
const where = _.cloneDeep(this.where); const where = _.cloneDeep(this.where);
@@ -128,8 +159,8 @@ export default {
}) })
return; return;
} }
where.timeStart = this.time[0].format("YYYY-MM-DD 00:00:00"); where.timeStart = this.time[0].format("YYYY-MM-01 00:00:00");
where.timeEnd = this.time[1].format("YYYY-MM-DD 00:00:00"); where.timeEnd = this.time[1].format("YYYY-MM-01 00:00:00");
} }
this.$refs.table.reload({ this.$refs.table.reload({
where where

View File

@@ -9,8 +9,9 @@
<a-form layout="inline" :model="where" :labelCol="{ offset: 1}"> <a-form layout="inline" :model="where" :labelCol="{ offset: 1}">
<a-form-item label="区域等级:"> <a-form-item label="区域等级:">
<a-select v-model:value="where.regionLevel" allowClear placeholder="未选择"> <a-select v-model:value="where.regionLevel" allowClear placeholder="未选择">
<a-select-option :value="'市级'"></a-select-option> <a-select-option :value="'city'"></a-select-option>
<a-select-option :value="'县级'"></a-select-option> <a-select-option :value="'county'"></a-select-option>
<a-select-option :value="'place'">站点</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="审核状态:"> <a-form-item label="审核状态:">
@@ -21,11 +22,11 @@
</a-form-item> </a-form-item>
<a-form-item label="表格名称:"> <a-form-item label="表格名称:">
<a-input v-model:value.trim="where.billName" placeholder="请输入" allow-clear /> <a-input v-model:value.trim="where.billName" placeholder="请输入" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="上报时间:"> <a-form-item label="上报时间:">
<a-range-picker separator="~" v-model:value="reportTimeScope" /> <a-range-picker separator="-" v-model:value="reportTimeScope"/>
</a-form-item> </a-form-item>
<a-form-item class="ele-text-right" :wrapper-col="{span: 24}"> <a-form-item class="ele-text-right" :wrapper-col="{span: 24}">
@@ -37,7 +38,8 @@
</a-form> </a-form>
</template> </template>
<template #toolkit> <template #toolkit>
<a-popconfirm :disabled="selectionList.length == 0" :title="`确认删除${selectionList.length}条数据吗?`" ok-text="Yes" <a-popconfirm :disabled="selectionList.length == 0" :title="`确认删除${selectionList.length}条数据吗?`"
ok-text="Yes"
cancel-text="No" @confirm="removeBatch"> cancel-text="No" @confirm="removeBatch">
<a-button :disabled="selectionList.length == 0" type="primary" ghost danger>批量删除</a-button> <a-button :disabled="selectionList.length == 0" type="primary" ghost danger>批量删除</a-button>
</a-popconfirm> </a-popconfirm>
@@ -45,25 +47,27 @@
<template #billName="{ text, record }"> <template #billName="{ text, record }">
<div class="editable-cell"> <div class="editable-cell">
<div v-if="editableData[record.ambientAirBillId]" class="editable-cell-input-wrapper"> <div v-if="editableData[record.ambientAirBillId]" class="editable-cell-input-wrapper">
<a-input v-model:value="editableData[record.ambientAirBillId].billName" @pressEnter="save(record)" /> <a-input v-model:value="editableData[record.ambientAirBillId].billName"
<check-outlined class="editable-cell-icon-check" @click="save(record)" /> @pressEnter="save(record)"/>
<check-outlined class="editable-cell-icon-check" @click="save(record)"/>
</div> </div>
<div v-else class="editable-cell-text-wrapper"> <div v-else class="editable-cell-text-wrapper">
{{ text || ' ' }} {{ text || ' ' }}
<edit-outlined class="editable-cell-icon" @click="edit(record)" /> <edit-outlined class="editable-cell-icon" @click="edit(record)"/>
</div> </div>
</div> </div>
</template> </template>
<template #reportTime="{ text, record }"> <template #reportTime="{ text, record }">
<div class="editable-cell"> <div class="editable-cell">
<div v-if="editableData[record.ambientAirBillId]" class="editable-cell-input-wrapper"> <div v-if="editableData[record.ambientAirBillId]" class="editable-cell-input-wrapper">
<a-date-picker v-model:value="editableData[record.ambientAirBillId].reportTime"></a-date-picker> <a-month-picker
v-model:value="editableData[record.ambientAirBillId].reportTime"></a-month-picker>
<!-- <a-input v-model:value="editableData[record.ambientAirBillId].reportTime" @pressEnter="save(record)" /> --> <!-- <a-input v-model:value="editableData[record.ambientAirBillId].reportTime" @pressEnter="save(record)" /> -->
<check-outlined class="editable-cell-icon-check" @click="save(record)" /> <check-outlined class="editable-cell-icon-check" @click="save(record)"/>
</div> </div>
<div v-else class="editable-cell-text-wrapper"> <div v-else class="editable-cell-text-wrapper">
{{ $util.toDateString(text,'yyyy-MM-dd') || ' ' }} {{ $util.toDateString(text, 'yyyy-MM') || ' ' }}
<edit-outlined class="editable-cell-icon" @click="edit(record)" /> <edit-outlined class="editable-cell-icon" @click="edit(record)"/>
</div> </div>
</div> </div>
</template> </template>
@@ -87,7 +91,8 @@
<a-button type="dashed" shape="round" size="small">撤回</a-button> <a-button type="dashed" shape="round" size="small">撤回</a-button>
</a-popconfirm> </a-popconfirm>
</span> </span>
<a-popconfirm :title="`确认删除${record.billName}吗?`" ok-text="Yes" cancel-text="No" @confirm="remove(record)"> <a-popconfirm :title="`确认删除${record.billName}吗?`" ok-text="Yes" cancel-text="No"
@confirm="remove(record)">
<a-button type="primary" danger shape="round" size="small">删除</a-button> <a-button type="primary" danger shape="round" size="small">删除</a-button>
</a-popconfirm> </a-popconfirm>
</a-space> </a-space>
@@ -98,22 +103,23 @@
<script> <script>
import _ from "lodash" import _ from "lodash"
import { import {
CheckOutlined, CheckOutlined,
EditOutlined EditOutlined
} from '@ant-design/icons-vue'; } from '@ant-design/icons-vue';
import { Modal } from 'ant-design-vue'; import {Modal} from 'ant-design-vue';
import { import {
pageBillUrl, pageBillUrl,
// saveAirBill, // saveAirBill,
removeAirBill, removeAirBill,
removeBatchAirBill, removeBatchAirBill,
updateAirBill, updateAirBill,
verifyAirBill verifyAirBill
} from "@/api/ecology/air"; } from "@/api/ecology/air";
import moment from "moment"; import moment from "moment";
export default {
export default {
name: 'AirCollectBill', name: 'AirCollectBill',
components: { components: {
CheckOutlined, CheckOutlined,
@@ -148,6 +154,15 @@
title: '区域等级', title: '区域等级',
dataIndex: 'regionLevel', dataIndex: 'regionLevel',
sorter: true, sorter: true,
customRender:({text})=>{
if(text == "place"){
return "站点"
}else if(text == "city"){
return "市"
}else if(text == "county"){
return "县"
}
}
}, },
{ {
title: '条目', title: '条目',
@@ -253,7 +268,7 @@
this.editableData[record.ambientAirBillId].reportTime = moment(this.editableData[record.ambientAirBillId] this.editableData[record.ambientAirBillId].reportTime = moment(this.editableData[record.ambientAirBillId]
.reportTime) .reportTime)
}, },
verify(record,checked) { verify(record, checked) {
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
verifyAirBill({ verifyAirBill({
ambientAirBillId: record.ambientAirBillId, ambientAirBillId: record.ambientAirBillId,
@@ -263,7 +278,7 @@
record.checked = checked record.checked = checked
Modal.success({ Modal.success({
title: "提示", title: "提示",
content: checked?"审核成功":"撤回成功" content: checked ? "审核成功" : "撤回成功"
}); });
} else { } else {
Modal.error({ Modal.error({
@@ -342,11 +357,11 @@
}, },
} }
} }
</script> </script>
<style lang="less"> <style lang="less">
.editable-cell { .editable-cell {
position: relative; position: relative;
.editable-cell-input-wrapper, .editable-cell-input-wrapper,
@@ -383,9 +398,9 @@
.editable-add-btn { .editable-add-btn {
margin-bottom: 8px; margin-bottom: 8px;
} }
} }
.editable-cell:hover .editable-cell-icon { .editable-cell:hover .editable-cell-icon {
display: inline-block; display: inline-block;
} }
</style> </style>

View File

@@ -3,6 +3,7 @@
<a-card style="width: 100%" :bordered="false"> <a-card style="width: 100%" :bordered="false">
<template #title> <template #title>
<a-space> <a-space>
<a-month-picker v-model:value="time"/>
<a-upload <a-upload
:before-upload="importFileCity" :before-upload="importFileCity"
:showUploadList="false" :showUploadList="false"
@@ -25,9 +26,10 @@
<script> <script>
import XLSX from "xlsx"; import XLSX from "xlsx";
import utils from "./utils"; import utils from "./utils";
import { Modal } from "ant-design-vue"; import {Modal} from "ant-design-vue";
import AirBill from "./air-bill.vue"; import AirBill from "./air-bill.vue";
import { saveAirBill } from "@/api/ecology/air"; import {saveAirBill} from "@/api/ecology/air";
import moment from "moment";
export default { export default {
name: "AirCollectIndex", name: "AirCollectIndex",
components: { components: {
@@ -36,6 +38,7 @@ export default {
data() { data() {
return { return {
activeKey: "", activeKey: "",
time: moment()
}; };
}, },
methods: { methods: {
@@ -66,7 +69,8 @@ export default {
const airList1 = aoa.filter( const airList1 = aoa.filter(
(item) => { (item) => {
return item.length >= 10 && item[0] != "城市"} return item.length >= 10 && item[0] != "城市"
}
); );
const airList2 = aoa2.filter( const airList2 = aoa2.filter(
(item) => item.length >= 10 && item[0] != "城市" (item) => item.length >= 10 && item[0] != "城市"
@@ -103,6 +107,8 @@ export default {
billName: billName1, billName: billName1,
regionLevel: "place", regionLevel: "place",
ambientAirList: billData1, ambientAirList: billData1,
importYearMonth: this.time.format("YYYY-MM"),
reportTime:this.time.valueOf()
}) })
); );
} }
@@ -112,6 +118,8 @@ export default {
billName: billName2, billName: billName2,
regionLevel: "city", regionLevel: "city",
ambientAirList: billData2, ambientAirList: billData2,
importYearMonth: this.time.format("YYYY-MM"),
reportTime:this.time.valueOf()
}) })
); );
} }
@@ -121,6 +129,9 @@ export default {
billName: billName3, billName: billName3,
regionLevel: "county", regionLevel: "county",
ambientAirList: billData3, ambientAirList: billData3,
importYearMonth: this.time.format("YYYY-MM"),
reportTime:this.time.valueOf()
}) })
); );
} }

View File

@@ -0,0 +1,196 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form
:model="where"
layout="vertical"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="时间范围:">
<a-date-picker v-model:value="where.time" />
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :lg="24" :md="24" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
<a-button @click="exportFile">导出Excel</a-button>
</a-space>
</a-col>
</a-row>
</a-form>
<!-- 表格 -->
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="ambientAirId"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
:need-page="false"
@done="(d) => (data = d.data)"
>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import {airDayRankUrl} from "@/api/ecology/air";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
// import utils from "./utils";
export default {
name: "AirDayRanking",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: airDayRankUrl,
selection: [],
// 表格列配置
columns: [
{title: "排名",dataIndex: "rankNumber",},
{title: "省份",dataIndex: "province",},
{title: "城市",dataIndex: "city",},
{title: "AQI",dataIndex: "aqi",},
{title: "空气质量",dataIndex: "airQuality",},
{title: "PM2.5浓度/(ug/m3)",dataIndex: "pm25",},
{title: "首要污染物",dataIndex: "primaryPollutant",},
],
placeOptions:[],
time: undefined,
// 表格搜索条件
where: {
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
},
methods: {
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.reload();
},
exportFile() {
const columns = [
{
title: "监测日期",
dataIndex: "monitorTime",
sorter: true,
customRender: ({text}) => moment(text).format("YYYY-MM-DD HH:mm")
},
{
title: "城市",
dataIndex: "city",
sorter: true,
},
{
title: "测点名称",
dataIndex: "place",
sorter: true,
},
{
title: "SO2/(μg/m3)",
dataIndex: "so2",
sorter: true,
},
{
title: "NO2/(μg/m3)",
dataIndex: "no2",
sorter: true,
},
{
title: "PM10/(μg/m3)",
dataIndex: "pm10",
sorter: true,
},
{
title: "CO/(mg/m3)",
dataIndex: "co",
sorter: true,
},
{
title: "臭氧O3最大8小时滑动平均浓度/(μg/m3)",
dataIndex: "o3",
sorter: true,
},
{
title: "PM2.5",
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,
},
{
title: "创建人",
dataIndex: "username",
sorter: true,
},
];
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.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, new Date().getTime().toString());
},
},
};
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,49 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-tabs v-model:activeKey="activeKey">
<!-- <a-tab-pane key="day" tab="日排行">-->
<!-- <day-rank></day-rank>-->
<!-- </a-tab-pane>-->
<a-tab-pane key="month" tab="月排行">
<month-rank></month-rank>
</a-tab-pane>
<a-tab-pane key="year" tab="年排行">
<year-rank></year-rank>
</a-tab-pane>
</a-tabs>
</a-card>
</div>
</template>
<script>
/**
*
*
*
*/
// import DayRank from "./day.vue";
import MonthRank from "./month.vue";
import YearRank from "./year.vue";
export default {
name: 'AirRankingIndex',
components: {
// DayRank,
MonthRank,YearRank,
},
data() {
return {
activeKey: 'month'
};
},
methods: {}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,175 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form
:model="where"
layout="inline"
>
<a-form-item label="时间:">
<a-month-picker v-model:value="time"/>
</a-form-item>
<a-space>
<a-radio-group @change="cityTypeChange" v-model:value="cityType">
<a-radio-button :value="1">全部</a-radio-button>
<a-radio-button :value="2">省会</a-radio-button>
</a-radio-group>
<!-- <a-radio-group @change="rankTypeChange" v-model:value="rankType">-->
<!-- <a-radio-button :value="1">综合指数</a-radio-button>-->
<!-- <a-radio-button :value="2">PM2.5</a-radio-button>-->
<!-- </a-radio-group>-->
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
<a-button @click="exportFile">导出Excel</a-button>
</a-space>
</a-form>
<!-- 表格 -->
<a-table
:columns="columns"
:row-key="rowKey"
:data-source="data"
:loading="loading"
:pagination="false"
>
</a-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import {
airMonthRankUrl,
airMonthProvincialCapitalRankUrl,
} from "@/api/ecology/air";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
import axios from "axios";
// import utils from "./utils";
export default {
name: "AirMonthRanking",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: airMonthRankUrl,
selection: [],
// 表格列配置
columns: [
{title: "排名", dataIndex: "rankNumber",},
{title: "省份", dataIndex: "province",},
{title: "城市", dataIndex: "city",},
{title: "综合指数", dataIndex: "comprehensiveAqi",},
{title: "最大指数", dataIndex: "maxAqi",},
{title: "首要污染物", dataIndex: "primaryPollutant",},
],
placeOptions: [],
time: moment(),
rankType: 1,
cityType: 1,
rowKey: "ambientAirZhenqiCityMonthComprehensiveAqiRankDataId",
loading: false,
// 表格搜索条件
where: {},
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.reload()
},
methods: {
/* 刷新表格 */
reload() {
if (!this.time) {
return;
}
const where = {
year: this.time.get("year"),
month: this.time.get("month") + 1
}
this.loading = true;
if(this.cityType == 1){
axios.get(this.url, {params: {limit: 168, ...where}}).then(res => {
this.data = res.data.data
}).finally(() => {
this.loading = false;
})
}else {
axios.post(this.url, {limit: 168, ...where}).then(res => {
this.data = res.data.data
}).finally(() => {
this.loading = false;
})
}
},
/* 重置搜索 */
reset() {
this.where = {
year: moment().get("year"),
month: moment().get("month")
};
this.reload();
},
cityTypeChange(){
if (this.rankType == 1) {
if (this.cityType == 1) {
this.url = airMonthRankUrl;
} else {
this.url = airMonthProvincialCapitalRankUrl;
}
} else {
if (this.cityType == 1) {
this.url = "";
} else {
this.url = ""
}
}
this.reload();
},
rankTypeChange() {
if (this.rankType == 1) {
if (this.cityType == 1) {
this.url = airMonthRankUrl;
} else {
this.url = airMonthProvincialCapitalRankUrl;
}
} else {
if (this.cityType == 1) {
this.url = "";
} else {
this.url = ""
}
}
this.reload();
},
exportFile() {
const columns = this.columns;
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.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, new Date().getTime().toString());
},
},
};
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,193 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form
:model="where"
layout="inline"
>
<a-row>
<a-form-item label="年份:">
<a-input-number v-model:value="where.year" :min="2000" :max="2050"/>
</a-form-item>
<a-space>
<a-radio-group @change="cityTypeChange" v-model:value="cityType">
<a-radio-button :value="1">全部</a-radio-button>
<a-radio-button :value="2">省会</a-radio-button>
</a-radio-group>
<a-radio-group @change="rankTypeChange" v-model:value="rankType">
<a-radio-button :value="1">综合指数</a-radio-button>
<a-radio-button :value="2">PM2.5</a-radio-button>
</a-radio-group>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
<a-button @click="exportFile">导出Excel</a-button>
</a-space>
</a-row>
</a-form>
<!-- 表格 -->
<a-table
:columns="columns"
:row-key="'id'"
:data-source="data"
:loading="loading"
:pagination="false"
>
</a-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import {
airYearRankUrl,
airPm25YearRankUrl,
airYearProvincialCapitalRankUrl,
airPm25YearProvincialCapitalRankUrl
} from "@/api/ecology/air";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
import axios from 'axios';
// import utils from "./utils";
export default {
name: "AirYearRanking",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: airYearRankUrl,
selection: [],
// 表格列配置
columns: [
{title: "排名", dataIndex: "rankNumber",},
{title: "省份", dataIndex: "province",},
{title: "城市", dataIndex: "city",},
{title: "综合指数", dataIndex: "comprehensiveAqi",},
{title: "最大指数", dataIndex: "maxAqi",},
{title: "首要污染物", dataIndex: "primaryPollutant",},
],
placeOptions: [],
rankType: 1,
cityType: 1,
rowKey: "ambientAirZhenqiCityYearComprehensiveAqiRankDataId",
loading: false,
time: moment(),
// 表格搜索条件
where: {year: new Date().getFullYear()},
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.reload()
},
methods: {
/* 刷新表格 */
reload() {
if (!this.where.year) {
return;
}
this.loading = true;
let rowKey = undefined;
if (this.rankType == 1) {
rowKey = "ambientAirZhenqiCityYearComprehensiveAqiRankDataId"
} else {
rowKey = "ambientAirZhenqiCityYearPm25RankDataId"
// this.needPage = false
}
if(this.cityType == 1){
axios.get(this.url, {params: {limit: 168, ...this.where}}).then(res => {
res.data.data.forEach(item=>{
item.id = item[rowKey]
})
this.data = res.data.data
}).finally(() => {
this.loading = false;
})
}else {
axios.post(this.url, {limit: 168, ...this.where}).then(res => {
res.data.data.forEach(item=>{
item.id = item[rowKey]
})
this.data = res.data.data
}).finally(() => {
this.loading = false;
})
}
},
/* 重置搜索 */
reset() {
this.where = {
year: moment().get("year"),
month: moment().get("month")
};
this.reload();
},
cityTypeChange(){
if (this.rankType == 1) {
if (this.cityType == 1) {
this.url = airYearRankUrl;
} else {
this.url = airYearProvincialCapitalRankUrl;
}
} else {
if (this.cityType == 1) {
this.url = airPm25YearRankUrl;
} else {
this.url = airPm25YearProvincialCapitalRankUrl
}
}
this.reload();
},
rankTypeChange() {
if (this.rankType == 1) {
if (this.cityType == 1) {
this.url = airYearRankUrl;
} else {
this.url = airYearProvincialCapitalRankUrl;
}
this.columns.splice(3, 1, {title: "综合指数", dataIndex: "comprehensiveAqi",})
this.rowKey = "ambientAirZhenqiCityYearComprehensiveAqiRankDataId"
} else {
if (this.cityType == 1) {
this.url = airPm25YearRankUrl;
} else {
this.url = airPm25YearProvincialCapitalRankUrl
}
this.columns.splice(3, 1, {title: "PM2.5", dataIndex: "pm25",})
this.rowKey = "ambientAirZhenqiCityYearPm25RankDataId"
// this.needPage = false
}
this.reload();
},
exportFile() {
const columns = this.columns;
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.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, new Date().getTime().toString());
},
},
};
</script>
<style scoped lang="less">
</style>