空气统计,声字典年份打底

This commit is contained in:
weicw
2021-09-25 14:22:40 +08:00
parent 3a1da0013e
commit ad3b1fc7e6
17 changed files with 1017 additions and 38 deletions

View File

@@ -59,6 +59,13 @@ const getColumnOptions = function(column){
}
//均值 百分位
const statisticAvg = "/ambientAir/ambientAir/statistic/avg";
//市县站点统计
const statisticUrl = "/ambientAir/ambientAir/statistic";
//城区统计
const statisticAreaBase = "/ambientAir/ambientAir/statistic/areaBase";
const statisticArea = "/ambientAir/ambientAir/statistic/area";
export {
pageBillUrl,
saveAirBill,
@@ -74,6 +81,9 @@ export {
updateAir,
removeBatchAir,
getColumnOptions,
statisticAvg
statisticAvg,
statisticUrl,
statisticAreaBase,
statisticArea
}

View File

@@ -20,13 +20,16 @@ const removeBatchFunctionType = function (ids) {
const updateFunctionType = function (data) {
return axios.put("/sound/function/functionType",data)
}
const getColumnOptions = function(column){
return axios.get("/sound/function/functionType/options",{params:{column}})
}
export {
listAllUrl,
saveFunctionType,
updateFunctionType,
removeBatchFunctionType,
removeFunctionType
removeFunctionType,
getColumnOptions
}

View File

@@ -20,13 +20,16 @@ const removeBatchLeqLevel = function (ids) {
const updateLeqLevel = function (data) {
return axios.put("/sound/function/noiseLeqLevel",data)
}
const getColumnOptions = function(column){
return axios.get("/sound/function/noiseLeqLevel/options",{params:{column}})
}
export {
listAllUrl,
saveLeqLevel,
updateLeqLevel,
removeBatchLeqLevel,
removeLeqLevel
removeLeqLevel,
getColumnOptions
}

View File

@@ -21,12 +21,17 @@ const updatePlace = function (data) {
return axios.put("/sound/function/place",data)
}
const getColumnOptions = function(column){
return axios.get("/sound/function/place/options",{params:{column}})
}
export {
listAllUrl,
savePlace,
updatePlace,
removeBatchPlace,
removePlace
removePlace,
getColumnOptions
}

View File

@@ -21,12 +21,17 @@ const updateLeqLevel = function (data) {
return axios.put("/sound/road/noiseLeqLevel",data)
}
const getColumnOptions = function(column){
return axios.get("/sound/road/noiseLeqLevel/options",{params:{column}})
}
export {
listAllUrl,
saveLeqLevel,
updateLeqLevel,
removeBatchLeqLevel,
removeLeqLevel
removeLeqLevel,
getColumnOptions
}

View File

@@ -21,12 +21,15 @@ const updatePlace = function (data) {
return axios.put("/sound/road/place",data)
}
const getColumnOptions = function(column){
return axios.get("/sound/road/place/options",{params:{column}})
}
export {
listAllUrl,
savePlace,
updatePlace,
removeBatchPlace,
removePlace
removePlace,
getColumnOptions
}

View File

@@ -20,6 +20,9 @@ const removeBatchLeqLevel = function (ids) {
const updateLeqLevel = function (data) {
return axios.put("/sound/zone/noiseLeqLevel",data)
}
const getColumnOptions = function(column){
return axios.get("/sound/zone/noiseLeqLevel/options",{params:{column}})
}
export {
@@ -27,6 +30,7 @@ export {
saveLeqLevel,
updateLeqLevel,
removeBatchLeqLevel,
removeLeqLevel
removeLeqLevel,
getColumnOptions
}

View File

@@ -21,12 +21,17 @@ const updatePlace = function (data) {
return axios.put("/sound/zone/place",data)
}
const getColumnOptions = function(column){
return axios.get("/sound/zone/place/options",{params:{column}})
}
export {
listAllUrl,
savePlace,
updatePlace,
removeBatchPlace,
removePlace
removePlace,
getColumnOptions
}

View File

@@ -42,7 +42,7 @@
</a-form>
<a-modal
v-model:visible="showEdit"
:title="form.airId !== undefined ? '修改记录' : '添加记录'"
:title="form.ambientAirId !== undefined ? '修改记录' : '添加记录'"
:confirm-loading="loading"
:width="1000"
:body-style="{ paddingBottom: '8px' }"
@@ -448,7 +448,7 @@ export default {
form.monitorHour = date.getHours();
form.monitorMinute = date.getMinutes();
delete form["monitorDate"];
if (form.airId) {
if (form.ambientAirId) {
updateAir(form)
.then((res) => {
if (res.data.code == 0) {
@@ -489,7 +489,7 @@ export default {
/* 删除单个 */
remove(row) {
const hide = this.$message.loading("请求中..", 0);
removeAir(row.airId)
removeAir(row.ambientAirId)
.then((res) => {
if (res.data.code === 0) {
this.$message.success(res.data.msg);
@@ -504,7 +504,7 @@ export default {
.finally(() => hide());
},
removeBatch() {
const ids = this.selectionList.map((item) => item.airId);
const ids = this.selectionList.map((item) => item.ambientAirId);
const hide = this.$message.loading("请求中..", 0);
removeBatchAir(ids)
.then((res) => {

View File

@@ -3,7 +3,7 @@
<a-card :bordered="false">
<a-modal
v-model:visible="showEdit"
:title="form.id !== undefined ? '修改' : '添加'"
:title="form.airAqiRelateInfoDictId !== undefined ? '修改' : '添加'"
:confirm-loading="loading"
:width="500"
:body-style="{ paddingBottom: '8px' }"
@@ -22,6 +22,9 @@
<a-form-item label="空气质量指数级别" name="iaqiLevel">
<a-input v-model:value="form.iaqiLevel" placeholder="请输入指标名称" allow-clear />
</a-form-item>
<a-form-item label="空气质量指数表示颜色" name="iaqiRepresentsColor">
<a-input v-model:value="form.iaqiRepresentsColor" placeholder="空气质量指数表示颜色" allow-clear />
</a-form-item>
<a-form-item label="对健康影响情况" name="impactHealth">
<a-input v-model:value="form.impactHealth" placeholder="请输入对健康影响情况" allow-clear />
</a-form-item>
@@ -42,7 +45,7 @@
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="id"
row-key="airAqiRelateInfoDictId"
:datasource="url"
:columns="columns"
:where="where"
@@ -123,7 +126,12 @@ export default {
{
title: "空气质量指数类别",
dataIndex: "iaqiCategory",
}, {
},
{
title: "空气质量指数表示颜色",
dataIndex: "iaqiRepresentsColor",
},
{
title: "空气质量指数级别",
dataIndex: "iaqiLevel",
},
@@ -214,7 +222,7 @@ export default {
// }
const hide = this.$message.loading('请求中..', 0);
const form = this.form;
if (form.id) {
if (form.airAqiRelateInfoDictId) {
updateAqiRelate(form)
.then((res) => {
if (res.data.code == 0) {
@@ -253,7 +261,7 @@ export default {
/* 删除单个 */
remove(row) {
const hide = this.$message.loading('请求中..', 0);
removeAqiRelate(row.id).then((res) => {
removeAqiRelate(row.airAqiRelateInfoDictId).then((res) => {
hide();
if (res.data.code === 0) {
this.$message.success(res.data.msg);
@@ -269,7 +277,7 @@ export default {
/* 批量删除 */
removeBatch() {
const hide = this.$message.loading('请求中..', 0);
const ids = this.selectionList.map((item) => item.id);
const ids = this.selectionList.map((item) => item.airAqiRelateInfoDictId);
removeBatchAqiRelate(ids).then((res) => {
if (res.data.code === 0) {
this.$message.success(res.data.msg);

View File

@@ -16,9 +16,12 @@
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-form-item v-for="item in columns" :key="item.dataIndex" :label="item.title" :name="item.dataIndex">
<a-input v-model:value="form[item.dataIndex]" :placeholder="`请输入${item.title}`" allow-clear/>
</a-form-item>
<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/>
</a-form-item>
</template>
</a-form>
@@ -107,16 +110,19 @@ export default {
// title: "年份",
// dataIndex: "year",
// },
{title: "空气质量分指数",dataIndex: "iaqi",}, {title: "so2 24小时平均", dataIndex: "so2TwentyFourHour",},
{title: "空气质量分指数",dataIndex: "iaqi",},
{title: "so2 24小时平均", dataIndex: "so2TwentyFourHour",},
{title: "so2 1小时平均",dataIndex: "so2OneHour",},
{title: "no2 24小时平均",dataIndex: "no2TwentyFourHour",},
{title: "no2 1小时平均",dataIndex: "no2OneHour",},
{title: "pm10 24小时平均",dataIndex: "pm10TwentyFourHour",},
{title: "pm25 24小时平均",dataIndex: "pm25TwentyFourHour",},
{title: "co 24小时平均",dataIndex: "coTwentyFourHour",},
{title: "co 1小时平均",dataIndex: "coOneHour",},
{title: "o3 8小时平均", dataIndex: "o3EightHour",},
{title: "o3 1小时平均", dataIndex: "o3OneHour",},
{title: "o3 8小时滑动平均", dataIndex: "o3EightHour",},
{title: "pm25 24小时平均",dataIndex: "pm25TwentyFourHour",},
{
title: "操作",
key: "action",

View File

@@ -19,13 +19,24 @@
<a-form-item label="点位名称" name="place">
<a-input v-model:value="form.place" placeholder="请输入点位名称" allow-clear />
</a-form-item>
<a-form-item label="片区名称" name="districtName">
<a-input v-model:value="form.districtName" placeholder="请输入片区名称" allow-clear />
</a-form-item>
<a-form-item label="属性" name="attributes">
<a-input v-model:value="form.attributes" placeholder="请输入属性" allow-clear />
</a-form-item>
<a-form-item label="经度" name="longitude">
<a-input v-model:value="form.longitude" placeholder="请输入经度" allow-clear />
</a-form-item>
<a-form-item label="纬度" name="latitude">
<a-input v-model:value="form.latitude" placeholder="请输入纬度" allow-clear />
</a-form-item>
<a-form-item label="点位所在功能区类别" name="placeFunctionalAreaCategory">
<a-input v-model:value="form.placeFunctionalAreaCategory" placeholder="请输入具体地址" allow-clear />
</a-form-item>
<a-form-item label="具体地址" name="addressDetails">
<a-input v-model:value="form.addressDetails" placeholder="请输入具体地址" allow-clear />
</a-form-item>
</a-form>
</a-modal>
@@ -107,11 +118,10 @@ export default {
selection: [],
// 表格列配置
columns: [
{
title: "点位名称",
dataIndex: "place",
sorter: true,
},
{title: "点位名称",dataIndex: "place",sorter: true,},
{title: "片区名称",dataIndex: "districtName",sorter: true,},
{title: "属性",dataIndex: "attributes",sorter: true,},
{title: "点位名称",dataIndex: "place",sorter: true,},
{
title: "经度",
dataIndex: "longitude",
@@ -122,6 +132,9 @@ export default {
dataIndex: "latitude",
sorter: true,
},
{title: "点位所在功能区类别",dataIndex: "placeFunctionalAreaCategory",sorter: true,},
{title: "具体地址",dataIndex: "addressDetails",sorter: true,},
{
title: "操作",
key: "action",

View File

@@ -0,0 +1,265 @@
<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-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>
<!-- 表格 -->
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="ambientAirId"
:need-page="false"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
:init-load="false"
@done="(d) => (data = d.data)"
method="POST"
>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
import _ from "lodash";
import XLSX from "xlsx";
import {statisticAreaBase, getColumnOptions} 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";
// import utils from "./utils";
export default {
name: "StatisticAirAreaBase",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: statisticAreaBase,
selection: [],
modelOptions: [
{label: "市", value: "city"},
{label: "县", value: "county"},
{label: "站点", value: "place"},
],
// 表格列配置
columns: [
{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: "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: "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: "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: "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: "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: "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: "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: "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"},
],
regionLevelOptions: [],
time: undefined,
// 表格搜索条件
where: {
regionLevel: "place",
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.loadOptionData();
this.reload();
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("region_level").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
},
/* 刷新表格 */
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
});
},
/* 重置搜索 */
reset() {
this.where = {
regionLevel: "place",
};
this.time = undefined;
this.reload();
},
exportFile() {
const arr = [];
const th1 = [];
const th2 = [];
const merges = []; // 合并
const columnsTemp = []; // 树形结构整理成list
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{
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);
this.data.forEach((d) => {
const td = columnsTemp.map((item) => 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());
},
},
};
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,294 @@
<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-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>
<!-- 表格 -->
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="ambientAirId"
:need-page="false"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
:init-load="false"
@done="(d) => (data = d.data)"
method="POST"
>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
import _ from "lodash";
import XLSX from "xlsx";
import {statisticArea, getColumnOptions} 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";
// import utils from "./utils";
export default {
name: "StatisticAirArea",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: statisticArea,
selection: [],
modelOptions: [
{label: "市", value: "city"},
{label: "县", value: "county"},
{label: "站点", value: "place"},
],
// 表格列配置
columns: [
{title: "站点/县", dataIndex: "place",align:"center"},
{
title: "二氧化硫", children: [
{title: "本次", dataIndex: "so2Current",align:"center"},
{title: "上年同期", dataIndex: "so2SameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "so2ChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "so2Rank",align:"center"},
]
},
{
title: "二氧化氮", children: [
{title: "本次", dataIndex: "no2Current",align:"center"},
{title: "上年同期", dataIndex: "no2SameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "no2ChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "no2Rank",align:"center"},
]
},
{
title: "可吸入颗粒物", children: [
{title: "本次", dataIndex: "pm10Current",align:"center"},
{title: "上年同期", dataIndex: "pm10SameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "pm10ChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "pm10Rank",align:"center"},
]
},
{
title: "一氧化碳", children: [
{title: "本次", dataIndex: "coCurrent",align:"center"},
{title: "上年同期", dataIndex: "coSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "coChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "coRank",align:"center"},
]
},
{
title: "臭氧", children: [
{title: "本次", dataIndex: "o3Current",align:"center"},
{title: "上年同期", dataIndex: "o3SameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "o3ChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "o3Rank",align:"center"},
]
},
{
title: "细颗粒物", children: [
{title: "本次", dataIndex: "pm25Current",align:"center"},
{title: "上年同期", dataIndex: "pm25SameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "pm25ChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "pm25Rank",align:"center"},
]
},
{
title: "空气质量综合指数", children: [
{title: "本次", dataIndex: "comprehensiveAirQualityIndexCurrent",align:"center"},
{title: "上年同期", dataIndex: "comprehensiveAirQualityIndexSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "comprehensiveAirQualityIndexChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "comprehensiveAirQualityIndexRank",align:"center"},
]
},
{
title: "优天数", children: [
{title: "本次", dataIndex: "excellentDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "excellentDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "excellentDaysChangePercentage",align:"center"},
// {title: "排名(按浓度值)", dataIndex: "excellentDaysRank",align:"center"},
]
},
{
title: "良天数", children: [
{title: "本次", dataIndex: "goodDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "goodDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "goodDaysChangePercentage",align:"center"},
// {title: "排名(按浓度值)", dataIndex: "goodDaysRank",align:"center"},
]
},
{
title: "轻度污染天数", children: [
{title: "本次", dataIndex: "lightPollutionDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "lightPollutionDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "lightPollutionDaysChangePercentage",align:"center"},
// {title: "排名(按浓度值)", dataIndex: "lightPollutionDaysRank",align:"center"},
]
},
{
title: "中度污染天数", children: [
{title: "本次", dataIndex: "moderatelyPollutedDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "moderatelyPollutedDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "moderatelyPollutedDaysChangePercentage",align:"center"},
// {title: "排名(按浓度值)", dataIndex: "moderatelyPollutedDaysRank",align:"center"},
]
},
{
title: "良天数", children: [
{title: "本次", dataIndex: "goodDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "goodDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "goodDaysChangePercentage",align:"center"},
// {title: "排名(按浓度值)", dataIndex: "goodDaysRank",align:"center"},
]
},
{
title: "重度污染天数", children: [
{title: "本次", dataIndex: "heavyPollutionDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "heavyPollutionDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "heavyPollutionDaysChangePercentage",align:"center"},
]
},
{
title: "优良率", children: [
{title: "本次", dataIndex: "excellentRateCurrent",align:"center"},
{title: "上年同期", dataIndex: "excellentRateSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "excellentRateChangePercentage",align:"center"},
]
},
],
regionLevelOptions: [],
time: undefined,
// 表格搜索条件
where: {
regionLevel: "place",
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.loadOptionData();
this.reload();
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("region_level").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
},
/* 刷新表格 */
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
});
},
/* 重置搜索 */
reset() {
this.where = {
regionLevel: "place",
};
this.time = undefined;
this.reload();
},
exportFile() {
const arr = [];
const th1 = [];
const th2 = [];
const merges = []; // 合并
const columnsTemp = []; // 树形结构整理成list
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{
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);
this.data.forEach((d) => {
const td = columnsTemp.map((item) => 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());
},
},
};
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,308 @@
<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-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>
<!-- 表格 -->
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="ambientAirId"
:need-page="false"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
:init-load="false"
@done="(d) => (data = d.data)"
method="POST"
>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
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";
// import utils from "./utils";
export default {
name: "StatisticAirAvg",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
// url: statisticUrl,
selection: [],
modelOptions: [
{label: "市", value: "city"},
{label: "县", value: "county"},
{label: "站点", value: "place"},
{label: "城区", value: "area"},
],
// 表格列配置
columns: [
{title: "站点/县", dataIndex: "place",align:"center"},
{
title: "二氧化硫", children: [
{title: "本次", dataIndex: "so2Current",align:"center"},
{title: "上年同期", dataIndex: "so2SameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "so2ChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "so2Rank",align:"center"},
]
},
{
title: "二氧化氮", children: [
{title: "本次", dataIndex: "no2Current",align:"center"},
{title: "上年同期", dataIndex: "no2SameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "no2ChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "no2Rank",align:"center"},
]
},
{
title: "可吸入颗粒物", children: [
{title: "本次", dataIndex: "pm10Current",align:"center"},
{title: "上年同期", dataIndex: "pm10SameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "pm10ChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "pm10Rank",align:"center"},
]
},
{
title: "一氧化碳", children: [
{title: "本次", dataIndex: "coCurrent",align:"center"},
{title: "上年同期", dataIndex: "coSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "coChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "coRank",align:"center"},
]
},
{
title: "臭氧", children: [
{title: "本次", dataIndex: "o3Current",align:"center"},
{title: "上年同期", dataIndex: "o3SameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "o3ChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "o3Rank",align:"center"},
]
},
{
title: "细颗粒物", children: [
{title: "本次", dataIndex: "pm25Current",align:"center"},
{title: "上年同期", dataIndex: "pm25SameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "pm25ChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "pm25Rank",align:"center"},
]
},
{
title: "空气质量综合指数", children: [
{title: "本次", dataIndex: "comprehensiveAirQualityIndexCurrent",align:"center"},
{title: "上年同期", dataIndex: "comprehensiveAirQualityIndexSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "comprehensiveAirQualityIndexChangePercentage",align:"center"},
{title: "排名(按浓度值)", dataIndex: "comprehensiveAirQualityIndexRank",align:"center"},
]
},
{
title: "优天数", children: [
{title: "本次", dataIndex: "excellentDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "excellentDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "excellentDaysChangePercentage",align:"center"},
// {title: "排名(按浓度值)", dataIndex: "excellentDaysRank",align:"center"},
]
},
{
title: "良天数", children: [
{title: "本次", dataIndex: "goodDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "goodDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "goodDaysChangePercentage",align:"center"},
// {title: "排名(按浓度值)", dataIndex: "goodDaysRank",align:"center"},
]
},
{
title: "轻度污染天数", children: [
{title: "本次", dataIndex: "lightPollutionDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "lightPollutionDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "lightPollutionDaysChangePercentage",align:"center"},
// {title: "排名(按浓度值)", dataIndex: "lightPollutionDaysRank",align:"center"},
]
},
{
title: "中度污染天数", children: [
{title: "本次", dataIndex: "moderatelyPollutedDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "moderatelyPollutedDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "moderatelyPollutedDaysChangePercentage",align:"center"},
// {title: "排名(按浓度值)", dataIndex: "moderatelyPollutedDaysRank",align:"center"},
]
},
{
title: "良天数", children: [
{title: "本次", dataIndex: "goodDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "goodDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "goodDaysChangePercentage",align:"center"},
// {title: "排名(按浓度值)", dataIndex: "goodDaysRank",align:"center"},
]
},
{
title: "重度污染天数", children: [
{title: "本次", dataIndex: "heavyPollutionDaysCurrent",align:"center"},
{title: "上年同期", dataIndex: "heavyPollutionDaysSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "heavyPollutionDaysChangePercentage",align:"center"},
]
},
{
title: "优良率", children: [
{title: "本次", dataIndex: "excellentRateCurrent",align:"center"},
{title: "上年同期", dataIndex: "excellentRateSameTimeLastYear",align:"center"},
{title: "增减(%", dataIndex: "excellentRateChangePercentage",align:"center"},
]
},
],
regionLevelOptions: [],
time: undefined,
// 表格搜索条件
where: {
regionLevel: "place",
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.loadOptionData();
this.reload();
},
computed:{
url(){
if(this.where.regionLevel == "area"){
return statisticArea
}else{
return statisticUrl
}
}
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("region_level").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
},
/* 刷新表格 */
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"]
}
this.$refs.table.reload({
where
});
},
/* 重置搜索 */
reset() {
this.where = {
regionLevel: "place",
};
this.time = undefined;
this.reload();
},
exportFile() {
const arr = [];
const th1 = [];
const th2 = [];
const merges = []; // 合并
const columnsTemp = []; // 树形结构整理成list
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{
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);
this.data.forEach((d) => {
const td = columnsTemp.map((item) => 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());
},
},
};
</script>
<style scoped lang="less">
</style>

View File

@@ -5,9 +5,18 @@
<a-tab-pane key="base" tab="数据总览">
<base-statistic></base-statistic>
</a-tab-pane>
<a-tab-pane key="avg" tab="均值、百分位">
<avg-statistic></avg-statistic>
<!-- <a-tab-pane v-show="false" key="avg" tab="均值、百分位">-->
<!-- <avg-statistic></avg-statistic>-->
<!-- </a-tab-pane>-->
<a-tab-pane key="ccp" tab="市、县、站点统计">
<city-county-place></city-county-place>
</a-tab-pane>
<a-tab-pane key="area" tab="城区分担浓度统计">
<area-base></area-base>
</a-tab-pane>
<!-- <a-tab-pane key="avg" tab="均值、百分位">-->
<!-- <avg-statistic></avg-statistic>-->
<!-- </a-tab-pane>-->
</a-tabs>
</a-card>
</div>
@@ -21,15 +30,18 @@
*/
import BaseStatistic from "./base.vue";
import AvgStatistic from "./avg";
import CityCountyPlace from "./city-county-place";
import AreaBase from "./area-base";
export default {
name: 'StatisticAirIndex',
components: {
BaseStatistic,AvgStatistic
// eslint-disable-next-line vue/no-unused-components
BaseStatistic,AvgStatistic,CityCountyPlace,AreaBase
},
data() {
return {
activeKey: 'avg'
activeKey: 'area'
};
},

View File

@@ -1,6 +1,36 @@
<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-select v-model:value="where.year">
<a-select-option
v-for="(item) in yearOptions"
:key="item.value"
>{{ item.label }}
</a-select-option>
</a-select>
</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 type="primary" @click="copy">批量复制</a-button>
<a-button @click="reset">重置</a-button>
</a-space>
</a-col>
</a-row>
</a-form>
<a-modal
v-model:visible="showEdit"
:title="form.roadNoisePlaceId !== undefined ? '修改' : '添加'"
@@ -130,7 +160,8 @@ import {
savePlace,
updatePlace,
removePlace,
removeBatchPlace
removeBatchPlace,
getColumnOptions
} from "@/api/ecology/noise/road-noise-place";
// import moment from "moment";
export default {
@@ -233,6 +264,7 @@ export default {
// 表格搜索条件
where: {},
yearOption:[],
// 表格选中数据
selectionList: [],
// 是否显示编辑弹窗
@@ -248,6 +280,9 @@ export default {
};
},
mounted() {
getColumnOptions("year").then(res=>{
console.log(res)
})
},
methods: {
/* 刷新表格 */