大气
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,89 +41,89 @@ 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, {
|
||||||
type: "array",
|
type: "array",
|
||||||
});
|
|
||||||
let sheetNames = workbook.SheetNames;
|
|
||||||
// 解析成二维数组
|
|
||||||
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
|
|
||||||
header: 1,
|
|
||||||
});
|
|
||||||
|
|
||||||
const reportDate = aoa[2][0].replace(/[^\d]+/g, "-");
|
|
||||||
|
|
||||||
const acidList = aoa.filter((item) => {
|
|
||||||
return item.length >= 16 && item[0] && !item[0].includes("编号");
|
|
||||||
});
|
|
||||||
// 解析成对象数组
|
|
||||||
const billName = aoa[0][0] + aoa[1][0];
|
|
||||||
const billData = utils.toObjData(acidList, new Date(reportDate).getFullYear());
|
|
||||||
|
|
||||||
if (
|
|
||||||
!billData ||
|
|
||||||
billData.length == 0
|
|
||||||
// (!billData2 || billData2.length == 0)
|
|
||||||
) {
|
|
||||||
hide();
|
|
||||||
Modal.error({
|
|
||||||
title: "导入失败",
|
|
||||||
content: "找不到数据",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const tasks = [];
|
|
||||||
if (billData.length > 0) {
|
|
||||||
tasks.push(
|
|
||||||
saveAcidRainBill({
|
|
||||||
// reportTime: new Date(reportDate).getTime(),
|
|
||||||
billName: billName,
|
|
||||||
regionLevel: "市级",
|
|
||||||
acidRainList: billData,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 上传到服务器
|
|
||||||
Promise.all(tasks)
|
|
||||||
.then((res) => {
|
|
||||||
if (res[0].data.code == 0) {
|
|
||||||
Modal.success({
|
|
||||||
title: "导入成功",
|
|
||||||
content: `成功导入${billData.length}条数据`,
|
|
||||||
});
|
|
||||||
this.$refs.rain && this.$refs.rain.reload();
|
|
||||||
} else {
|
|
||||||
Modal.error({
|
|
||||||
title: "导入失败",
|
|
||||||
content: "数据上传出错",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
Modal.error({
|
|
||||||
title: "导入失败",
|
|
||||||
content: "数据上传出错",
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hide();
|
|
||||||
});
|
});
|
||||||
} catch (error) {
|
let sheetNames = workbook.SheetNames;
|
||||||
hide();
|
// 解析成二维数组
|
||||||
Modal.error({
|
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
|
||||||
title: "导入失败",
|
header: 1,
|
||||||
content: error.message,
|
});
|
||||||
});
|
|
||||||
}
|
const reportDate = aoa[2][0].replace(/[^\d]+/g, "-");
|
||||||
// console.log(billData);
|
|
||||||
|
const acidList = aoa.filter((item) => {
|
||||||
|
return item.length >= 16 && item[0] && !item[0].includes("编号");
|
||||||
|
});
|
||||||
|
// 解析成对象数组
|
||||||
|
const billName = aoa[0][0] + aoa[1][0];
|
||||||
|
const billData = await utils.toObjData(acidList, new Date(reportDate).getFullYear());
|
||||||
|
|
||||||
|
if (
|
||||||
|
!billData ||
|
||||||
|
billData.length == 0
|
||||||
|
// (!billData2 || billData2.length == 0)
|
||||||
|
) {
|
||||||
|
hide();
|
||||||
|
Modal.error({
|
||||||
|
title: "导入失败",
|
||||||
|
content: "找不到数据",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tasks = [];
|
||||||
|
if (billData.length > 0) {
|
||||||
|
tasks.push(
|
||||||
|
saveAcidRainBill({
|
||||||
|
// reportTime: new Date(reportDate).getTime(),
|
||||||
|
billName: billName,
|
||||||
|
regionLevel: "市级",
|
||||||
|
acidRainList: billData,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上传到服务器
|
||||||
|
Promise.all(tasks)
|
||||||
|
.then((res) => {
|
||||||
|
if (res[0].data.code == 0) {
|
||||||
|
Modal.success({
|
||||||
|
title: "导入成功",
|
||||||
|
content: `成功导入${billData.length}条数据`,
|
||||||
|
});
|
||||||
|
this.$refs.rain && this.$refs.rain.reload();
|
||||||
|
} else {
|
||||||
|
Modal.error({
|
||||||
|
title: "导入失败",
|
||||||
|
content: "数据上传出错",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
Modal.error({
|
||||||
|
title: "导入失败",
|
||||||
|
content: "数据上传出错",
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hide();
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
Modal.error({
|
||||||
|
title: "导入失败",
|
||||||
|
content: error.message,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// console.log(billData);
|
||||||
};
|
};
|
||||||
reader.readAsArrayBuffer(file);
|
reader.readAsArrayBuffer(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],
|
||||||
|
|||||||
@@ -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,12 +394,12 @@ 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);
|
||||||
this.data.forEach((d) => {
|
this.data.forEach((d) => {
|
||||||
const td = columns.map((item) => d[item.dataIndex]);
|
const td = columns.map((item) => d[item.dataIndex]);
|
||||||
arr.push(td);
|
arr.push(td);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,391 +1,406 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<ele-pro-table v-model:selection="selectionList" ref="table" row-key="ambientAirBillId" :datasource="url"
|
<ele-pro-table v-model:selection="selectionList" ref="table" row-key="ambientAirBillId" :datasource="url"
|
||||||
:columns="columns" :where="where" :scroll="{x: 'max-content'}">
|
:columns="columns" :where="where" :scroll="{x: 'max-content'}">
|
||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
|
|
||||||
<!-- 搜索表单 -->
|
<!-- 搜索表单 -->
|
||||||
<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>
|
<a-select-option :value="'place'">站点</a-select-option>
|
||||||
</a-form-item>
|
</a-select>
|
||||||
<a-form-item label="审核状态:">
|
</a-form-item>
|
||||||
<a-select v-model:value="where.checked" allowClear placeholder="未选择">
|
<a-form-item label="审核状态:">
|
||||||
<a-select-option :value="1">已审核</a-select-option>
|
<a-select v-model:value="where.checked" allowClear placeholder="未选择">
|
||||||
<a-select-option :value="0">未审核</a-select-option>
|
<a-select-option :value="1">已审核</a-select-option>
|
||||||
</a-select>
|
<a-select-option :value="0">未审核</a-select-option>
|
||||||
</a-form-item>
|
</a-select>
|
||||||
|
</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}">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button type="primary" @click="reload">查询</a-button>
|
<a-button type="primary" @click="reload">查询</a-button>
|
||||||
<a-button @click="reset">重置</a-button>
|
<a-button @click="reset">重置</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</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}条数据吗?`"
|
||||||
cancel-text="No" @confirm="removeBatch">
|
ok-text="Yes"
|
||||||
<a-button :disabled="selectionList.length == 0" type="primary" ghost danger>批量删除</a-button>
|
cancel-text="No" @confirm="removeBatch">
|
||||||
</a-popconfirm>
|
<a-button :disabled="selectionList.length == 0" type="primary" ghost danger>批量删除</a-button>
|
||||||
</template>
|
</a-popconfirm>
|
||||||
<template #billName="{ text, record }">
|
</template>
|
||||||
<div class="editable-cell">
|
<template #billName="{ text, record }">
|
||||||
<div v-if="editableData[record.ambientAirBillId]" class="editable-cell-input-wrapper">
|
<div class="editable-cell">
|
||||||
<a-input v-model:value="editableData[record.ambientAirBillId].billName" @pressEnter="save(record)" />
|
<div v-if="editableData[record.ambientAirBillId]" class="editable-cell-input-wrapper">
|
||||||
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
|
<a-input v-model:value="editableData[record.ambientAirBillId].billName"
|
||||||
</div>
|
@pressEnter="save(record)"/>
|
||||||
<div v-else class="editable-cell-text-wrapper">
|
<check-outlined class="editable-cell-icon-check" @click="save(record)"/>
|
||||||
{{ text || ' ' }}
|
</div>
|
||||||
<edit-outlined class="editable-cell-icon" @click="edit(record)" />
|
<div v-else class="editable-cell-text-wrapper">
|
||||||
</div>
|
{{ text || ' ' }}
|
||||||
</div>
|
<edit-outlined class="editable-cell-icon" @click="edit(record)"/>
|
||||||
</template>
|
</div>
|
||||||
<template #reportTime="{ text, record }">
|
</div>
|
||||||
<div class="editable-cell">
|
</template>
|
||||||
<div v-if="editableData[record.ambientAirBillId]" class="editable-cell-input-wrapper">
|
<template #reportTime="{ text, record }">
|
||||||
<a-date-picker v-model:value="editableData[record.ambientAirBillId].reportTime"></a-date-picker>
|
<div class="editable-cell">
|
||||||
<!-- <a-input v-model:value="editableData[record.ambientAirBillId].reportTime" @pressEnter="save(record)" /> -->
|
<div v-if="editableData[record.ambientAirBillId]" class="editable-cell-input-wrapper">
|
||||||
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
|
<a-month-picker
|
||||||
</div>
|
v-model:value="editableData[record.ambientAirBillId].reportTime"></a-month-picker>
|
||||||
<div v-else class="editable-cell-text-wrapper">
|
<!-- <a-input v-model:value="editableData[record.ambientAirBillId].reportTime" @pressEnter="save(record)" /> -->
|
||||||
{{ $util.toDateString(text,'yyyy-MM-dd') || ' ' }}
|
<check-outlined class="editable-cell-icon-check" @click="save(record)"/>
|
||||||
<edit-outlined class="editable-cell-icon" @click="edit(record)" />
|
</div>
|
||||||
</div>
|
<div v-else class="editable-cell-text-wrapper">
|
||||||
</div>
|
{{ $util.toDateString(text, 'yyyy-MM') || ' ' }}
|
||||||
</template>
|
<edit-outlined class="editable-cell-icon" @click="edit(record)"/>
|
||||||
<template #checked="{text}">
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #checked="{text}">
|
||||||
<span>
|
<span>
|
||||||
<a-tag v-if="text" color="green">已审核</a-tag>
|
<a-tag v-if="text" color="green">已审核</a-tag>
|
||||||
<a-tag v-else color="orange">未审核</a-tag>
|
<a-tag v-else color="orange">未审核</a-tag>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #action="{ record }">
|
<template #action="{ record }">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button @click="detail(record)" shape="round" size="small">查看</a-button>
|
<a-button @click="detail(record)" shape="round" size="small">查看</a-button>
|
||||||
<span v-hasPermi="['ecology:sound:verify']">
|
<span v-hasPermi="['ecology:sound:verify']">
|
||||||
<a-popconfirm v-if="record.checked != 1" :title="`审核通过后将无法修改,确认?`" ok-text="Yes" cancel-text="No"
|
<a-popconfirm v-if="record.checked != 1" :title="`审核通过后将无法修改,确认?`" ok-text="Yes" cancel-text="No"
|
||||||
@confirm="verify(record,1)">
|
@confirm="verify(record,1)">
|
||||||
<a-button type="primary" shape="round" size="small">审核</a-button>
|
<a-button type="primary" shape="round" size="small">审核</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
<a-popconfirm v-else :title="`撤回重新编辑,确认?`" ok-text="Yes" cancel-text="No"
|
<a-popconfirm v-else :title="`撤回重新编辑,确认?`" ok-text="Yes" cancel-text="No"
|
||||||
@confirm="verify(record,0)">
|
@confirm="verify(record,0)">
|
||||||
<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"
|
||||||
<a-button type="primary" danger shape="round" size="small">删除</a-button>
|
@confirm="remove(record)">
|
||||||
</a-popconfirm>
|
<a-button type="primary" danger shape="round" size="small">删除</a-button>
|
||||||
</a-space>
|
</a-popconfirm>
|
||||||
</template>
|
</a-space>
|
||||||
</ele-pro-table>
|
</template>
|
||||||
</div>
|
</ele-pro-table>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<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,
|
||||||
EditOutlined
|
EditOutlined
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// 表格数据接口
|
// 表格数据接口
|
||||||
url: pageBillUrl,
|
url: pageBillUrl,
|
||||||
selection: [],
|
selection: [],
|
||||||
// 表格列配置
|
// 表格列配置
|
||||||
columns: [{
|
columns: [{
|
||||||
key: 'index',
|
key: 'index',
|
||||||
dataIndex: 'index',
|
dataIndex: 'index',
|
||||||
width: 48,
|
width: 48,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
customRender: ({
|
customRender: ({
|
||||||
index
|
index
|
||||||
}) => index + 1
|
}) => index + 1
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '表格名称',
|
|
||||||
dataIndex: 'billName',
|
|
||||||
sorter: true,
|
|
||||||
slots: {
|
|
||||||
customRender: 'billName',
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '表格名称',
|
||||||
|
dataIndex: 'billName',
|
||||||
|
sorter: true,
|
||||||
|
slots: {
|
||||||
|
customRender: 'billName',
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '区域等级',
|
title: '区域等级',
|
||||||
dataIndex: 'regionLevel',
|
dataIndex: 'regionLevel',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
customRender:({text})=>{
|
||||||
{
|
if(text == "place"){
|
||||||
title: '条目',
|
return "站点"
|
||||||
dataIndex: 'recordSize',
|
}else if(text == "city"){
|
||||||
sorter: true,
|
return "市"
|
||||||
|
}else if(text == "county"){
|
||||||
|
return "县"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '条目',
|
||||||
|
dataIndex: 'recordSize',
|
||||||
|
sorter: true,
|
||||||
|
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// title: '菜单名称',
|
// title: '菜单名称',
|
||||||
// dataIndex: 'title',
|
// dataIndex: 'title',
|
||||||
// sorter: true
|
// sorter: true
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
title: '上报时间',
|
title: '上报时间',
|
||||||
dataIndex: 'reportTime',
|
dataIndex: 'reportTime',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
slots: {
|
slots: {
|
||||||
customRender: 'reportTime',
|
customRender: 'reportTime',
|
||||||
},
|
},
|
||||||
// customRender: ({
|
// customRender: ({
|
||||||
// text
|
// text
|
||||||
// }) => this.$util.toDateString(text)
|
// }) => this.$util.toDateString(text)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '导入时间',
|
title: '导入时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
customRender: ({
|
customRender: ({
|
||||||
text
|
text
|
||||||
}) => this.$util.toDateString(text)
|
}) => this.$util.toDateString(text)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '审核状态',
|
title: '审核状态',
|
||||||
dataIndex: 'checked',
|
dataIndex: 'checked',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
slots: {
|
slots: {
|
||||||
customRender: 'checked',
|
customRender: 'checked',
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '创建人',
|
title: '创建人',
|
||||||
dataIndex: 'userName',
|
dataIndex: 'userName',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
|
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// title: '更新时间',
|
// title: '更新时间',
|
||||||
// dataIndex: 'updateTime',
|
// dataIndex: 'updateTime',
|
||||||
// sorter: true,
|
// sorter: true,
|
||||||
// customRender: ({
|
// customRender: ({
|
||||||
// text
|
// text
|
||||||
// }) => this.$util.toDateString(text)
|
// }) => this.$util.toDateString(text)
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
width: 150,
|
width: 150,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
slots: {
|
slots: {
|
||||||
customRender: 'action'
|
customRender: 'action'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// 表格搜索条件
|
// 表格搜索条件
|
||||||
where: {},
|
where: {},
|
||||||
reportTimeScope: [],
|
reportTimeScope: [],
|
||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
selectionList: [],
|
selectionList: [],
|
||||||
editableData: {},
|
editableData: {},
|
||||||
// 当前编辑数据
|
// 当前编辑数据
|
||||||
current: null,
|
current: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
|
||||||
/* 刷新表格 */
|
/* 刷新表格 */
|
||||||
reload() {
|
reload() {
|
||||||
this.where.reportTimeStart = null;
|
this.where.reportTimeStart = null;
|
||||||
this.where.reportTimeEnd = null;
|
this.where.reportTimeEnd = null;
|
||||||
if (this.reportTimeScope && this.reportTimeScope.length == 2) {
|
if (this.reportTimeScope && this.reportTimeScope.length == 2) {
|
||||||
this.where.reportTimeStart = this.reportTimeScope[0].format("Y-M-D H:m:s")
|
this.where.reportTimeStart = this.reportTimeScope[0].format("Y-M-D H:m:s")
|
||||||
this.where.reportTimeEnd = this.reportTimeScope[1].format("Y-M-D H:m:s")
|
this.where.reportTimeEnd = this.reportTimeScope[1].format("Y-M-D H:m:s")
|
||||||
}
|
}
|
||||||
this.$refs.table.reload({
|
this.$refs.table.reload({
|
||||||
where: this.where
|
where: this.where
|
||||||
});
|
|
||||||
},
|
|
||||||
/* 重置搜索 */
|
|
||||||
reset() {
|
|
||||||
this.where = {};
|
|
||||||
this.reportTimeScope = [];
|
|
||||||
this.reload();
|
|
||||||
},
|
|
||||||
detail(record) {
|
|
||||||
this.$router.replace({
|
|
||||||
path: "/atmosphere/air/collect/air/" + record.ambientAirBillId
|
|
||||||
})
|
|
||||||
},
|
|
||||||
edit(record) {
|
|
||||||
this.editableData[record.ambientAirBillId] = _.cloneDeep(record);
|
|
||||||
this.editableData[record.ambientAirBillId].reportTime = moment(this.editableData[record.ambientAirBillId]
|
|
||||||
.reportTime)
|
|
||||||
},
|
|
||||||
verify(record,checked) {
|
|
||||||
const hide = this.$message.loading('请求中..', 0);
|
|
||||||
verifyAirBill({
|
|
||||||
ambientAirBillId: record.ambientAirBillId,
|
|
||||||
checked
|
|
||||||
}).then(res => {
|
|
||||||
if (res.data.code == 0) {
|
|
||||||
record.checked = checked
|
|
||||||
Modal.success({
|
|
||||||
title: "提示",
|
|
||||||
content: checked?"审核成功":"撤回成功"
|
|
||||||
});
|
});
|
||||||
} else {
|
},
|
||||||
Modal.error({
|
/* 重置搜索 */
|
||||||
title: "提示",
|
reset() {
|
||||||
content: res.data.msg
|
this.where = {};
|
||||||
});
|
this.reportTimeScope = [];
|
||||||
}
|
|
||||||
}).catch((e) => {
|
|
||||||
this.$message.error(e.message);
|
|
||||||
}).finally(() => {
|
|
||||||
hide();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
save(record) {
|
|
||||||
|
|
||||||
let {
|
|
||||||
ambientAirBillId,
|
|
||||||
billName,
|
|
||||||
reportTime
|
|
||||||
} = this.editableData[record.ambientAirBillId];
|
|
||||||
if (!ambientAirBillId || !reportTime) {
|
|
||||||
this.$message.error('请填写完整信息再提交')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const hide = this.$message.loading('请求中..', 0);
|
|
||||||
reportTime = reportTime.format("x")
|
|
||||||
reportTime = Number(reportTime)
|
|
||||||
updateAirBill({
|
|
||||||
ambientAirBillId,
|
|
||||||
billName,
|
|
||||||
reportTime
|
|
||||||
}).then(res => {
|
|
||||||
if (res.data.code == 0) {
|
|
||||||
this.$message.success(res.data.msg);
|
|
||||||
record.billName = billName;
|
|
||||||
record.reportTime = reportTime
|
|
||||||
} else {
|
|
||||||
this.$message.error(res.data.msg);
|
|
||||||
}
|
|
||||||
}).catch(e => {
|
|
||||||
console.log(e);
|
|
||||||
this.$message.error(e.message);
|
|
||||||
}).finally(() => {
|
|
||||||
delete this.editableData[record.ambientAirBillId]
|
|
||||||
hide()
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
/* 删除单个 */
|
|
||||||
remove(row) {
|
|
||||||
const hide = this.$message.loading('请求中..', 0);
|
|
||||||
removeAirBill(row.ambientAirBillId).then(res => {
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
this.$message.success(res.data.msg);
|
|
||||||
this.reload();
|
this.reload();
|
||||||
} else {
|
},
|
||||||
this.$message.error(res.data.msg);
|
detail(record) {
|
||||||
}
|
this.$router.replace({
|
||||||
}).catch(e => {
|
path: "/atmosphere/air/collect/air/" + record.ambientAirBillId
|
||||||
this.$message.error(e.msg);
|
})
|
||||||
}).finally(() => hide());
|
},
|
||||||
},
|
edit(record) {
|
||||||
removeBatch() {
|
this.editableData[record.ambientAirBillId] = _.cloneDeep(record);
|
||||||
const ids = this.selectionList.map(item => item.ambientAirBillId);
|
this.editableData[record.ambientAirBillId].reportTime = moment(this.editableData[record.ambientAirBillId]
|
||||||
const hide = this.$message.loading('请求中..', 0);
|
.reportTime)
|
||||||
removeBatchAirBill(ids).then(res => {
|
},
|
||||||
if (res.data.code === 0) {
|
verify(record, checked) {
|
||||||
this.$message.success(res.data.msg);
|
const hide = this.$message.loading('请求中..', 0);
|
||||||
this.reload();
|
verifyAirBill({
|
||||||
} else {
|
ambientAirBillId: record.ambientAirBillId,
|
||||||
this.$message.error(res.data.msg);
|
checked
|
||||||
}
|
}).then(res => {
|
||||||
}).catch(e => {
|
if (res.data.code == 0) {
|
||||||
this.$message.error(e.msg);
|
record.checked = checked
|
||||||
}).finally(() => hide());
|
Modal.success({
|
||||||
},
|
title: "提示",
|
||||||
|
content: checked ? "审核成功" : "撤回成功"
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Modal.error({
|
||||||
|
title: "提示",
|
||||||
|
content: res.data.msg
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).catch((e) => {
|
||||||
|
this.$message.error(e.message);
|
||||||
|
}).finally(() => {
|
||||||
|
hide();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
save(record) {
|
||||||
|
|
||||||
|
let {
|
||||||
|
ambientAirBillId,
|
||||||
|
billName,
|
||||||
|
reportTime
|
||||||
|
} = this.editableData[record.ambientAirBillId];
|
||||||
|
if (!ambientAirBillId || !reportTime) {
|
||||||
|
this.$message.error('请填写完整信息再提交')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const hide = this.$message.loading('请求中..', 0);
|
||||||
|
reportTime = reportTime.format("x")
|
||||||
|
reportTime = Number(reportTime)
|
||||||
|
updateAirBill({
|
||||||
|
ambientAirBillId,
|
||||||
|
billName,
|
||||||
|
reportTime
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data.code == 0) {
|
||||||
|
this.$message.success(res.data.msg);
|
||||||
|
record.billName = billName;
|
||||||
|
record.reportTime = reportTime
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.data.msg);
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e);
|
||||||
|
this.$message.error(e.message);
|
||||||
|
}).finally(() => {
|
||||||
|
delete this.editableData[record.ambientAirBillId]
|
||||||
|
hide()
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
/* 删除单个 */
|
||||||
|
remove(row) {
|
||||||
|
const hide = this.$message.loading('请求中..', 0);
|
||||||
|
removeAirBill(row.ambientAirBillId).then(res => {
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
this.$message.success(res.data.msg);
|
||||||
|
this.reload();
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.data.msg);
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
this.$message.error(e.msg);
|
||||||
|
}).finally(() => hide());
|
||||||
|
},
|
||||||
|
removeBatch() {
|
||||||
|
const ids = this.selectionList.map(item => item.ambientAirBillId);
|
||||||
|
const hide = this.$message.loading('请求中..', 0);
|
||||||
|
removeBatchAirBill(ids).then(res => {
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
this.$message.success(res.data.msg);
|
||||||
|
this.reload();
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.data.msg);
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
this.$message.error(e.msg);
|
||||||
|
}).finally(() => hide());
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.editable-cell {
|
.editable-cell {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.editable-cell-input-wrapper,
|
.editable-cell-input-wrapper,
|
||||||
.editable-cell-text-wrapper {
|
.editable-cell-text-wrapper {
|
||||||
padding-right: 24px;
|
padding-right: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable-cell-text-wrapper {
|
.editable-cell-text-wrapper {
|
||||||
padding: 5px 24px 5px 5px;
|
padding: 5px 24px 5px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable-cell-icon,
|
.editable-cell-icon,
|
||||||
.editable-cell-icon-check {
|
.editable-cell-icon-check {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable-cell-icon {
|
.editable-cell-icon {
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable-cell-icon-check {
|
.editable-cell-icon-check {
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable-cell-icon:hover,
|
.editable-cell-icon:hover,
|
||||||
.editable-cell-icon-check:hover {
|
.editable-cell-icon-check:hover {
|
||||||
color: #108ee9;
|
color: #108ee9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.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>
|
||||||
@@ -1,164 +1,175 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="ele-body">
|
<div class="ele-body">
|
||||||
<a-card style="width: 100%" :bordered="false">
|
<a-card style="width: 100%" :bordered="false">
|
||||||
<template #title>
|
<template #title>
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-upload
|
<a-month-picker v-model:value="time"/>
|
||||||
:before-upload="importFileCity"
|
<a-upload
|
||||||
:showUploadList="false"
|
:before-upload="importFileCity"
|
||||||
accept=".xls,.xlsx,.csv"
|
:showUploadList="false"
|
||||||
>
|
accept=".xls,.xlsx,.csv"
|
||||||
<a-button>数据导入</a-button>
|
>
|
||||||
</a-upload>
|
<a-button>数据导入</a-button>
|
||||||
|
</a-upload>
|
||||||
</a-space>
|
|
||||||
</template>
|
</a-space>
|
||||||
<a-tabs v-model:activeKey="activeKey">
|
</template>
|
||||||
<a-tab-pane tab="环境空气信息" key="">
|
<a-tabs v-model:activeKey="activeKey">
|
||||||
<air-bill ref="air"></air-bill>
|
<a-tab-pane tab="环境空气信息" key="">
|
||||||
</a-tab-pane>
|
<air-bill ref="air"></air-bill>
|
||||||
</a-tabs>
|
</a-tab-pane>
|
||||||
</a-card>
|
</a-tabs>
|
||||||
</div>
|
</a-card>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<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: {
|
||||||
AirBill,
|
AirBill,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeKey: "",
|
activeKey: "",
|
||||||
};
|
time: moment()
|
||||||
},
|
};
|
||||||
methods: {
|
},
|
||||||
/* 导入本地excel文件 */
|
methods: {
|
||||||
importFileCity(file) {
|
/* 导入本地excel文件 */
|
||||||
const hide = this.$message.loading("导入中..", 0);
|
importFileCity(file) {
|
||||||
|
const hide = this.$message.loading("导入中..", 0);
|
||||||
let reader = new FileReader();
|
|
||||||
reader.onload = (e) => {
|
let reader = new FileReader();
|
||||||
try {
|
reader.onload = (e) => {
|
||||||
let data = new Uint8Array(e.target.result);
|
try {
|
||||||
let workbook = XLSX.read(data, {
|
let data = new Uint8Array(e.target.result);
|
||||||
type: "array",
|
let workbook = XLSX.read(data, {
|
||||||
cellDates: true
|
type: "array",
|
||||||
});
|
cellDates: true
|
||||||
//0.昼间数据 1.夜间数据 2.其他信息
|
});
|
||||||
let sheetNames = workbook.SheetNames;
|
//0.昼间数据 1.夜间数据 2.其他信息
|
||||||
// 解析成二维数组
|
let sheetNames = workbook.SheetNames;
|
||||||
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
|
// 解析成二维数组
|
||||||
header: 1,
|
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
|
||||||
});
|
header: 1,
|
||||||
let aoa2 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[1]], {
|
});
|
||||||
header: 1,
|
let aoa2 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[1]], {
|
||||||
});
|
header: 1,
|
||||||
let aoa3 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[2]], {
|
});
|
||||||
header: 1,
|
let aoa3 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[2]], {
|
||||||
});
|
header: 1,
|
||||||
|
});
|
||||||
const airList1 = aoa.filter(
|
|
||||||
(item) => {
|
const airList1 = aoa.filter(
|
||||||
return item.length >= 10 && item[0] != "城市"}
|
(item) => {
|
||||||
);
|
return item.length >= 10 && item[0] != "城市"
|
||||||
const airList2 = aoa2.filter(
|
}
|
||||||
(item) => item.length >= 10 && item[0] != "城市"
|
);
|
||||||
);
|
const airList2 = aoa2.filter(
|
||||||
const airList3 = aoa3.filter(
|
(item) => item.length >= 10 && item[0] != "城市"
|
||||||
(item) => item.length >= 10 && item[0] != "测点名称"
|
);
|
||||||
);
|
const airList3 = aoa3.filter(
|
||||||
|
(item) => item.length >= 10 && item[0] != "测点名称"
|
||||||
|
);
|
||||||
// 解析成对象数组
|
|
||||||
const billName1 = file.name + sheetNames[0];
|
|
||||||
const billData1 = utils.toStationObjData(airList1);
|
// 解析成对象数组
|
||||||
const billName2 = file.name + sheetNames[1];
|
const billName1 = file.name + sheetNames[0];
|
||||||
const billData2 = utils.toCityObjData(airList2);
|
const billData1 = utils.toStationObjData(airList1);
|
||||||
const billName3 = file.name + sheetNames[2];
|
const billName2 = file.name + sheetNames[1];
|
||||||
const billData3 = utils.toAreaObjData(airList3);
|
const billData2 = utils.toCityObjData(airList2);
|
||||||
if (
|
const billName3 = file.name + sheetNames[2];
|
||||||
(!billData1 || billData1.length == 0) &&
|
const billData3 = utils.toAreaObjData(airList3);
|
||||||
(!billData2 || billData2.length == 0) &&
|
if (
|
||||||
(!billData3 || billData3.length == 0)
|
(!billData1 || billData1.length == 0) &&
|
||||||
) {
|
(!billData2 || billData2.length == 0) &&
|
||||||
hide()
|
(!billData3 || billData3.length == 0)
|
||||||
Modal.error({
|
) {
|
||||||
title: "导入失败",
|
hide()
|
||||||
content: "找不到数据",
|
Modal.error({
|
||||||
});
|
title: "导入失败",
|
||||||
return;
|
content: "找不到数据",
|
||||||
}
|
});
|
||||||
|
return;
|
||||||
const tasks = [];
|
}
|
||||||
if (billData1.length > 0) {
|
|
||||||
tasks.push(
|
const tasks = [];
|
||||||
saveAirBill({
|
if (billData1.length > 0) {
|
||||||
billName: billName1,
|
tasks.push(
|
||||||
regionLevel: "place",
|
saveAirBill({
|
||||||
ambientAirList: billData1,
|
billName: billName1,
|
||||||
})
|
regionLevel: "place",
|
||||||
);
|
ambientAirList: billData1,
|
||||||
}
|
importYearMonth: this.time.format("YYYY-MM"),
|
||||||
if (billData2.length > 0) {
|
reportTime:this.time.valueOf()
|
||||||
tasks.push(
|
})
|
||||||
saveAirBill({
|
);
|
||||||
billName: billName2,
|
}
|
||||||
regionLevel: "city",
|
if (billData2.length > 0) {
|
||||||
ambientAirList: billData2,
|
tasks.push(
|
||||||
})
|
saveAirBill({
|
||||||
);
|
billName: billName2,
|
||||||
}
|
regionLevel: "city",
|
||||||
if (billData3.length > 0) {
|
ambientAirList: billData2,
|
||||||
tasks.push(
|
importYearMonth: this.time.format("YYYY-MM"),
|
||||||
saveAirBill({
|
reportTime:this.time.valueOf()
|
||||||
billName: billName3,
|
})
|
||||||
regionLevel: "county",
|
);
|
||||||
ambientAirList: billData3,
|
}
|
||||||
})
|
if (billData3.length > 0) {
|
||||||
);
|
tasks.push(
|
||||||
}
|
saveAirBill({
|
||||||
|
billName: billName3,
|
||||||
// 上传到服务器
|
regionLevel: "county",
|
||||||
|
ambientAirList: billData3,
|
||||||
Promise.all(tasks)
|
importYearMonth: this.time.format("YYYY-MM"),
|
||||||
.then(() => {
|
reportTime:this.time.valueOf()
|
||||||
Modal.success({
|
|
||||||
title: "导入成功",
|
})
|
||||||
content: `成功导入${billData1.length + billData2.length + billData3.length}条数据`,
|
);
|
||||||
});
|
}
|
||||||
this.$refs.air && this.$refs.air.reload();
|
|
||||||
})
|
// 上传到服务器
|
||||||
.catch(() => {
|
|
||||||
Modal.error({
|
Promise.all(tasks)
|
||||||
title: "导入失败",
|
.then(() => {
|
||||||
content: "数据上传出错",
|
Modal.success({
|
||||||
});
|
title: "导入成功",
|
||||||
})
|
content: `成功导入${billData1.length + billData2.length + billData3.length}条数据`,
|
||||||
.finally(() => {
|
});
|
||||||
hide();
|
this.$refs.air && this.$refs.air.reload();
|
||||||
});
|
})
|
||||||
} catch (error) {
|
.catch(() => {
|
||||||
hide();
|
Modal.error({
|
||||||
Modal.error({
|
title: "导入失败",
|
||||||
title: "导入失败",
|
content: "数据上传出错",
|
||||||
content: error.message,
|
});
|
||||||
});
|
})
|
||||||
}
|
.finally(() => {
|
||||||
// console.log(billData);
|
hide();
|
||||||
};
|
});
|
||||||
reader.readAsArrayBuffer(file);
|
} catch (error) {
|
||||||
|
hide();
|
||||||
return false;
|
Modal.error({
|
||||||
|
title: "导入失败",
|
||||||
|
content: error.message,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// console.log(billData);
|
||||||
|
};
|
||||||
|
reader.readAsArrayBuffer(file);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
196
src/views/atmosphere/air/ranking/day.vue
Normal file
196
src/views/atmosphere/air/ranking/day.vue
Normal 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>
|
||||||
49
src/views/atmosphere/air/ranking/index.vue
Normal file
49
src/views/atmosphere/air/ranking/index.vue
Normal 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>
|
||||||
175
src/views/atmosphere/air/ranking/month.vue
Normal file
175
src/views/atmosphere/air/ranking/month.vue
Normal 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>
|
||||||
193
src/views/atmosphere/air/ranking/year.vue
Normal file
193
src/views/atmosphere/air/ranking/year.vue
Normal 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>
|
||||||
Reference in New Issue
Block a user