大气
This commit is contained in:
@@ -66,6 +66,15 @@ const statisticUrl = "/ambientAir/ambientAir/statistic";
|
||||
//城区统计
|
||||
const statisticAreaBase = "/ambientAir/ambientAir/statistic/areaBase";
|
||||
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 {
|
||||
pageBillUrl,
|
||||
saveAirBill,
|
||||
@@ -84,6 +93,13 @@ export {
|
||||
statisticAvg,
|
||||
statisticUrl,
|
||||
statisticAreaBase,
|
||||
statisticArea
|
||||
statisticArea,
|
||||
airDayRankUrl,
|
||||
airMonthRankUrl,
|
||||
airYearRankUrl,
|
||||
airPm25YearRankUrl,
|
||||
airYearProvincialCapitalRankUrl,
|
||||
airPm25YearProvincialCapitalRankUrl,
|
||||
airMonthProvincialCapitalRankUrl
|
||||
|
||||
}
|
||||
|
||||
@@ -41,89 +41,89 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
/* 导入本地excel文件 */
|
||||
importFileCity(file) {
|
||||
async importFileCity(file) {
|
||||
const hide = this.$message.loading("导入中..", 0);
|
||||
|
||||
let reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
try {
|
||||
let data = new Uint8Array(e.target.result);
|
||||
let workbook = XLSX.read(data, {
|
||||
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();
|
||||
reader.onload = async (e) => {
|
||||
try {
|
||||
let data = new Uint8Array(e.target.result);
|
||||
let workbook = XLSX.read(data, {
|
||||
type: "array",
|
||||
});
|
||||
} catch (error) {
|
||||
hide();
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: error.message,
|
||||
});
|
||||
}
|
||||
// console.log(billData);
|
||||
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 = 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);
|
||||
|
||||
|
||||
@@ -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 {
|
||||
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 => {
|
||||
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");
|
||||
@@ -8,6 +15,7 @@ export default {
|
||||
console.log(item);
|
||||
const row = {
|
||||
city: "南宁市",
|
||||
place: dict.find(p=>p.placeCode = item[0].split("~")[0]).place,
|
||||
code: item[0],
|
||||
precipitationType:item[10],
|
||||
precipitation:item[11],
|
||||
|
||||
@@ -44,13 +44,13 @@
|
||||
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
|
||||
>
|
||||
<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>
|
||||
</a-modal>
|
||||
<a-modal
|
||||
v-model:visible="showEdit"
|
||||
:title="form.roadNoisePlaceId !== undefined ? '修改' : '添加'"
|
||||
:title="form.acidRainPlaceBaseInfoDictId !== undefined ? '修改' : '添加'"
|
||||
:confirm-loading="loading"
|
||||
:width="800"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@@ -64,55 +64,25 @@
|
||||
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
|
||||
>
|
||||
<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 label="测点名称" name="placeName">
|
||||
<a-input v-model:value="form.placeName" placeholder="请输入测点名称" allow-clear/>
|
||||
<a-form-item label="点位名称" name="place">
|
||||
<a-input v-model:value="form.place" placeholder="请输入点位名称" allow-clear/>
|
||||
</a-form-item>
|
||||
<a-form-item label="测点经度" name="placeLng">
|
||||
<a-input v-model:value="form.placeLng" placeholder="请输入测点经度" allow-clear/>
|
||||
<a-form-item label="属性" name="attribute">
|
||||
<a-input v-model:value="form.attribute" placeholder="请输入点位属性" allow-clear/>
|
||||
</a-form-item>
|
||||
<a-form-item label="测点纬度" name="placeLat">
|
||||
<a-input v-model:value="form.placeLat" placeholder="请输入测点纬度" allow-clear/>
|
||||
<a-form-item label="ph限值" name="ph">
|
||||
<a-input type="number" v-model:value="form.ph" placeholder="请输入ph限值" allow-clear/>
|
||||
</a-form-item>
|
||||
<a-form-item label="机动车车道数" name="motorway">
|
||||
<a-input type="number" v-model:value="form.motorway" placeholder="请输入机动车车道数" allow-clear/>
|
||||
<a-form-item label="点位编号" name="placeCode">
|
||||
<a-input v-model:value="form.placeCode" placeholder="请输入点位编号" allow-clear/>
|
||||
</a-form-item>
|
||||
<a-form-item label="车道类别" name="motorwayType">
|
||||
<a-input v-model:value="form.motorwayType" placeholder="请输入车道类别" allow-clear/>
|
||||
<a-form-item label="点位经度" name="longitude">
|
||||
<a-input type="number" v-model:value="form.longitude" placeholder="请输入点位经度" allow-clear/>
|
||||
</a-form-item>
|
||||
<a-form-item label="道路等级" name="motorwayLevel">
|
||||
<a-input v-model:value="form.motorwayLevel" 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 label="点位纬度" name="latitude">
|
||||
<a-input type="number" v-model:value="form.latitude" placeholder="请输入点位纬度" allow-clear/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
@@ -120,13 +90,13 @@
|
||||
<ele-pro-table
|
||||
v-model:selection="selectionList"
|
||||
ref="table"
|
||||
row-key="roadNoisePlaceId"
|
||||
:datasource="url"
|
||||
:columns="columns"
|
||||
:where="where"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
:need-page="false"
|
||||
@done="(d) => (data = d.data)"
|
||||
|
||||
>
|
||||
<template #toolbar>
|
||||
<a-space>
|
||||
@@ -211,6 +181,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
|
||||
|
||||
// 表格数据接口
|
||||
url: listAllUrl,
|
||||
selection: [],
|
||||
@@ -226,6 +198,21 @@ export default {
|
||||
dataIndex: "place",
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: "点位编号",
|
||||
dataIndex: "placeCode",
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: "属性",
|
||||
dataIndex: "attribute",
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: "ph限值",
|
||||
dataIndex: "ph",
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: "经度",
|
||||
dataIndex: "longitude",
|
||||
@@ -254,17 +241,17 @@ export default {
|
||||
selectionList: [],
|
||||
// 是否显示编辑弹窗
|
||||
showEdit: false,
|
||||
showNYear:false,
|
||||
showNYear: false,
|
||||
cYear: undefined,
|
||||
nYear:undefined,
|
||||
nYear: undefined,
|
||||
// 表单数据
|
||||
form: {},
|
||||
loading: false,
|
||||
rules: {
|
||||
year: [{required: true, message: '请输入年份'}],
|
||||
placeName: [{required: true, message: '请选择测点名称'}],
|
||||
placeLng: [{required: true, message: '请输入测点经度',},],
|
||||
placeLat: [{required: true, message: '请输入测点纬度',},],
|
||||
placeName: [{required: true, message: '请选择点位名称'}],
|
||||
placeLng: [{required: true, message: '请输入点位经度',},],
|
||||
placeLat: [{required: true, message: '请输入点位纬度',},],
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -272,6 +259,10 @@ export default {
|
||||
this.getOptions();
|
||||
},
|
||||
methods: {
|
||||
parseData:(res)=>{
|
||||
console.log(res)
|
||||
return [];
|
||||
},
|
||||
/* 刷新表格 */
|
||||
reload() {
|
||||
|
||||
@@ -279,7 +270,7 @@ export default {
|
||||
where: this.where,
|
||||
});
|
||||
},
|
||||
getOptions(){
|
||||
getOptions() {
|
||||
getColumnOptions("year").then(res => {
|
||||
console.log(res)
|
||||
if (res.data.code == 0) {
|
||||
@@ -306,11 +297,12 @@ export default {
|
||||
this.$refs.form.clearValidate(); // 清除表单验证信息
|
||||
});
|
||||
},
|
||||
|
||||
async save() {
|
||||
await this.$refs.form.validate();
|
||||
const hide = this.$message.loading('请求中..', 0);
|
||||
const form = this.form;
|
||||
if (form.roadNoisePlaceId) {
|
||||
if (form.acidRainPlaceBaseInfoDictId) {
|
||||
updatePlace(form)
|
||||
.then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
@@ -351,7 +343,7 @@ export default {
|
||||
/* 删除单个 */
|
||||
remove(row) {
|
||||
const hide = this.$message.loading('请求中..', 0);
|
||||
removePlace(row.roadNoisePlaceId).then((res) => {
|
||||
removePlace(row.acidRainPlaceBaseInfoDictId).then((res) => {
|
||||
hide();
|
||||
if (res.data.code === 0) {
|
||||
this.$message.success(res.data.msg);
|
||||
@@ -367,7 +359,7 @@ export default {
|
||||
/* 批量删除 */
|
||||
removeBatch() {
|
||||
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) => {
|
||||
if (res.data.code === 0) {
|
||||
this.$message.success(res.data.msg);
|
||||
@@ -381,13 +373,13 @@ export default {
|
||||
hide();
|
||||
})
|
||||
},
|
||||
setCYear(e){
|
||||
setCYear(e) {
|
||||
this.cYear = e.key;
|
||||
this.showNYear = true;
|
||||
},
|
||||
copyBatch(){
|
||||
copyBatch() {
|
||||
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) {
|
||||
this.$message.success(res.data.msg);
|
||||
this.reload();
|
||||
@@ -402,12 +394,12 @@ export default {
|
||||
hide();
|
||||
})
|
||||
},
|
||||
exportData(){
|
||||
const columns = this.columns.filter(item=>item.dataIndex);
|
||||
exportData() {
|
||||
const columns = this.columns.filter(item => item.dataIndex);
|
||||
const arr = [];
|
||||
const th = columns.map((item) => item.title);
|
||||
arr.push(th);
|
||||
this.data.forEach((d) => {
|
||||
this.data.forEach((d) => {
|
||||
const td = columns.map((item) => d[item.dataIndex]);
|
||||
arr.push(td);
|
||||
});
|
||||
|
||||
@@ -9,21 +9,21 @@
|
||||
: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-select v-model:value="where.regionLevel">-->
|
||||
<!-- <a-select-option-->
|
||||
<!-- v-for="(item) in modelOptions"-->
|
||||
<!-- :key="item.value"-->
|
||||
<!-- >{{ item.label }}-->
|
||||
<!-- </a-select-option>-->
|
||||
<!-- </a-select>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- </a-col>-->
|
||||
<!-- <a-col :lg="6" :md="12" :sm="24" :xs="24">-->
|
||||
<!-- <a-form-item label="区域等级:">-->
|
||||
<!-- <a-select v-model:value="where.regionLevel">-->
|
||||
<!-- <a-select-option-->
|
||||
<!-- v-for="(item) in modelOptions"-->
|
||||
<!-- :key="item.value"-->
|
||||
<!-- >{{ item.label }}-->
|
||||
<!-- </a-select-option>-->
|
||||
<!-- </a-select>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- </a-col>-->
|
||||
|
||||
<a-col :lg="6" :md="12" :sm="24" :xs="24">
|
||||
<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-col>
|
||||
</a-row>
|
||||
@@ -49,6 +49,7 @@
|
||||
:scroll="{ x: 'max-content' }"
|
||||
:init-load="false"
|
||||
@done="(d) => (data = d.data)"
|
||||
:parseData="parseData"
|
||||
method="POST"
|
||||
>
|
||||
|
||||
@@ -62,7 +63,7 @@
|
||||
import _ from "lodash";
|
||||
import XLSX from "xlsx";
|
||||
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 moment from "moment";
|
||||
|
||||
@@ -73,6 +74,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
mode:['month', 'month'],
|
||||
locale,
|
||||
bill: {},
|
||||
// 表格数据接口
|
||||
@@ -82,17 +84,22 @@ export default {
|
||||
{label: "市", value: "city"},
|
||||
{label: "县", value: "county"},
|
||||
{label: "站点", value: "place"},
|
||||
|
||||
],
|
||||
// 表格列配置
|
||||
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: [],
|
||||
time: undefined,
|
||||
// 表格搜索条件
|
||||
where: {
|
||||
},
|
||||
where: {},
|
||||
// 表格选中数据
|
||||
selectionList: [],
|
||||
};
|
||||
@@ -102,6 +109,29 @@ export default {
|
||||
this.reload();
|
||||
},
|
||||
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() {
|
||||
getColumnOptions("region_level").then((res) => {
|
||||
@@ -121,15 +151,15 @@ export default {
|
||||
where.timeStart = `${year}-01-01 00:00:00`;
|
||||
where.timeEnd = moment(Date.now()).format("YYYY-MM-DD 00:00:00")
|
||||
} else {
|
||||
if(this.time[0].year() != this.time[1].year()){
|
||||
if (this.time[0].year() != this.time[1].year()) {
|
||||
Modal.error({
|
||||
title: "查询失败",
|
||||
content: "开始时间与结束时间年份不一致",
|
||||
})
|
||||
return;
|
||||
}
|
||||
where.timeStart = this.time[0].format("YYYY-MM-DD 00:00:00");
|
||||
where.timeEnd = this.time[1].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-01 00:00:00");
|
||||
}
|
||||
this.$refs.table.reload({
|
||||
where
|
||||
@@ -137,8 +167,7 @@ export default {
|
||||
},
|
||||
/* 重置搜索 */
|
||||
reset() {
|
||||
this.where = {
|
||||
};
|
||||
this.where = {};
|
||||
this.time = undefined;
|
||||
this.reload();
|
||||
},
|
||||
@@ -148,22 +177,22 @@ export default {
|
||||
const th2 = [];
|
||||
const merges = []; // 合并
|
||||
const columnsTemp = []; // 树形结构整理成list
|
||||
this.columns.forEach((item,index)=>{
|
||||
if(item.children){
|
||||
item.children.forEach((citem)=>{
|
||||
this.columns.forEach((item, index) => {
|
||||
if (item.children) {
|
||||
item.children.forEach((citem) => {
|
||||
th1.push(item.title)
|
||||
th2.push(citem.title)
|
||||
columnsTemp.push(citem)
|
||||
})
|
||||
merges.push({s: {r: 0, c: th1.length-item.children.length}, e: {r: 0, c: th1.length-1}})
|
||||
}else{
|
||||
merges.push({s: {r: 0, c: th1.length - item.children.length}, e: {r: 0, c: th1.length - 1}})
|
||||
} else {
|
||||
th1.push(item.title)
|
||||
th2.push("")
|
||||
columnsTemp.push(item)
|
||||
merges.push({s: {r: 0, c: index}, e: {r: 1, c: index}})
|
||||
}
|
||||
})
|
||||
arr.push(th1,th2);
|
||||
arr.push(th1, th2);
|
||||
this.data.forEach((d) => {
|
||||
const td = columnsTemp.map((item) => d[item.dataIndex]);
|
||||
arr.push(td);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<a-col :lg="6" :md="12" :sm="24" :xs="24">
|
||||
<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-col>
|
||||
</a-row>
|
||||
@@ -50,6 +50,7 @@
|
||||
:init-load="false"
|
||||
@done="(d) => (data = d.data)"
|
||||
method="POST"
|
||||
:parseData="parseData"
|
||||
>
|
||||
|
||||
</ele-pro-table>
|
||||
@@ -86,7 +87,14 @@ export default {
|
||||
],
|
||||
// 表格列配置
|
||||
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: [],
|
||||
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() {
|
||||
const where = _.cloneDeep(this.where);
|
||||
@@ -128,8 +159,8 @@ export default {
|
||||
})
|
||||
return;
|
||||
}
|
||||
where.timeStart = this.time[0].format("YYYY-MM-DD 00:00:00");
|
||||
where.timeEnd = this.time[1].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-01 00:00:00");
|
||||
}
|
||||
this.$refs.table.reload({
|
||||
where
|
||||
|
||||
@@ -1,391 +1,406 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table v-model:selection="selectionList" ref="table" row-key="ambientAirBillId" :datasource="url"
|
||||
:columns="columns" :where="where" :scroll="{x: 'max-content'}">
|
||||
<template #toolbar>
|
||||
<div>
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table v-model:selection="selectionList" ref="table" row-key="ambientAirBillId" :datasource="url"
|
||||
:columns="columns" :where="where" :scroll="{x: 'max-content'}">
|
||||
<template #toolbar>
|
||||
|
||||
<!-- 搜索表单 -->
|
||||
<a-form layout="inline" :model="where" :labelCol="{ offset: 1}">
|
||||
<a-form-item label="区域等级:">
|
||||
<a-select v-model:value="where.regionLevel" allowClear placeholder="未选择">
|
||||
<a-select-option :value="'市级'">市级</a-select-option>
|
||||
<a-select-option :value="'县级'">县级</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="审核状态:">
|
||||
<a-select v-model:value="where.checked" allowClear placeholder="未选择">
|
||||
<a-select-option :value="1">已审核</a-select-option>
|
||||
<a-select-option :value="0">未审核</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<!-- 搜索表单 -->
|
||||
<a-form layout="inline" :model="where" :labelCol="{ offset: 1}">
|
||||
<a-form-item label="区域等级:">
|
||||
<a-select v-model:value="where.regionLevel" allowClear placeholder="未选择">
|
||||
<a-select-option :value="'city'">市</a-select-option>
|
||||
<a-select-option :value="'county'">县</a-select-option>
|
||||
<a-select-option :value="'place'">站点</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="审核状态:">
|
||||
<a-select v-model:value="where.checked" allowClear placeholder="未选择">
|
||||
<a-select-option :value="1">已审核</a-select-option>
|
||||
<a-select-option :value="0">未审核</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="表格名称:">
|
||||
<a-input v-model:value.trim="where.billName" placeholder="请输入" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item label="表格名称:">
|
||||
<a-input v-model:value.trim="where.billName" placeholder="请输入" allow-clear/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="上报时间:">
|
||||
<a-range-picker separator="~" v-model:value="reportTimeScope" />
|
||||
</a-form-item>
|
||||
<a-form-item label="上报时间:">
|
||||
<a-range-picker separator="-" v-model:value="reportTimeScope"/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item class="ele-text-right" :wrapper-col="{span: 24}">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="reload">查询</a-button>
|
||||
<a-button @click="reset">重置</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</template>
|
||||
<template #toolkit>
|
||||
<a-popconfirm :disabled="selectionList.length == 0" :title="`确认删除${selectionList.length}条数据吗?`" ok-text="Yes"
|
||||
cancel-text="No" @confirm="removeBatch">
|
||||
<a-button :disabled="selectionList.length == 0" type="primary" ghost danger>批量删除</a-button>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
<template #billName="{ text, record }">
|
||||
<div class="editable-cell">
|
||||
<div v-if="editableData[record.ambientAirBillId]" class="editable-cell-input-wrapper">
|
||||
<a-input v-model:value="editableData[record.ambientAirBillId].billName" @pressEnter="save(record)" />
|
||||
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
|
||||
</div>
|
||||
<div v-else class="editable-cell-text-wrapper">
|
||||
{{ text || ' ' }}
|
||||
<edit-outlined class="editable-cell-icon" @click="edit(record)" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #reportTime="{ text, record }">
|
||||
<div class="editable-cell">
|
||||
<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-input v-model:value="editableData[record.ambientAirBillId].reportTime" @pressEnter="save(record)" /> -->
|
||||
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
|
||||
</div>
|
||||
<div v-else class="editable-cell-text-wrapper">
|
||||
{{ $util.toDateString(text,'yyyy-MM-dd') || ' ' }}
|
||||
<edit-outlined class="editable-cell-icon" @click="edit(record)" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #checked="{text}">
|
||||
<a-form-item class="ele-text-right" :wrapper-col="{span: 24}">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="reload">查询</a-button>
|
||||
<a-button @click="reset">重置</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</template>
|
||||
<template #toolkit>
|
||||
<a-popconfirm :disabled="selectionList.length == 0" :title="`确认删除${selectionList.length}条数据吗?`"
|
||||
ok-text="Yes"
|
||||
cancel-text="No" @confirm="removeBatch">
|
||||
<a-button :disabled="selectionList.length == 0" type="primary" ghost danger>批量删除</a-button>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
<template #billName="{ text, record }">
|
||||
<div class="editable-cell">
|
||||
<div v-if="editableData[record.ambientAirBillId]" class="editable-cell-input-wrapper">
|
||||
<a-input v-model:value="editableData[record.ambientAirBillId].billName"
|
||||
@pressEnter="save(record)"/>
|
||||
<check-outlined class="editable-cell-icon-check" @click="save(record)"/>
|
||||
</div>
|
||||
<div v-else class="editable-cell-text-wrapper">
|
||||
{{ text || ' ' }}
|
||||
<edit-outlined class="editable-cell-icon" @click="edit(record)"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #reportTime="{ text, record }">
|
||||
<div class="editable-cell">
|
||||
<div v-if="editableData[record.ambientAirBillId]" class="editable-cell-input-wrapper">
|
||||
<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)" /> -->
|
||||
<check-outlined class="editable-cell-icon-check" @click="save(record)"/>
|
||||
</div>
|
||||
<div v-else class="editable-cell-text-wrapper">
|
||||
{{ $util.toDateString(text, 'yyyy-MM') || ' ' }}
|
||||
<edit-outlined class="editable-cell-icon" @click="edit(record)"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #checked="{text}">
|
||||
<span>
|
||||
<a-tag v-if="text" color="green">已审核</a-tag>
|
||||
<a-tag v-else color="orange">未审核</a-tag>
|
||||
</span>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-button @click="detail(record)" shape="round" size="small">查看</a-button>
|
||||
<span v-hasPermi="['ecology:sound:verify']">
|
||||
<a-popconfirm v-if="record.checked != 1" :title="`审核通过后将无法修改,确认?`" ok-text="Yes" cancel-text="No"
|
||||
@confirm="verify(record,1)">
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-button @click="detail(record)" shape="round" size="small">查看</a-button>
|
||||
<span v-hasPermi="['ecology:sound:verify']">
|
||||
<a-popconfirm v-if="record.checked != 1" :title="`审核通过后将无法修改,确认?`" ok-text="Yes" cancel-text="No"
|
||||
@confirm="verify(record,1)">
|
||||
<a-button type="primary" shape="round" size="small">审核</a-button>
|
||||
</a-popconfirm>
|
||||
<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-popconfirm>
|
||||
</span>
|
||||
<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-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</div>
|
||||
<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-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import _ from "lodash"
|
||||
import {
|
||||
import _ from "lodash"
|
||||
import {
|
||||
CheckOutlined,
|
||||
EditOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import {
|
||||
} from '@ant-design/icons-vue';
|
||||
import {Modal} from 'ant-design-vue';
|
||||
import {
|
||||
pageBillUrl,
|
||||
// saveAirBill,
|
||||
removeAirBill,
|
||||
removeBatchAirBill,
|
||||
updateAirBill,
|
||||
verifyAirBill
|
||||
} from "@/api/ecology/air";
|
||||
import moment from "moment";
|
||||
export default {
|
||||
} from "@/api/ecology/air";
|
||||
import moment from "moment";
|
||||
|
||||
export default {
|
||||
name: 'AirCollectBill',
|
||||
components: {
|
||||
CheckOutlined,
|
||||
EditOutlined
|
||||
CheckOutlined,
|
||||
EditOutlined
|
||||
},
|
||||
data() {
|
||||
|
||||
return {
|
||||
// 表格数据接口
|
||||
url: pageBillUrl,
|
||||
selection: [],
|
||||
// 表格列配置
|
||||
columns: [{
|
||||
key: 'index',
|
||||
dataIndex: 'index',
|
||||
width: 48,
|
||||
align: 'center',
|
||||
customRender: ({
|
||||
index
|
||||
}) => index + 1
|
||||
},
|
||||
{
|
||||
title: '表格名称',
|
||||
dataIndex: 'billName',
|
||||
sorter: true,
|
||||
slots: {
|
||||
customRender: 'billName',
|
||||
return {
|
||||
// 表格数据接口
|
||||
url: pageBillUrl,
|
||||
selection: [],
|
||||
// 表格列配置
|
||||
columns: [{
|
||||
key: 'index',
|
||||
dataIndex: 'index',
|
||||
width: 48,
|
||||
align: 'center',
|
||||
customRender: ({
|
||||
index
|
||||
}) => index + 1
|
||||
},
|
||||
{
|
||||
title: '表格名称',
|
||||
dataIndex: 'billName',
|
||||
sorter: true,
|
||||
slots: {
|
||||
customRender: 'billName',
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
title: '区域等级',
|
||||
dataIndex: 'regionLevel',
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '条目',
|
||||
dataIndex: 'recordSize',
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '区域等级',
|
||||
dataIndex: 'regionLevel',
|
||||
sorter: true,
|
||||
customRender:({text})=>{
|
||||
if(text == "place"){
|
||||
return "站点"
|
||||
}else if(text == "city"){
|
||||
return "市"
|
||||
}else if(text == "county"){
|
||||
return "县"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '条目',
|
||||
dataIndex: 'recordSize',
|
||||
sorter: true,
|
||||
|
||||
},
|
||||
// {
|
||||
// title: '菜单名称',
|
||||
// dataIndex: 'title',
|
||||
// sorter: true
|
||||
// },
|
||||
{
|
||||
title: '上报时间',
|
||||
dataIndex: 'reportTime',
|
||||
sorter: true,
|
||||
slots: {
|
||||
customRender: 'reportTime',
|
||||
},
|
||||
// customRender: ({
|
||||
// text
|
||||
// }) => this.$util.toDateString(text)
|
||||
},
|
||||
{
|
||||
title: '导入时间',
|
||||
dataIndex: 'createTime',
|
||||
sorter: true,
|
||||
customRender: ({
|
||||
text
|
||||
}) => this.$util.toDateString(text)
|
||||
},
|
||||
{
|
||||
title: '审核状态',
|
||||
dataIndex: 'checked',
|
||||
sorter: true,
|
||||
slots: {
|
||||
customRender: 'checked',
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '菜单名称',
|
||||
// dataIndex: 'title',
|
||||
// sorter: true
|
||||
// },
|
||||
{
|
||||
title: '上报时间',
|
||||
dataIndex: 'reportTime',
|
||||
sorter: true,
|
||||
slots: {
|
||||
customRender: 'reportTime',
|
||||
},
|
||||
// customRender: ({
|
||||
// text
|
||||
// }) => this.$util.toDateString(text)
|
||||
},
|
||||
{
|
||||
title: '导入时间',
|
||||
dataIndex: 'createTime',
|
||||
sorter: true,
|
||||
customRender: ({
|
||||
text
|
||||
}) => this.$util.toDateString(text)
|
||||
},
|
||||
{
|
||||
title: '审核状态',
|
||||
dataIndex: 'checked',
|
||||
sorter: true,
|
||||
slots: {
|
||||
customRender: 'checked',
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
dataIndex: 'userName',
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
dataIndex: 'userName',
|
||||
sorter: true,
|
||||
|
||||
},
|
||||
// {
|
||||
// title: '更新时间',
|
||||
// dataIndex: 'updateTime',
|
||||
// sorter: true,
|
||||
// customRender: ({
|
||||
// text
|
||||
// }) => this.$util.toDateString(text)
|
||||
// },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 150,
|
||||
align: 'center',
|
||||
slots: {
|
||||
customRender: 'action'
|
||||
}
|
||||
}
|
||||
],
|
||||
// 表格搜索条件
|
||||
where: {},
|
||||
reportTimeScope: [],
|
||||
// 表格选中数据
|
||||
selectionList: [],
|
||||
editableData: {},
|
||||
// 当前编辑数据
|
||||
current: null,
|
||||
};
|
||||
},
|
||||
// {
|
||||
// title: '更新时间',
|
||||
// dataIndex: 'updateTime',
|
||||
// sorter: true,
|
||||
// customRender: ({
|
||||
// text
|
||||
// }) => this.$util.toDateString(text)
|
||||
// },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 150,
|
||||
align: 'center',
|
||||
slots: {
|
||||
customRender: 'action'
|
||||
}
|
||||
}
|
||||
],
|
||||
// 表格搜索条件
|
||||
where: {},
|
||||
reportTimeScope: [],
|
||||
// 表格选中数据
|
||||
selectionList: [],
|
||||
editableData: {},
|
||||
// 当前编辑数据
|
||||
current: null,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
|
||||
/* 刷新表格 */
|
||||
reload() {
|
||||
this.where.reportTimeStart = null;
|
||||
this.where.reportTimeEnd = null;
|
||||
if (this.reportTimeScope && this.reportTimeScope.length == 2) {
|
||||
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.$refs.table.reload({
|
||||
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?"审核成功":"撤回成功"
|
||||
/* 刷新表格 */
|
||||
reload() {
|
||||
this.where.reportTimeStart = null;
|
||||
this.where.reportTimeEnd = null;
|
||||
if (this.reportTimeScope && this.reportTimeScope.length == 2) {
|
||||
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.$refs.table.reload({
|
||||
where: this.where
|
||||
});
|
||||
} 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);
|
||||
},
|
||||
/* 重置搜索 */
|
||||
reset() {
|
||||
this.where = {};
|
||||
this.reportTimeScope = [];
|
||||
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());
|
||||
},
|
||||
},
|
||||
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: "提示",
|
||||
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>
|
||||
|
||||
<style lang="less">
|
||||
.editable-cell {
|
||||
.editable-cell {
|
||||
position: relative;
|
||||
|
||||
.editable-cell-input-wrapper,
|
||||
.editable-cell-text-wrapper {
|
||||
padding-right: 24px;
|
||||
padding-right: 24px;
|
||||
}
|
||||
|
||||
.editable-cell-text-wrapper {
|
||||
padding: 5px 24px 5px 5px;
|
||||
padding: 5px 24px 5px 5px;
|
||||
}
|
||||
|
||||
.editable-cell-icon,
|
||||
.editable-cell-icon-check {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
width: 20px;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
width: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.editable-cell-icon {
|
||||
margin-top: 4px;
|
||||
display: none;
|
||||
margin-top: 4px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.editable-cell-icon-check {
|
||||
line-height: 28px;
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
.editable-cell-icon:hover,
|
||||
.editable-cell-icon-check:hover {
|
||||
color: #108ee9;
|
||||
color: #108ee9;
|
||||
}
|
||||
|
||||
.editable-add-btn {
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.editable-cell:hover .editable-cell-icon {
|
||||
.editable-cell:hover .editable-cell-icon {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,164 +1,175 @@
|
||||
<template>
|
||||
<div class="ele-body">
|
||||
<a-card style="width: 100%" :bordered="false">
|
||||
<template #title>
|
||||
<a-space>
|
||||
<a-upload
|
||||
:before-upload="importFileCity"
|
||||
:showUploadList="false"
|
||||
accept=".xls,.xlsx,.csv"
|
||||
>
|
||||
<a-button>数据导入</a-button>
|
||||
</a-upload>
|
||||
<div class="ele-body">
|
||||
<a-card style="width: 100%" :bordered="false">
|
||||
<template #title>
|
||||
<a-space>
|
||||
<a-month-picker v-model:value="time"/>
|
||||
<a-upload
|
||||
:before-upload="importFileCity"
|
||||
:showUploadList="false"
|
||||
accept=".xls,.xlsx,.csv"
|
||||
>
|
||||
<a-button>数据导入</a-button>
|
||||
</a-upload>
|
||||
|
||||
</a-space>
|
||||
</template>
|
||||
<a-tabs v-model:activeKey="activeKey">
|
||||
<a-tab-pane tab="环境空气信息" key="">
|
||||
<air-bill ref="air"></air-bill>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-card>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<a-tabs v-model:activeKey="activeKey">
|
||||
<a-tab-pane tab="环境空气信息" key="">
|
||||
<air-bill ref="air"></air-bill>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import XLSX from "xlsx";
|
||||
import utils from "./utils";
|
||||
import { Modal } from "ant-design-vue";
|
||||
import {Modal} from "ant-design-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 {
|
||||
name: "AirCollectIndex",
|
||||
components: {
|
||||
AirBill,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeKey: "",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/* 导入本地excel文件 */
|
||||
importFileCity(file) {
|
||||
const hide = this.$message.loading("导入中..", 0);
|
||||
|
||||
let reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
try {
|
||||
let data = new Uint8Array(e.target.result);
|
||||
let workbook = XLSX.read(data, {
|
||||
type: "array",
|
||||
cellDates: true
|
||||
});
|
||||
//0.昼间数据 1.夜间数据 2.其他信息
|
||||
let sheetNames = workbook.SheetNames;
|
||||
// 解析成二维数组
|
||||
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 aoa3 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[2]], {
|
||||
header: 1,
|
||||
});
|
||||
|
||||
const airList1 = aoa.filter(
|
||||
(item) => {
|
||||
return item.length >= 10 && item[0] != "城市"}
|
||||
);
|
||||
const airList2 = aoa2.filter(
|
||||
(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 billData2 = utils.toCityObjData(airList2);
|
||||
const billName3 = file.name + sheetNames[2];
|
||||
const billData3 = utils.toAreaObjData(airList3);
|
||||
if (
|
||||
(!billData1 || billData1.length == 0) &&
|
||||
(!billData2 || billData2.length == 0) &&
|
||||
(!billData3 || billData3.length == 0)
|
||||
) {
|
||||
hide()
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "找不到数据",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const tasks = [];
|
||||
if (billData1.length > 0) {
|
||||
tasks.push(
|
||||
saveAirBill({
|
||||
billName: billName1,
|
||||
regionLevel: "place",
|
||||
ambientAirList: billData1,
|
||||
})
|
||||
);
|
||||
}
|
||||
if (billData2.length > 0) {
|
||||
tasks.push(
|
||||
saveAirBill({
|
||||
billName: billName2,
|
||||
regionLevel: "city",
|
||||
ambientAirList: billData2,
|
||||
})
|
||||
);
|
||||
}
|
||||
if (billData3.length > 0) {
|
||||
tasks.push(
|
||||
saveAirBill({
|
||||
billName: billName3,
|
||||
regionLevel: "county",
|
||||
ambientAirList: billData3,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// 上传到服务器
|
||||
|
||||
Promise.all(tasks)
|
||||
.then(() => {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData1.length + billData2.length + billData3.length}条数据`,
|
||||
});
|
||||
this.$refs.air && this.$refs.air.reload();
|
||||
})
|
||||
.catch(() => {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
});
|
||||
} catch (error) {
|
||||
hide();
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: error.message,
|
||||
});
|
||||
}
|
||||
// console.log(billData);
|
||||
};
|
||||
reader.readAsArrayBuffer(file);
|
||||
|
||||
return false;
|
||||
name: "AirCollectIndex",
|
||||
components: {
|
||||
AirBill,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeKey: "",
|
||||
time: moment()
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/* 导入本地excel文件 */
|
||||
importFileCity(file) {
|
||||
const hide = this.$message.loading("导入中..", 0);
|
||||
|
||||
},
|
||||
let reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
try {
|
||||
let data = new Uint8Array(e.target.result);
|
||||
let workbook = XLSX.read(data, {
|
||||
type: "array",
|
||||
cellDates: true
|
||||
});
|
||||
//0.昼间数据 1.夜间数据 2.其他信息
|
||||
let sheetNames = workbook.SheetNames;
|
||||
// 解析成二维数组
|
||||
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 aoa3 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[2]], {
|
||||
header: 1,
|
||||
});
|
||||
|
||||
const airList1 = aoa.filter(
|
||||
(item) => {
|
||||
return item.length >= 10 && item[0] != "城市"
|
||||
}
|
||||
);
|
||||
const airList2 = aoa2.filter(
|
||||
(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 billData2 = utils.toCityObjData(airList2);
|
||||
const billName3 = file.name + sheetNames[2];
|
||||
const billData3 = utils.toAreaObjData(airList3);
|
||||
if (
|
||||
(!billData1 || billData1.length == 0) &&
|
||||
(!billData2 || billData2.length == 0) &&
|
||||
(!billData3 || billData3.length == 0)
|
||||
) {
|
||||
hide()
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "找不到数据",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const tasks = [];
|
||||
if (billData1.length > 0) {
|
||||
tasks.push(
|
||||
saveAirBill({
|
||||
billName: billName1,
|
||||
regionLevel: "place",
|
||||
ambientAirList: billData1,
|
||||
importYearMonth: this.time.format("YYYY-MM"),
|
||||
reportTime:this.time.valueOf()
|
||||
})
|
||||
);
|
||||
}
|
||||
if (billData2.length > 0) {
|
||||
tasks.push(
|
||||
saveAirBill({
|
||||
billName: billName2,
|
||||
regionLevel: "city",
|
||||
ambientAirList: billData2,
|
||||
importYearMonth: this.time.format("YYYY-MM"),
|
||||
reportTime:this.time.valueOf()
|
||||
})
|
||||
);
|
||||
}
|
||||
if (billData3.length > 0) {
|
||||
tasks.push(
|
||||
saveAirBill({
|
||||
billName: billName3,
|
||||
regionLevel: "county",
|
||||
ambientAirList: billData3,
|
||||
importYearMonth: this.time.format("YYYY-MM"),
|
||||
reportTime:this.time.valueOf()
|
||||
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// 上传到服务器
|
||||
|
||||
Promise.all(tasks)
|
||||
.then(() => {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData1.length + billData2.length + billData3.length}条数据`,
|
||||
});
|
||||
this.$refs.air && this.$refs.air.reload();
|
||||
})
|
||||
.catch(() => {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
});
|
||||
} catch (error) {
|
||||
hide();
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: error.message,
|
||||
});
|
||||
}
|
||||
// console.log(billData);
|
||||
};
|
||||
reader.readAsArrayBuffer(file);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
</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