导入跳转

This commit is contained in:
weicw
2021-10-24 17:00:41 +08:00
parent 2a59762ef5
commit e3b8cafdac
45 changed files with 2856 additions and 2972 deletions

View File

@@ -11,7 +11,7 @@ const tableColumns = [
{title: "钠离子",dataIndex: "na",sorter: true,},
{title: "铵根离子",dataIndex: "ammoniumRadical",sorter: true,},
{title: "钾离子",dataIndex: "k",sorter: true,},
{title: "镁离子",dataIndex: "ng",sorter: true,},
{title: "镁离子",dataIndex: "mg",sorter: true,},
{title: "钙离子",dataIndex: "ca",sorter: true,},
{title: "备注",dataIndex: "remark",sorter: true,},
];

View File

@@ -16,6 +16,7 @@ export default {
const row = {
city: "南宁市",
place: dict.find(p=>p.placeCode = item[0].split("~")[0]).place,
placeType:dict.find(p=>p.placeCode = item[0].split("~")[0]).attribute,
code: item[0],
precipitationType:item[10],
precipitation:item[11],

View File

@@ -1,388 +1,391 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form
:model="where"
: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-select v-model:value="where.regionLevel" allowClear showSearch>
<a-select-option
v-for="(item) in regionLevelOptions"
: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.place" allowClear showSearch>
<a-select-option
v-for="(item) in palceOptions"
: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.area" allowClear showSearch>
<a-select-option
v-for="(item) in areaOptions"
: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 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-button @click="exportFile">导出Excel</a-button>
</a-space>
</a-form-item>
</a-col>
</a-row>
</a-form>
<!-- 表格 -->
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="acidRainId"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
<template #Address="{ record }">
{{record.area?record.area:record.county?record.county:record.city}}
</template>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form
:model="where"
: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-select v-model:value="where.regionLevel" allowClear showSearch>
<a-select-option
v-for="(item) in regionLevelOptions"
: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.place" allowClear showSearch>
<a-select-option
v-for="(item) in palceOptions"
: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.area" allowClear showSearch>
<a-select-option
v-for="(item) in areaOptions"
: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 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-button @click="exportFile">导出Excel</a-button>
</a-space>
</a-form-item>
</a-col>
</a-row>
</a-form>
<!-- 表格 -->
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="acidRainId"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
<template #Address="{ record }">
{{ record.area ? record.area : record.county ? record.county : record.city }}
</template>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import { pageAcidRainUrl, getColumnOptions } from "@/api/ecology/acid";
import {pageAcidRainUrl, getColumnOptions} from "@/api/ecology/acid";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
// import utils from "./utils";
export default {
name: "StatisticSoundZoneBase",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: pageAcidRainUrl,
selection: [],
// 表格列配置
columns: [
{
title: "采样开始时间",
dataIndex: "monitorStartTime",
sorter: true,
customRender: ({text})=> moment(text,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "采样结束时间",
dataIndex: "monitorEndTime",
sorter: true,
customRender: ({text})=> moment(text,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "行政代码",
dataIndex: "regionCode",
sorter: true,
},
{
title: "市(县,区)",
slots: {customRender: "Address"},
},
{
title: "采样点",
dataIndex: "place",
sorter: true,
},
{
title: "点位类型",
dataIndex: "placeType",
sorter: true,
},
{
title: "降水类型",
dataIndex: "precipitationType",
sorter: true,
},
{
title: "降水量",
dataIndex: "precipitation",
sorter: true,
},
{
title: "pH",
dataIndex: "ph",
sorter: true,
},
{
title: "电导率",
dataIndex: "conductivity",
sorter: true,
},
{
title: "SO42",
dataIndex: "so42",
sorter: true,
},
{
title: "NO3",
dataIndex: "no3",
sorter: true,
},
{
title: "F",
dataIndex: "f",
sorter: true,
},
{
title: "CL",
dataIndex: "cl",
sorter: true,
},
{
title: "NH4",
dataIndex: "nh4",
sorter: true,
},
{
title: "Ca2",
dataIndex: "ca2",
sorter: true,
},
{
title: "Mg2",
dataIndex: "mg2",
sorter: true,
},
{
title: "Na",
dataIndex: "na",
sorter: true,
},
{
title: "K",
dataIndex: "k",
sorter: true,
},
{
title: "系统编码",
dataIndex: "systemCode",
sorter: true,
},
name: "StatisticSoundZoneBase",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: pageAcidRainUrl,
selection: [],
// 表格列配置
columns: [
{
title: "采样开始时间",
dataIndex: "monitorStartTime",
sorter: true,
customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "采样结束时间",
dataIndex: "monitorEndTime",
sorter: true,
customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "行政代码",
dataIndex: "regionCode",
sorter: true,
customRender: () => "450100"
},
{
title: "市(县,区)",
slots: {customRender: "Address"},
},
{
title: "采样点",
dataIndex: "place",
sorter: true,
},
{
title: "点位类型",
dataIndex: "placeType",
sorter: true,
},
{
title: "降水类型",
dataIndex: "precipitationType",
sorter: true,
},
{
title: "降水量",
dataIndex: "precipitation",
sorter: true,
},
{
title: "pH",
dataIndex: "ph",
sorter: true,
},
{
title: "电导率",
dataIndex: "conductivity",
sorter: true,
},
{
title: "SO42",
dataIndex: "sulfateRadical",
sorter: true,
},
{
title: "NO3",
dataIndex: "nitrate",
sorter: true,
},
{
title: "F",
dataIndex: "fluorine",
sorter: true,
},
{
title: "CL",
dataIndex: "chlorine",
sorter: true,
},
{
title: "NH4",
dataIndex: "ammoniumRadical",
sorter: true,
},
{
title: "Ca2",
dataIndex: "ca",
sorter: true,
},
{
title: "Mg2",
dataIndex: "mg",
sorter: true,
},
{
title: "Na",
dataIndex: "na",
sorter: true,
},
{
title: "K",
dataIndex: "k",
sorter: true,
},
{
title: "系统编码",
dataIndex: "systemCode",
sorter: true,
},
{
title: "备注",
dataIndex: "remark",
sorter: true,
},
{
title: "创建人",
dataIndex: "username",
sorter: true,
}
],
palceOptions: [],
areaOptions: [],
regionLevelOptions: [],
// 表格搜索条件
where: {
checked: 1,
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.loadOptionData();
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("place").then((res) => {
this.palceOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("area").then((res) => {
this.areaOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("region_level").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
{
title: "备注",
dataIndex: "remark",
sorter: true,
},
{
title: "创建人",
dataIndex: "username",
sorter: true,
}
],
palceOptions: [],
areaOptions: [],
regionLevelOptions: [],
// 表格搜索条件
where: {
checked: 1,
},
// 表格选中数据
selectionList: [],
};
},
/* 刷新表格 */
reload() {
mounted() {
this.loadOptionData();
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("place").then((res) => {
this.palceOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("area").then((res) => {
this.areaOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("region_level").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
},
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.where = {
checked: 1,
};
this.reload();
},
exportFile() {
const columns = [
{
title: "行政代码",
dataIndex: "regionCode",
sorter: true,
},
{
title: "市(县,区)",
dataIndex: "address",
slots: {customRender: "Address"},
},
{
title: "采样点",
dataIndex: "place",
sorter: true,
},
{
title: "点位类型",
dataIndex: "placeType",
sorter: true,
},
{
title: "采样开始时间",
dataIndex: "monitorStartTime",
customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "采样结束时间",
dataIndex: "monitorEndTime",
customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "降水类型",
dataIndex: "precipitationType",
sorter: true,
},
{
title: "降水量",
dataIndex: "precipitation",
sorter: true,
},
{
title: "pH",
dataIndex: "ph",
sorter: true,
},
{
title: "电导率",
dataIndex: "conductivity",
sorter: true,
},
{
title: "SO42",
dataIndex: "sulfateRadical",
sorter: true,
},
{
title: "NO3",
dataIndex: "nitrate",
sorter: true,
},
{
title: "F",
dataIndex: "fluorine",
sorter: true,
},
{
title: "CL",
dataIndex: "chlorine",
sorter: true,
},
{
title: "NH4",
dataIndex: "ammoniumRadical",
sorter: true,
},
{
title: "Ca2",
dataIndex: "ca",
sorter: true,
},
{
title: "Mg2",
dataIndex: "mg",
sorter: true,
},
{
title: "Na",
dataIndex: "na",
sorter: true,
},
{
title: "K",
dataIndex: "k",
sorter: true,
},
{
title: "系统编码",
dataIndex: "systemCode",
sorter: true,
},
];
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => {
if (item.dataIndex == "address") {
return d.area ? d.area : d.county ? d.county : d.city
}
return d[item.dataIndex];
});
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
},
/* 重置搜索 */
reset() {
this.where = {
checked: 1,
};
this.reload();
},
exportFile() {
const columns = [
{
title: "采样开始时间",
dataIndex: "monitorStartTime",
sorter: true,
customRender: ({text})=> moment(text,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "采样结束时间",
dataIndex: "monitorEndTime",
sorter: true,
customRender: ({text})=> moment(text,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "行政代码",
dataIndex: "regionCode",
sorter: true,
},
{
title: "市(县,区)",
dataIndex: "address",
slots: {customRender: "Address"},
},
{
title: "采样点",
dataIndex: "place",
sorter: true,
},
{
title: "点位类型",
dataIndex: "placeType",
sorter: true,
},
{
title: "降水类型",
dataIndex: "precipitationType",
sorter: true,
},
{
title: "降水量",
dataIndex: "precipitation",
sorter: true,
},
{
title: "pH",
dataIndex: "ph",
sorter: true,
},
{
title: "电导率",
dataIndex: "conductivity",
sorter: true,
},
{
title: "SO42",
dataIndex: "so42",
sorter: true,
},
{
title: "NO3",
dataIndex: "no3",
sorter: true,
},
{
title: "F",
dataIndex: "f",
sorter: true,
},
{
title: "CL",
dataIndex: "cl",
sorter: true,
},
{
title: "NH4",
dataIndex: "nh4",
sorter: true,
},
{
title: "Ca2",
dataIndex: "ca2",
sorter: true,
},
{
title: "Mg2",
dataIndex: "mg2",
sorter: true,
},
{
title: "Na",
dataIndex: "na",
sorter: true,
},
{
title: "K",
dataIndex: "k",
sorter: true,
},
{
title: "系统编码",
dataIndex: "systemCode",
sorter: true,
},
];
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => {
if(item.dataIndex == "address"){
return d.area?d.area:d.county?d.county:d.city
}
return d[item.dataIndex];
});
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
},
};
</script>

View File

@@ -2,40 +2,18 @@
<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-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 format="YYYY-MM" :mode="mode" @panelChange="handlePanelChange" @change="handleChange" v-model:value="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 :model="where" layout="inline">
<a-form-item label="起始日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeEnd"></a-date-picker>
</a-form-item>
<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-form>
<!-- 表格 -->
<ele-pro-table
@@ -63,7 +41,6 @@
import _ from "lodash";
import XLSX from "xlsx";
import {statisticCity, getColumnOptions} from "@/api/ecology/acid";
import {Modal} from "ant-design-vue";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
@@ -72,9 +49,10 @@ export default {
name: "StatisticAcidCity",
components: {},
data() {
const year = new Date().getFullYear();
return {
data: [],
mode:['month', 'month'],
mode: ['month', 'month'],
locale,
bill: {},
// 表格数据接口
@@ -97,14 +75,20 @@ export default {
{title: "降水pH值无量纲", dataIndex: "precipitationPh", align: "center"},
],
regionLevelOptions: [],
time: undefined,
time: [],
// 表格搜索条件
where: {},
where: {
timeStart: moment(`${year}-01-01 00:00:00`).format("YYYY-MM-DD 00:00:00"),
timeEnd: moment().format("YYYY-MM-DD 00:00:00")
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
const year = new Date().getFullYear();
this.time[0] = moment(`${year}-01-01 00:00:00`);
this.time[1] = moment(Date.now())
this.loadOptionData();
this.reload();
},
@@ -122,10 +106,10 @@ export default {
}
},
handleChange(val){
handleChange(val) {
this.time = val;
},
handlePanelChange(val,mode){
handlePanelChange(val, mode) {
this.time = val;
this.mode = [
mode[0] === 'date' ? 'month' : mode[0],
@@ -146,20 +130,8 @@ export default {
/* 刷新表格 */
reload() {
const where = _.cloneDeep(this.where);
const year = new Date().getFullYear();
if (!this.time) {
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()) {
Modal.error({
title: "查询失败",
content: "开始时间与结束时间年份不一致",
})
return;
}
where.timeStart = this.time[0].format("YYYY-MM-01 00:00:00");
where.timeEnd = this.time[1].format("YYYY-MM-01 00:00:00");
if(!where.timeStart || !where.timeEnd){
return;
}
this.$refs.table.reload({
where
@@ -199,7 +171,7 @@ export default {
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
sheet['!merges'] = merges;
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日"));
},
},

View File

@@ -0,0 +1,18 @@
const tableColumns = [
{title: "编号",dataIndex: "code",sorter: true,},
{title: "降水类型",dataIndex: "precipitationType",sorter: true,},
{title: "降雨量(mm)",dataIndex: "precipitation",sorter: true,},
{title: "pH值无量纲",dataIndex: "ph",sorter: true,},
{title: "电导率(mS/m)",dataIndex: "conductivity",sorter: true,},
{title: "氟离子",dataIndex: "fluorine",sorter: true,},
{title: "氯离子",dataIndex: "chlorine",sorter: true,},
{title: "硫酸根离子",dataIndex: "sulfateRadical",sorter: true,},
{title: "硝酸根离子",dataIndex: "nitrate",sorter: true,},
{title: "钠离子",dataIndex: "na",sorter: true,},
{title: "铵根离子",dataIndex: "ammoniumRadical",sorter: true,},
{title: "钾离子",dataIndex: "k",sorter: true,},
{title: "镁离子",dataIndex: "mg",sorter: true,},
{title: "钙离子",dataIndex: "ca",sorter: true,},
{title: "备注",dataIndex: "remark",sorter: true,},
];
export {tableColumns}

View File

@@ -2,40 +2,18 @@
<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-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 format="YYYY-MM" :mode="mode" @panelChange="handlePanelChange" @change="handleChange" v-model:value="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 :model="where" layout="inline">
<a-form-item label="起始日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeEnd"></a-date-picker>
</a-form-item>
<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-form>
<!-- 表格 -->
<ele-pro-table
@@ -63,7 +41,6 @@
import _ from "lodash";
import XLSX from "xlsx";
import {statisticCounty, getColumnOptions} from "@/api/ecology/acid";
import { Modal } from "ant-design-vue";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
@@ -72,6 +49,7 @@ export default {
name: "StatisticAcidCounty",
components: {},
data() {
const year = new Date().getFullYear();
return {
data: [],
locale,
@@ -97,15 +75,20 @@ export default {
{title: "降水pH值无量纲", dataIndex: "precipitationPh", align: "center"},
],
regionLevelOptions: [],
time: undefined,
time: [],
// 表格搜索条件
where: {
timeStart: moment(`${year}-01-01 00:00:00`).format("YYYY-MM-DD 00:00:00"),
timeEnd: moment().format("YYYY-MM-DD 00:00:00")
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
const year = new Date().getFullYear();
this.time[0] = moment(`${year}-01-01 00:00:00`);
this.time[1] = moment(Date.now())
this.loadOptionData();
this.reload();
},
@@ -147,21 +130,7 @@ export default {
/* 刷新表格 */
reload() {
const where = _.cloneDeep(this.where);
const year = new Date().getFullYear();
if (!this.time) {
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()){
Modal.error({
title: "查询失败",
content: "开始时间与结束时间年份不一致",
})
return;
}
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
});
@@ -201,7 +170,7 @@ export default {
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
sheet['!merges'] = merges;
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日"));
},
},

View File

@@ -2,40 +2,18 @@
<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-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-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 :model="where" layout="inline">
<a-form-item label="起始日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeEnd"></a-date-picker>
</a-form-item>
<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-form>
<!-- 表格 -->
<ele-pro-table
@@ -62,7 +40,6 @@
import _ from "lodash";
import XLSX from "xlsx";
import {statisticIon, getColumnOptions} from "@/api/ecology/acid";
import { Modal } from "ant-design-vue";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
@@ -71,6 +48,7 @@ export default {
name: "StatisticAcidion",
components: {},
data() {
const year = new Date().getFullYear();
return {
data: [],
locale,
@@ -101,15 +79,20 @@ export default {
{title: "阴阳离子比例", dataIndex: "anionCationRatio",align:"center"},
],
regionLevelOptions: [],
time: undefined,
time: [],
// 表格搜索条件
where: {
timeStart: moment(`${year}-01-01 00:00:00`).format("YYYY-MM-DD 00:00:00"),
timeEnd: moment().format("YYYY-MM-DD 00:00:00")
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
const year = new Date().getFullYear();
this.time[0] = moment(`${year}-01-01 00:00:00`);
this.time[1] = moment(Date.now())
this.loadOptionData();
this.reload();
},
@@ -128,21 +111,7 @@ export default {
/* 刷新表格 */
reload() {
const where = _.cloneDeep(this.where);
const year = new Date().getFullYear();
if (!this.time) {
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()){
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");
}
this.$refs.table.reload({
where
});
@@ -182,7 +151,7 @@ export default {
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
sheet['!merges'] = merges;
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日"));
},
},

View File

@@ -7,6 +7,9 @@
<!-- 搜索表单 -->
<a-form layout="inline" :model="where" :labelCol="{ offset: 1}">
<!-- <a-form-item label="年份:">-->
<!-- <a-input-number v-model:value="where.year" :min="1970" :max="2050"/>-->
<!-- </a-form-item>-->
<a-form-item label="区域等级:">
<a-select v-model:value="where.regionLevel" allowClear placeholder="未选择">
<a-select-option :value="'city'"></a-select-option>
@@ -25,9 +28,6 @@
<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 class="ele-text-right" :wrapper-col="{span: 24}">
<a-space>
@@ -57,18 +57,9 @@
</div>
</div>
</template>
<template #reportTime="{ text, record }">
<template #reportTime="{ text }">
<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>
{{ $util.toDateString(text, 'yyyy') || ' ' }}
</div>
</template>
<template #checked="{text}">
@@ -154,12 +145,12 @@ export default {
title: '区域等级',
dataIndex: 'regionLevel',
sorter: true,
customRender:({text})=>{
if(text == "place"){
customRender: ({text}) => {
if (text == "place") {
return "站点"
}else if(text == "city"){
} else if (text == "city") {
return "市"
}else if(text == "county"){
} else if (text == "county") {
return "县"
}
}
@@ -176,7 +167,7 @@ export default {
// sorter: true
// },
{
title: '上报时间',
title: '年份',
dataIndex: 'reportTime',
sorter: true,
slots: {
@@ -228,7 +219,10 @@ export default {
}
],
// 表格搜索条件
where: {},
where: {
sort: "createTime",
order: "desc"
},
reportTimeScope: [],
// 表格选中数据
selectionList: [],

View File

@@ -356,11 +356,11 @@ export default {
},
],
// 表格搜索条件
airBillId: billId,
ambientAirBillId: billId,
palceOptions: [],
areaOptions: [],
where: {
airBillId: billId,
ambientAirBillId: billId,
},
// 表格选中数据
selectionList: [],
@@ -412,7 +412,7 @@ export default {
/* 重置搜索 */
reset() {
this.where = {
airBillId: this.airBillId,
ambientAirBillId: this.ambientAirBillId,
};
this.reload();
},
@@ -467,7 +467,7 @@ export default {
hide();
});
} else {
form.airBillId = this.airBillId;
form.ambientAirBillId = this.ambientAirBillId;
saveAir(form)
.then((res) => {
if (res.data.code == 0) {

View File

@@ -3,14 +3,24 @@
<a-card style="width: 100%" :bordered="false">
<template #title>
<a-space>
<a-month-picker v-model:value="time"/>
<a-input-number v-model:value="year" :min="1970" :max="2050"/>
<a-select
ref="select"
v-model:value="regionLevel"
style="width: 120px"
>
<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-upload
:before-upload="importFileCity"
:showUploadList="false"
accept=".xls,.xlsx,.csv"
>
<a-button>数据导入</a-button>
<a-button type="primary">数据导入</a-button>
</a-upload>
<a-button>模板下载</a-button>
</a-space>
</template>
@@ -30,6 +40,7 @@ import {Modal} from "ant-design-vue";
import AirBill from "./air-bill.vue";
import {saveAirBill} from "@/api/ecology/air";
import moment from "moment";
export default {
name: "AirCollectIndex",
components: {
@@ -38,7 +49,9 @@ export default {
data() {
return {
activeKey: "",
time: moment()
regionLevel: "city",
time: moment(),
year: new Date().getFullYear()
};
},
methods: {
@@ -54,44 +67,36 @@ export default {
type: "array",
cellDates: true
});
//0.昼间数据 1.夜间数据 2.其他信息
let sheetNames = workbook.SheetNames;
// 解析成二维数组
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
header: 1,
defval: ""
});
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] != "城市"
console.log(aoa.length)
const airList = aoa.filter((item) => {
if (this.regionLevel == "city") {
return item.length >= 10&& item[0]&& item[0] != "城市";
} else if (this.regionLevel == "county") {
return item.length >= 10&& item[0] && item[0] != "测点名称";
} else {
return item.length >= 10&& item[0] && item[0] != "城市"
}
}
);
const airList2 = aoa2.filter(
(item) => item.length >= 10 && item[0] != "城市"
);
const airList3 = aoa3.filter(
(item) => item.length >= 10 && item[0] != "测点名称"
);
console.log(airList.length)
const billName = file.name;
let billData = undefined;
if (this.regionLevel == "city") {
billData = utils.toCityObjData(airList)
} else if (this.regionLevel == "county") {
billData = utils.toCountyObjData(airList)
} else {
billData = utils.toPlaceObjData(airList)
}
console.log(billData.length)
// 解析成对象数组
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)
) {
if (!billData || billData.length == 0) {
hide()
Modal.error({
title: "导入失败",
@@ -99,53 +104,29 @@ export default {
});
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(() => {
saveAirBill({
billName: billName,
regionLevel: this.regionLevel,
ambientAirList: billData,
reportTime: new Date(`${this.year}-01-01 00:00:00`).getTime()
}).then((res) => {
if (res.data.code == 0) {
Modal.success({
title: "导入成功",
content: `成功导入${billData1.length + billData2.length + billData3.length}条数据`,
content: `成功导入${billData.length}条数据`,
});
this.$refs.air && this.$refs.air.reload();
})
this.$router.replace({
path: "/atmosphere/air/collect/air/" + res.data.data.ambientAirBillId
})
} else {
Modal.error({
title: "导入失败",
content: "数据上传出错",
});
}
})
.catch(() => {
Modal.error({
title: "导入失败",
@@ -154,7 +135,9 @@ export default {
})
.finally(() => {
hide();
});
})
// 上传到服务器
} catch (error) {
hide();
Modal.error({

View File

@@ -2,10 +2,9 @@ import moment from "moment";
export default {
toCityObjData(excelData) {
const result = excelData.map(item => {
console.log(item[1]);
const row = {
city: item[0],
monitorTime: moment(item[1]).format("YYYY/MM/DD HH:mm:ss"),
monitorTime: moment(item[1]).valueOf(),
so2: Number(item[2]) || null,
no2: Number(item[3]) || null,
pm10: Number(item[4]) || null,
@@ -23,14 +22,16 @@ export default {
})
return result;
},
toAreaObjData(excelData) {
toCountyObjData(excelData) {
const result = excelData.map(item => {
const place = item[0];
const county = place.substr(0,place.indexOf("县") + 1);
const area = place.substr(0,place.indexOf("区") + 1);
const row = {
place,
county,
monitorTime: moment(item[1]).format("YYYY/MM/DD HH:mm:ss"),
area,
monitorTime: moment(item[1]).valueOf(),
airQualityStatus: item[2],
aqiLevel: item[3],
aqi: Number(item[4]) || null,
@@ -38,7 +39,7 @@ export default {
so2: Number(item[6]) || null,
no2: Number(item[7]) || null,
pm10: Number(item[8]) || null,
c0: Number(item[9]) || null,
co: Number(item[9]) || null,
o3: Number(item[10]) || null,
pm25: Number(item[11]) || null,
remark: item[12]
@@ -47,7 +48,7 @@ export default {
})
return result;
},
toStationObjData(excelData) {
toPlaceObjData(excelData) {
const result = excelData.map(item => {
const place = item[1];
// const county = place.substr(0,place.indexOf("县"))
@@ -55,7 +56,7 @@ export default {
city: item[0],
// county,
place,
monitorTime: moment(item[2]).format("YYYY/MM/DD HH:mm:ss"),
monitorTime: moment(item[2]).valueOf(),
so2: Number(item[3]) || null,
no2: Number(item[5]) || null,
pm10: Number(item[7]) || null,

View File

@@ -1,6 +1,52 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-form
:model="where"
: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.year" allow-clear show-search>
<a-select-option
v-for="(item) in yearOptions"
: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-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-space>
</a-col>
</a-row>
<a-row>
</a-row>
</a-form>
<a-modal
v-model:visible="showNYear"
:title="'批量复制'"
:confirm-loading="loading"
:body-style="{ paddingBottom: '8px' }"
@ok="copyBatch"
>
<a-form
ref="form"
:model="form"
:rules="rules"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
: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-form-item>
</a-form>
</a-modal>
<a-modal
v-model:visible="showEdit"
:title="form.airAqiRelateInfoDictId !== undefined ? '修改' : '添加'"
@@ -16,6 +62,9 @@
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
: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-form-item>
<a-form-item label="空气质量指数类别" name="iaqiCategory">
<a-input v-model:value="form.iaqiCategory" placeholder="请输入指标名称" allow-clear />
</a-form-item>
@@ -50,10 +99,24 @@
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
<template #toolbar>
<a-space>
<a-button @click="openEdit" type="primary">新增</a-button>
<a-dropdown>
<template #overlay>
<a-menu @click="setCYear">
<a-menu-item v-for="item in yearOptions" :key="item.value">
{{ item.label }}
</a-menu-item>
</a-menu>
</template>
<a-button>
批量复制
<DownOutlined/>
</a-button>
</a-dropdown>
<a-popconfirm
:disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`"
@@ -69,6 +132,7 @@
>删除
</a-button>
</a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</a-space>
</template>
<template #action="{ record }">
@@ -105,12 +169,16 @@ import {
saveAqiRelate,
updateAqiRelate,
removeAqiRelate,
removeBatchAqiRelate
removeBatchAqiRelate,
copyBatchPlace,
getColumnOptions
} from "@/api/ecology/atmosphere/air-api-relate";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
// import moment from "moment";
export default {
name: "AirAqiRelate",
components: {},
components: {DownOutlined},
data() {
return {
data: [],
@@ -119,10 +187,10 @@ export default {
selection: [],
// 表格列配置
columns: [
// {
// title: "年份",
// dataIndex: "year",
// },
{
title: "年份",
dataIndex: "year",
},
{
title: "空气质量指数类别",
dataIndex: "iaqiCategory",
@@ -184,9 +252,14 @@ export default {
// evaluate: [{required: true,message: '请输入评价',},],
sortNumber: [{required: true,message: '请输入排序',},],
},
yearOptions: [],
showNYear:false,
cYear: undefined,
nYear:undefined,
};
},
mounted() {
this.getOptions();
},
methods: {
minLeqChange(e){
@@ -290,8 +363,56 @@ export default {
}).finally(() => {
hide();
})
},
getOptions(){
getColumnOptions("year").then(res => {
console.log(res)
if (res.data.code == 0) {
this.yearOptions = res.data.data.map(item => {
return {
label: item,
value: item
}
})
}
})
},
setCYear(e){
this.cYear = e.key;
this.showNYear = true;
},
copyBatch(){
const hide = this.$message.loading('请求中..', 0);
copyBatchPlace({cyear:Number(this.cYear),nyear:this.nYear}).then(res=>{
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
this.getOptions();
} else {
this.$message.error(res.data.msg);
}
this.showNYear = false;
}).catch(e => {
this.$message.error(e.message);
}).finally(() => {
hide();
})
},
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) => {
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>

View File

@@ -1,6 +1,52 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-form
:model="where"
: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.year" allow-clear show-search>
<a-select-option
v-for="(item) in yearOptions"
: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-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-space>
</a-col>
</a-row>
<a-row>
</a-row>
</a-form>
<a-modal
v-model:visible="showNYear"
:title="'批量复制'"
:confirm-loading="loading"
:body-style="{ paddingBottom: '8px' }"
@ok="copyBatch"
>
<a-form
ref="form"
:model="form"
:rules="rules"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
: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-form-item>
</a-form>
</a-modal>
<a-modal
v-model:visible="showEdit"
:title="form.id !== undefined ? '修改' : '添加'"
@@ -16,6 +62,9 @@
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
: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-form-item>
<a-form-item label="指标名称" name="indicatorName">
<a-input v-model:value="form.indicatorName" placeholder="请输入指标名称" allow-clear />
</a-form-item>
@@ -54,10 +103,24 @@
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
<template #toolbar>
<a-space>
<a-button @click="openEdit" type="primary">新增</a-button>
<a-dropdown>
<template #overlay>
<a-menu @click="setCYear">
<a-menu-item v-for="item in yearOptions" :key="item.value">
{{ item.label }}
</a-menu-item>
</a-menu>
</template>
<a-button>
批量复制
<DownOutlined/>
</a-button>
</a-dropdown>
<a-popconfirm
:disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`"
@@ -73,6 +136,7 @@
>删除
</a-button>
</a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</a-space>
</template>
<template #action="{ record }">
@@ -109,12 +173,16 @@ import {
saveStandard,
updateStandard,
removeStandard,
removeBatchStandard
removeBatchStandard,
copyBatchPlace,
getColumnOptions
} from "@/api/ecology/atmosphere/air-evaluation-standard";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
// import moment from "moment";
export default {
name: "ZoneNoiseStandard",
components: {},
name: "AirEvaluationStandard",
components: {DownOutlined},
data() {
return {
data: [],
@@ -123,6 +191,7 @@ export default {
selection: [],
// 表格列配置
columns: [
{title: "年份", dataIndex: "year",sorter: true,},
{
title: "年份",
dataIndex: "year",
@@ -177,15 +246,21 @@ export default {
loading: false,
rules: {
timeSlot:[{required: true,message: '请选择时段'}],
year: [{required: true, message: '请输入年份'}],
// minLeq: [{required: true,message: '请输入最小值',},],
// maxLeq: [{required: true,message: '请输入最大值',},],
level: [{required: true,message: '请输入等级',},],
// evaluate: [{required: true,message: '请输入评价',},],
sortNumber: [{required: true,message: '请输入排序',},],
},
yearOptions: [],
showNYear:false,
cYear: undefined,
nYear:undefined,
};
},
mounted() {
this.getOptions();
},
methods: {
minLeqChange(e){
@@ -289,8 +364,56 @@ export default {
}).finally(() => {
hide();
})
},
getOptions(){
getColumnOptions("year").then(res => {
console.log(res)
if (res.data.code == 0) {
this.yearOptions = res.data.data.map(item => {
return {
label: item,
value: item
}
})
}
})
},
setCYear(e){
this.cYear = e.key;
this.showNYear = true;
},
copyBatch(){
const hide = this.$message.loading('请求中..', 0);
copyBatchPlace({cyear:Number(this.cYear),nyear:this.nYear}).then(res=>{
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
this.getOptions();
} else {
this.$message.error(res.data.msg);
}
this.showNYear = false;
}).catch(e => {
this.$message.error(e.message);
}).finally(() => {
hide();
})
},
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) => {
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>

View File

@@ -1,6 +1,52 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-form
:model="where"
: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.year" allow-clear show-search>
<a-select-option
v-for="(item) in yearOptions"
: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-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-space>
</a-col>
</a-row>
<a-row>
</a-row>
</a-form>
<a-modal
v-model:visible="showNYear"
:title="'批量复制'"
:confirm-loading="loading"
:body-style="{ paddingBottom: '8px' }"
@ok="copyBatch"
>
<a-form
ref="form"
:model="form"
:rules="rules"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
: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-form-item>
</a-form>
</a-modal>
<a-modal
v-model:visible="showEdit"
:title="form.id !== undefined ? '修改' : '添加'"
@@ -16,6 +62,7 @@
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<template v-for="item in columns" :key="item.dataIndex">
<a-form-item v-if="item.dataIndex" :label="item.title" :name="item.dataIndex">
<a-input v-model:value="form[item.dataIndex]" :placeholder="`请输入${item.title}`" allow-clear/>
@@ -35,10 +82,24 @@
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
<template #toolbar>
<a-space>
<a-button @click="openEdit" type="primary">新增</a-button>
<a-dropdown>
<template #overlay>
<a-menu @click="setCYear">
<a-menu-item v-for="item in yearOptions" :key="item.value">
{{ item.label }}
</a-menu-item>
</a-menu>
</template>
<a-button>
批量复制
<DownOutlined/>
</a-button>
</a-dropdown>
<a-popconfirm
:disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`"
@@ -54,6 +115,7 @@
>删除
</a-button>
</a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</a-space>
</template>
<template #action="{ record }">
@@ -92,12 +154,16 @@ import {
saveIndicatorIaqi,
updateIndicatorIaqi,
removeIndicatorIaqi,
removeBatchIndicatorIaqi
removeBatchIndicatorIaqi,
copyBatchPlace,
getColumnOptions
} from "@/api/ecology/atmosphere/air-indicator-iaqi";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
// import moment from "moment";
export default {
name: "AirIndicatorIaqi",
components: {},
components: {DownOutlined},
data() {
return {
data: [],
@@ -110,6 +176,7 @@ export default {
// title: "年份",
// dataIndex: "year",
// },
{title: "年份", dataIndex: "year",sorter: true,},
{title: "空气质量分指数",dataIndex: "iaqi",},
{title: "so2 24小时平均", dataIndex: "so2TwentyFourHour",},
{title: "so2 1小时平均",dataIndex: "so2OneHour",},
@@ -145,6 +212,7 @@ export default {
form: {},
loading: false,
rules: {
year: [{required: true, message: '请输入年份'}],
timeSlot: [{required: true, message: '请选择时段'}],
// minLeq: [{required: true,message: '请输入最小值',},],
// maxLeq: [{required: true,message: '请输入最大值',},],
@@ -152,9 +220,14 @@ export default {
// evaluate: [{required: true,message: '请输入评价',},],
sortNumber: [{required: true, message: '请输入排序',},],
},
yearOptions: [],
showNYear:false,
cYear: undefined,
nYear:undefined,
};
},
mounted() {
this.getOptions();
},
methods: {
minLeqChange(e) {
@@ -258,8 +331,56 @@ export default {
}).finally(() => {
hide();
})
},
getOptions(){
getColumnOptions("year").then(res => {
console.log(res)
if (res.data.code == 0) {
this.yearOptions = res.data.data.map(item => {
return {
label: item,
value: item
}
})
}
})
},
setCYear(e){
this.cYear = e.key;
this.showNYear = true;
},
copyBatch(){
const hide = this.$message.loading('请求中..', 0);
copyBatchPlace({cyear:Number(this.cYear),nyear:this.nYear}).then(res=>{
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
this.getOptions();
} else {
this.$message.error(res.data.msg);
}
this.showNYear = false;
}).catch(e => {
this.$message.error(e.message);
}).finally(() => {
hide();
})
},
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) => {
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>

View File

@@ -1,234 +0,0 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-modal
v-model:visible="showEdit"
:title="form.airBasicInfoDictId !== undefined ? '修改' : '添加'"
:confirm-loading="loading"
:width="800"
:body-style="{ paddingBottom: '8px' }"
@ok="save"
>
<a-form
ref="form"
:model="form"
:rules="rules"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-form-item label="年份" name="place">
<a-input v-model:value="form.place" placeholder="请输入点位名称" allow-clear />
</a-form-item>
</a-form>
</a-modal>
<!-- 表格 -->
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="airBasicInfoDictId"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
>
<template #toolbar>
<a-space>
<a-button @click="openEdit" type="primary">新增</a-button>
<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>
</a-space>
</template>
<template #action="{ record }">
<a-space>
<a-button
@click="openEdit(record)"
type="primary"
shape="round"
size="small"
>修改</a-button
>
<a-popconfirm
:title="`确认删除这条数据吗?`"
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>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
// import _ from "lodash";
import {
listAllUrl,
savePlace,
updatePlace,
removePlace,
removeBatchPlace
} from "@/api/ecology/atmosphere/air-plcae";
// import moment from "moment";
export default {
name: "AirPlace",
components: {},
data() {
return {
data: [],
// 表格数据接口
url: listAllUrl,
selection: [],
// 表格列配置
columns: [
{
title: "年份",
dataIndex: "year",
sorter: true,
},
{
title: "操作",
key: "action",
width: 150,
align: "center",
fixed: "right",
slots: {
customRender: "action",
},
},
],
// 表格搜索条件
where: {},
// 表格选中数据
selectionList: [],
// 是否显示编辑弹窗
showEdit: false,
// 表单数据
form: {},
loading: false,
};
},
mounted() {
},
methods: {
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.where = {};
this.reload();
},
/* 打开编辑弹窗 */
openEdit(row) {
// cloneRecord.mi
this.form = Object.assign({}, row);
this.showEdit = true;
this.$nextTick(() => {
this.$refs.form.clearValidate(); // 清除表单验证信息
});
},
async save() {
await this.$refs.form.validate();
const hide = this.$message.loading('请求中..', 0);
const form = this.form;
if (form.airBasicInfoDictId) {
updatePlace(form)
.then((res) => {
if (res.data.code == 0) {
this.showEdit = false;
this.$message.success(res.data.msg);
this.reload();
} else {
this.$message.error(res.data.msg);
}
})
.catch((error) => {
this.$message.error(error.message);
})
.finally(() => {
hide();
});
} else {
savePlace(form)
.then((res) => {
if (res.data.code == 0) {
this.showEdit = false;
this.$message.success(res.data.msg);
this.reload();
} else {
this.$message.error(res.data.msg);
}
})
.catch((error) => {
this.$message.error(error.message);
})
.finally(() => {
hide();
});
}
},
/* 删除单个 */
remove(row) {
const hide = this.$message.loading('请求中..', 0);
removePlace(row.airBasicInfoDictId).then((res) => {
hide();
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
} else {
this.$message.error(res.data.msg);
}
}).catch(e => {
hide();
this.$message.error(e.message);
})
},
/* 批量删除 */
removeBatch() {
const hide = this.$message.loading('请求中..', 0);
const ids = this.selectionList.map((item) => item.airBasicInfoDictId);
removeBatchPlace(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.message);
}).finally(() => {
hide();
})
}
},
};
</script>
<style scoped lang="less">
</style>

View File

@@ -1,6 +1,52 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-form
:model="where"
: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.year" allow-clear show-search>
<a-select-option
v-for="(item) in yearOptions"
: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-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-space>
</a-col>
</a-row>
<a-row>
</a-row>
</a-form>
<a-modal
v-model:visible="showNYear"
:title="'批量复制'"
:confirm-loading="loading"
:body-style="{ paddingBottom: '8px' }"
@ok="copyBatch"
>
<a-form
ref="form"
:model="form"
:rules="rules"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
: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-form-item>
</a-form>
</a-modal>
<a-modal
v-model:visible="showEdit"
:title="form.airBasicInfoDictId !== undefined ? '修改' : '添加'"
@@ -16,6 +62,9 @@
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
: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-form-item>
<a-form-item label="点位名称" name="place">
<a-input v-model:value="form.place" placeholder="请输入点位名称" allow-clear />
</a-form-item>
@@ -49,10 +98,24 @@
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
<template #toolbar>
<a-space>
<a-button @click="openEdit" type="primary">新增</a-button>
<a-dropdown>
<template #overlay>
<a-menu @click="setCYear">
<a-menu-item v-for="item in yearOptions" :key="item.value">
{{ item.label }}
</a-menu-item>
</a-menu>
</template>
<a-button>
批量复制
<DownOutlined/>
</a-button>
</a-dropdown>
<a-popconfirm
:disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`"
@@ -68,6 +131,7 @@
>删除
</a-button>
</a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</a-space>
</template>
<template #action="{ record }">
@@ -104,12 +168,16 @@ import {
savePlace,
updatePlace,
removePlace,
removeBatchPlace
removeBatchPlace,
copyBatchPlace,
getColumnOptions
} from "@/api/ecology/atmosphere/air-plcae";
import XLSX from "xlsx";
import {DownOutlined} from '@ant-design/icons-vue';
// import moment from "moment";
export default {
name: "AirPlace",
components: {},
components: {DownOutlined},
data() {
return {
data: [],
@@ -118,6 +186,7 @@ export default {
selection: [],
// 表格列配置
columns: [
{title: "年份", dataIndex: "year",sorter: true,},
{title: "点位名称",dataIndex: "place",sorter: true,},
{title: "片区名称",dataIndex: "districtName",sorter: true,},
{title: "属性",dataIndex: "attributes",sorter: true,},
@@ -157,14 +226,20 @@ export default {
form: {},
loading: false,
rules: {
year: [{required: true, message: '请输入年份'}],
place:[{required: true,message: '请输入点位名称'}],
placeCode:[{required: true,message: '请输入点位编码'}],
placeLng: [{required: true,message: '请输入测点经度',},],
placeLat: [{required: true,message: '请输入测点纬度',},],
},
yearOptions: [],
showNYear:false,
cYear: undefined,
nYear:undefined,
};
},
mounted() {
this.getOptions();
},
methods: {
/* 刷新表格 */
@@ -260,6 +335,53 @@ export default {
}).finally(() => {
hide();
})
},
getOptions(){
getColumnOptions("year").then(res => {
console.log(res)
if (res.data.code == 0) {
this.yearOptions = res.data.data.map(item => {
return {
label: item,
value: item
}
})
}
})
},
setCYear(e){
this.cYear = e.key;
this.showNYear = true;
},
copyBatch(){
const hide = this.$message.loading('请求中..', 0);
copyBatchPlace({cyear:Number(this.cYear),nyear:this.nYear}).then(res=>{
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
this.getOptions();
} else {
this.$message.error(res.data.msg);
}
this.showNYear = false;
}).catch(e => {
this.$message.error(e.message);
}).finally(() => {
hide();
})
},
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) => {
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());
}
},

View File

@@ -2,44 +2,33 @@
<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-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-form :model="where" layout="inline">
<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-form-item label="起始日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeEnd"></a-date-picker>
</a-form-item>
<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 :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="时间范围:">
<a-range-picker v-model:value="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"
:need-page="false"
@@ -71,6 +60,7 @@ export default {
name: "StatisticAirAreaBase",
components: {},
data() {
const year = new Date().getFullYear();
return {
data: [],
locale,
@@ -86,100 +76,103 @@ export default {
],
// 表格列配置
columns: [
{title: "日期", dataIndex: "monitorTime",align:"center"},
{title: "日期", dataIndex: "monitorTime", align: "center"},
{title: "SO2五象", dataIndex: "wuXiangXinQuSo2",align:"center"},
{title: "NO2五象", dataIndex: "wuXiangXinQuNo2",align:"center"},
{title: "PM10五象", dataIndex: "wuXiangXinQuPm10",align:"center"},
{title: "CO五象", dataIndex: "wuXiangXinQuCo",align:"center"},
{title: "O3五象", dataIndex: "wuXiangXinQuO3",align:"center"},
{title: "PM2.5五象", dataIndex: "wuXiangXinQuPm25",align:"center"},
{title: "AQI五象", dataIndex: "wuXiangXinQuAqi",align:"center"},
{title: "类别五象", dataIndex: "wuXiangXinQuAqiCategory",align:"center"},
{title: "SO2五象", dataIndex: "wuXiangXinQuSo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "NO2五象", dataIndex: "wuXiangXinQuNo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM10五象", dataIndex: "wuXiangXinQuPm10", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "CO五象", dataIndex: "wuXiangXinQuCo", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(1)+"":""},
{title: "O3五象", dataIndex: "wuXiangXinQuO3", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM2.5五象", dataIndex: "wuXiangXinQuPm25", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "AQI五象", dataIndex: "wuXiangXinQuAqi", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "类别五象", dataIndex: "wuXiangXinQuAqiCategory", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "SO2兴宁", dataIndex: "xingNingSo2",align:"center"},
{title: "NO2兴宁", dataIndex: "xingNingNo2",align:"center"},
{title: "PM10兴宁", dataIndex: "xingNingPm10",align:"center"},
{title: "CO兴宁", dataIndex: "xingNingCo",align:"center"},
{title: "O3_8h兴宁", dataIndex: "xingNingO3",align:"center"},
{title: "PM2.5兴宁", dataIndex: "xingNingPm25",align:"center"},
{title: "AQI兴宁", dataIndex: "xingNingAqi",align:"center"},
{title: "类别兴宁", dataIndex: "xingNingAqiCategory",align:"center"},
{title: "SO2兴宁", dataIndex: "xingNingSo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "NO2兴宁", dataIndex: "xingNingNo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM10兴宁", dataIndex: "xingNingPm10", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "CO兴宁", dataIndex: "xingNingCo", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(1)+"":""},
{title: "O3_8h兴宁", dataIndex: "xingNingO3", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM2.5兴宁", dataIndex: "xingNingPm25", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "AQI兴宁", dataIndex: "xingNingAqi", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "类别兴宁", dataIndex: "xingNingAqiCategory", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "SO2江南", dataIndex: "jiangNanSo2",align:"center"},
{title: "NO2江南", dataIndex: "jiangNanNo2",align:"center"},
{title: "PM10江南", dataIndex: "jiangNanPm10",align:"center"},
{title: "CO江南", dataIndex: "jiangNanCo",align:"center"},
{title: "O3_8h江南", dataIndex: "jiangNanO3",align:"center"},
{title: "PM2.5江南", dataIndex: "jiangNanPm25",align:"center"},
{title: "AQI江南", dataIndex: "jiangNanAqi",align:"center"},
{title: "类别江南", dataIndex: "jiangNanAqiCategory",align:"center"},
{title: "SO2江南", dataIndex: "jiangNanSo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "NO2江南", dataIndex: "jiangNanNo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM10江南", dataIndex: "jiangNanPm10", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "CO江南", dataIndex: "jiangNanCo", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(1)+"":""},
{title: "O3_8h江南", dataIndex: "jiangNanO3", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM2.5江南", dataIndex: "jiangNanPm25", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "AQI江南", dataIndex: "jiangNanAqi", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "类别江南", dataIndex: "jiangNanAqiCategory", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "SO2青秀", dataIndex: "qingXiuSo2",align:"center"},
{title: "NO2青秀", dataIndex: "qingXiuNo2",align:"center"},
{title: "PM10青秀", dataIndex: "qingXiuPm10",align:"center"},
{title: "CO青秀", dataIndex: "qingXiuCo",align:"center"},
{title: "O3_8h青秀", dataIndex: "qingXiuO3",align:"center"},
{title: "PM2.5青秀", dataIndex: "qingXiuPm25",align:"center"},
{title: "AQI青秀", dataIndex: "qingXiuAqi",align:"center"},
{title: "类别青秀", dataIndex: "qingXiuAqiCategory",align:"center"},
{title: "SO2青秀", dataIndex: "qingXiuSo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "NO2青秀", dataIndex: "qingXiuNo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM10青秀", dataIndex: "qingXiuPm10", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "CO青秀", dataIndex: "qingXiuCo", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(1)+"":""},
{title: "O3_8h青秀", dataIndex: "qingXiuO3", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM2.5青秀", dataIndex: "qingXiuPm25", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "AQI青秀", dataIndex: "qingXiuAqi", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "类别青秀", dataIndex: "qingXiuAqiCategory", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "SO2西乡塘", dataIndex: "xiXiangTangSo2",align:"center"},
{title: "NO2西乡塘", dataIndex: "xiXiangTangNo2",align:"center"},
{title: "PM10西乡塘", dataIndex: "xiXiangTangPm10",align:"center"},
{title: "CO西乡塘", dataIndex: "xiXiangTangCo",align:"center"},
{title: "O3_8h西乡塘", dataIndex: "xiXiangTangO3",align:"center"},
{title: "PM2.5西乡塘", dataIndex: "xiXiangTangPm25",align:"center"},
{title: "AQI西乡塘", dataIndex: "xiXiangTangAqi",align:"center"},
{title: "类别西乡塘", dataIndex: "xiXiangTangAqiCategory",align:"center"},
{title: "SO2西乡塘", dataIndex: "xiXiangTangSo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "NO2西乡塘", dataIndex: "xiXiangTangNo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM10西乡塘", dataIndex: "xiXiangTangPm10", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "CO西乡塘", dataIndex: "xiXiangTangCo", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(1)+"":""},
{title: "O3_8h西乡塘", dataIndex: "xiXiangTangO3", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM2.5西乡塘", dataIndex: "xiXiangTangPm25", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "AQI西乡塘", dataIndex: "xiXiangTangAqi", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "类别西乡塘", dataIndex: "xiXiangTangAqiCategory", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "SO2邕宁", dataIndex: "yongNingSo2",align:"center"},
{title: "NO2邕宁", dataIndex: "yongNingNo2",align:"center"},
{title: "PM10邕宁", dataIndex: "yongNingPm10",align:"center"},
{title: "CO邕宁", dataIndex: "yongNingCo",align:"center"},
{title: "O3_8h邕宁", dataIndex: "yongNingO3",align:"center"},
{title: "PM2.5邕宁", dataIndex: "yongNingPm25",align:"center"},
{title: "AQI邕宁", dataIndex: "yongNingAqi",align:"center"},
{title: "类别邕宁", dataIndex: "yongNingAqiCategory",align:"center"},
{title: "SO2邕宁", dataIndex: "yongNingSo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "NO2邕宁", dataIndex: "yongNingNo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM10邕宁", dataIndex: "yongNingPm10", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "CO邕宁", dataIndex: "yongNingCo", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(1)+"":""},
{title: "O3_8h邕宁", dataIndex: "yongNingO3", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM2.5邕宁", dataIndex: "yongNingPm25", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "AQI邕宁", dataIndex: "yongNingAqi", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "类别邕宁", dataIndex: "yongNingAqiCategory", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "SO2良庆", dataIndex: "liangQingSo2",align:"center"},
{title: "NO2良庆", dataIndex: "liangQingNo2",align:"center"},
{title: "PM10良庆", dataIndex: "liangQingPm10",align:"center"},
{title: "CO良庆", dataIndex: "liangQingCo",align:"center"},
{title: "O3_8h良庆", dataIndex: "liangQingO3",align:"center"},
{title: "PM2.5良庆", dataIndex: "liangQingPm25",align:"center"},
{title: "AQI良庆", dataIndex: "liangQingAqi",align:"center"},
{title: "类别良庆", dataIndex: "liangQingAqiCategory",align:"center"},
{title: "SO2良庆", dataIndex: "liangQingSo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "NO2良庆", dataIndex: "liangQingNo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM10良庆", dataIndex: "liangQingPm10", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "CO良庆", dataIndex: "liangQingCo", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(1)+"":""},
{title: "O3_8h良庆", dataIndex: "liangQingO3", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM2.5良庆", dataIndex: "liangQingPm25", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "AQI良庆", dataIndex: "liangQingAqi", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "类别良庆", dataIndex: "liangQingAqiCategory", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "SO2高新", dataIndex: "gaoXinSo2",align:"center"},
{title: "NO2高新", dataIndex: "gaoXinNo2",align:"center"},
{title: "PM10高新", dataIndex: "gaoXinPm10",align:"center"},
{title: "CO高新", dataIndex: "gaoXinCo",align:"center"},
{title: "O3_8h高新", dataIndex: "gaoXinO3",align:"center"},
{title: "PM2.5高新", dataIndex: "gaoXinPm25",align:"center"},
{title: "AQI高新", dataIndex: "gaoXinAqi",align:"center"},
{title: "类别高新", dataIndex: "gaoXinAqiCategory",align:"center"},
{title: "SO2高新", dataIndex: "gaoXinSo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "NO2高新", dataIndex: "gaoXinNo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM10高新", dataIndex: "gaoXinPm10", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "CO高新", dataIndex: "gaoXinCo", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(1)+"":""},
{title: "O3_8h高新", dataIndex: "gaoXinO3", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM2.5高新", dataIndex: "gaoXinPm25", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "AQI高新", dataIndex: "gaoXinAqi", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "类别高新", dataIndex: "gaoXinAqiCategory", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "SO2经开", dataIndex: "jingKaiSo2",align:"center"},
{title: "NO2经开", dataIndex: "jingKaiNo2",align:"center"},
{title: "PM10经开", dataIndex: "jingKaiPm10",align:"center"},
{title: "Co经开", dataIndex: "jingKaiCo",align:"center"},
{title: "O3_8h经开", dataIndex: "jingKaiO3",align:"center"},
{title: "PM2.5经开", dataIndex: "jingKaiPm25",align:"center"},
{title: "AQI经开", dataIndex: "jingKaiAqi",align:"center"},
{title: "类别经开", dataIndex: "jingKaiAqiCategory",align:"center"},
{title: "SO2经开", dataIndex: "jingKaiSo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "NO2经开", dataIndex: "jingKaiNo2", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM10经开", dataIndex: "jingKaiPm10", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "Co经开", dataIndex: "jingKaiCo", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(1)+"":""},
{title: "O3_8h经开", dataIndex: "jingKaiO3", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "PM2.5经开", dataIndex: "jingKaiPm25", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "AQI经开", dataIndex: "jingKaiAqi", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
{title: "类别经开", dataIndex: "jingKaiAqiCategory", align: "center",customRender:({text})=> typeof text == "number"?text.toFixed(0)+"":""},
],
regionLevelOptions: [],
time: undefined,
time: [],
// 表格搜索条件
where: {
regionLevel: "place",
timeStart: moment(`${year}-01-01 00:00:00`).format("YYYY-MM-DD 00:00:00"),
timeEnd: moment().format("YYYY-MM-DD 00:00:00")
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.loadOptionData();
this.reload();
},
@@ -198,21 +191,6 @@ export default {
/* 刷新表格 */
reload() {
const where = _.cloneDeep(this.where);
const year = new Date().getFullYear();
if (!this.time) {
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()){
// 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");
}
this.$refs.table.reload({
where
});
@@ -231,29 +209,35 @@ 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]);
const td = columnsTemp.map((item) => {
if(item.customRender){
return item.customRender({text:d[item.dataIndex]});
}
return d[item.dataIndex];
});
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
sheet['!merges'] = merges;
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日"));
},
},

View File

@@ -4,12 +4,8 @@
<!-- 搜索表单 -->
<a-form
:model="where"
layout="vertical"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
layout="inline"
>
<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
@@ -19,27 +15,21 @@
</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-form-item label="起始日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeEnd"></a-date-picker>
</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"
:need-page="false"
@@ -62,7 +52,6 @@
import _ from "lodash";
import XLSX from "xlsx";
import {statisticUrl, getColumnOptions,statisticArea} from "@/api/ecology/air";
import { Modal } from "ant-design-vue";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
@@ -71,6 +60,7 @@ export default {
name: "StatisticAirAvg",
components: {},
data() {
const year = new Date().getFullYear();
return {
data: [],
locale,
@@ -201,16 +191,19 @@ export default {
],
regionLevelOptions: [],
time: undefined,
time: [],
// 表格搜索条件
where: {
regionLevel: "place",
timeStart:moment(`${year}-01-01 00:00:00`).format("YYYY-MM-DD 00:00:00"),
timeEnd:moment().format("YYYY-MM-DD 00:00:00")
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.loadOptionData();
this.reload();
},
@@ -238,21 +231,6 @@ export default {
/* 刷新表格 */
reload() {
const where = _.cloneDeep(this.where);
const year = new Date().getFullYear();
if (!this.time) {
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()){
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");
}
if(this.where.regionLevel == "area"){
delete where["regionLevel"]
@@ -297,7 +275,7 @@ export default {
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
sheet['!merges'] = merges;
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日"));
},
},