酸雨统计

This commit is contained in:
weicw
2021-09-30 02:12:49 +08:00
parent ddf83b104b
commit 1c6338d61a
12 changed files with 810 additions and 1005 deletions

View File

@@ -49,8 +49,7 @@ const updateAcidRain = function (data) {
// -------------------------统计--------------------- // -------------------------统计---------------------
const pageAcidRainStatisticUrl = '/acidRain/acidRain/statistic'; const pageAcidRainStatisticUrl = '/acidRain/acidRain/statistic';
const statisticSourceUrl = '/acidRain/acidRain/statistic/source';
const statisticYearUrl = '/acidRain/acidRain/statistic/year';
const getHistoryyears = function () { const getHistoryyears = function () {
return axios.get("/acidRain/acidRain/history-year") return axios.get("/acidRain/acidRain/history-year")
} }
@@ -58,6 +57,10 @@ const getColumnOptions = function(column){
return axios.get("/acidRain/acidRain/options",{params:{column}}) return axios.get("/acidRain/acidRain/options",{params:{column}})
} }
const statisticCity = "/acidRain/acidRain/statistic/city"
const statisticCounty = "/acidRain/acidRain/statistic/county"
const statisticIon = "/acidRain/acidRain/statistic/ion"
export { export {
pageBillUrl, pageBillUrl,
saveAcidRainBill, saveAcidRainBill,
@@ -74,7 +77,7 @@ export {
pageAcidRainStatisticUrl, pageAcidRainStatisticUrl,
getHistoryyears, getHistoryyears,
getColumnOptions, getColumnOptions,
statisticSourceUrl, statisticCity,
statisticYearUrl statisticIon,
statisticCounty
} }

View File

@@ -1,32 +1,39 @@
import axios from 'axios'; import axios from 'axios';
const baseUri = "/ambientAir/airPlaceBasicInfoDict"; const baseUri = "/acidRain/acidRainPlaceBaseInfoDict";
const listAllUrl = baseUri + ""; const listAllUrl = baseUri + "";
// 添加 // 添加
const savePlace = function (data) { const savePlace = function (data) {
return axios.post("/ambientAir/airPlaceBasicInfoDict",data) return axios.post("/acidRain/acidRainPlaceBaseInfoDict",data)
} }
// 删除 // 删除
const removePlace = function (id) { const removePlace = function (id) {
return axios.delete(`/ambientAir/airPlaceBasicInfoDict/${id}`,) return axios.delete(`/acidRain/acidRainPlaceBaseInfoDict/${id}`,)
} }
// 批量删除 // 批量删除
const removeBatchPlace = function (ids) { const removeBatchPlace = function (ids) {
return axios.delete("/ambientAir/airPlaceBasicInfoDict/batch",{data:ids}) return axios.delete("/acidRain/acidRainPlaceBaseInfoDict/batch",{data:ids})
} }
// 修改 // 修改
const updatePlace = function (data) { const updatePlace = function (data) {
return axios.put("/ambientAir/airPlaceBasicInfoDict",data) return axios.put("/acidRain/acidRainPlaceBaseInfoDict",data)
} }
const copyBatchPlace = function (data){
return axios.post("/acidRain/acidRainPlaceBaseInfoDict/copyBatch",data)
}
const getColumnOptions = function(column){
return axios.get("/acidRain/acidRainPlaceBaseInfoDict/options",{params:{column}})
}
export { export {
listAllUrl, listAllUrl,
savePlace, savePlace,
updatePlace, updatePlace,
removeBatchPlace, removeBatchPlace,
removePlace removePlace,
copyBatchPlace,
getColumnOptions
} }

View File

@@ -5,9 +5,9 @@
<a-tab-pane key="place" tab="点位信息"> <a-tab-pane key="place" tab="点位信息">
<place></place> <place></place>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="leqLevel" tab="Leq等级"> <!-- <a-tab-pane key="leqLevel" tab="Leq等级">-->
<leq-level></leq-level> <!-- <leq-level></leq-level>-->
</a-tab-pane> <!-- </a-tab-pane>-->
</a-tabs> </a-tabs>
</a-card> </a-card>
@@ -20,14 +20,12 @@
* *
* *
*/ */
import LeqLevel from "./leq-level"
import Place from "./place" import Place from "./place"
export default { export default {
name: 'ZoneNoiseDictIndex', name: 'AcidRainDictIndex',
components: { components: {
LeqLevel,
Place Place
}, },
data() { data() {

View File

@@ -1,302 +0,0 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-modal
v-model:visible="showEdit"
:title="form.id !== undefined ? '修改' : '添加'"
:confirm-loading="loading"
:width="500"
: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="minLeq">
<a-input-number @change="minLeqChange" :step=".1" :precision="1" v-model:value="form.minLeq" />
</a-form-item>
<a-form-item label="最大值" name="maxLeq">
<a-input-number :step=".1" :precision="1" v-model:value="form.maxLeq" />
</a-form-item>
<a-form-item label="时段" name="timeSlot">
<a-select v-model:value="form.timeSlot">
<a-select-option value="昼"></a-select-option>
<a-select-option value="夜"></a-select-option>
</a-select>
</a-form-item>
<a-form-item label="等级" name="level">
<a-input
v-model:value="form.level"
placeholder="请输入等级"
allow-clear
/>
</a-form-item>
<a-form-item label="评价" name="evaluate">
<a-input
v-model:value="form.evaluate"
placeholder="请输入评价"
allow-clear
/>
</a-form-item>
<a-form-item label="排序" name="sortNumber">
<a-input-number :step="1" :precision="0" v-model:value="form.sortNumber" />
</a-form-item>
</a-form>
</a-modal>
<!-- 表格 -->
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="id"
: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,
saveLeqLevel,
updateLeqLevel,
removeLeqLevel,
removeBatchLeqLevel
} from "@/api/ecology/noise/zone-noise-leq-level";
import { message } from 'ant-design-vue';
// import moment from "moment";
export default {
name: "ZoneNoiseLeqLevel",
components: {},
data() {
return {
data: [],
// 表格数据接口
url: listAllUrl,
selection: [],
// 表格列配置
columns: [
{
title: "时段",
dataIndex: "timeSlot",
},
{
title: "等级",
dataIndex: "level",
},
{
title: "最小值",
dataIndex: "minLeq",
customRender: ({text})=>{
return text!=undefined? text.toFixed(1):undefined
}
},
{
title: "最大值",
dataIndex: "maxLeq",
customRender: ({text})=>{
return text!=undefined? text.toFixed(1):undefined
}
},
{
title: "评价",
dataIndex: "evaluate",
},
{
title: "排序",
dataIndex: "sortNumber",
},
{
title: "操作",
key: "action",
width: 150,
align: "center",
fixed: "right",
slots: {
customRender: "action",
},
},
],
// 表格搜索条件
where: {},
// 表格选中数据
selectionList: [],
// 是否显示编辑弹窗
showEdit: false,
// 表单数据
form: {},
loading: false,
rules: {
timeSlot:[{required: true,message: '请选择时段'}],
// minLeq: [{required: true,message: '请输入最小值',},],
// maxLeq: [{required: true,message: '请输入最大值',},],
level: [{required: true,message: '请输入等级',},],
// evaluate: [{required: true,message: '请输入评价',},],
sortNumber: [{required: true,message: '请输入排序',},],
},
};
},
mounted() {
},
methods: {
minLeqChange(e){
console.log(e)
},
/* 刷新表格 */
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 {minLeq,maxLeq } = this.form;
if(minLeq == undefined && maxLeq == undefined ){
message.error("最小值和最大值请至少填写一项!")
return;
}
const hide = this.$message.loading('请求中..', 0);
const form = this.form;
if (form.id) {
updateLeqLevel(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 {
saveLeqLevel(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);
removeLeqLevel(row.id).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.id);
removeBatchLeqLevel(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,9 +1,56 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card :bordered="false"> <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 <a-modal
v-model:visible="showEdit" v-model:visible="showEdit"
:title="form.airBasicInfoDictId !== undefined ? '修改' : '添加'" :title="form.roadNoisePlaceId !== undefined ? '修改' : '添加'"
:confirm-loading="loading" :confirm-loading="loading"
:width="800" :width="800"
:body-style="{ paddingBottom: '8px' }" :body-style="{ paddingBottom: '8px' }"
@@ -16,32 +63,87 @@
:label-col="{ md: { span: 6 }, sm: { span: 24 } }" :label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" :wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
> >
<a-form-item label="点位名称" name="place"> <a-form-item label="年份" name="year">
<a-input v-model:value="form.place" placeholder="请输入点位名称" allow-clear /> <a-input-number v-model:value="form.year" :min="1970" :max="2050" />
</a-form-item> </a-form-item>
<a-form-item label="测点名称" name="placeName">
<a-form-item label="经度" name="longitude"> <a-input v-model:value="form.placeName" placeholder="请输入测点名称" allow-clear/>
<a-input v-model:value="form.longitude" placeholder="请输入经度" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="度" name="latitude"> <a-form-item label="测点经度" name="placeLng">
<a-input v-model:value="form.latitude" placeholder="请输入度" allow-clear /> <a-input v-model:value="form.placeLng" placeholder="请输入测点经度" allow-clear/>
</a-form-item>
<a-form-item label="测点纬度" name="placeLat">
<a-input v-model:value="form.placeLat" placeholder="请输入测点纬度" allow-clear/>
</a-form-item>
<a-form-item label="机动车车道数" name="motorway">
<a-input type="number" v-model:value="form.motorway" placeholder="请输入机动车车道数" allow-clear/>
</a-form-item>
<a-form-item label="车道类别" name="motorwayType">
<a-input v-model:value="form.motorwayType" placeholder="请输入车道类别" allow-clear/>
</a-form-item>
<a-form-item label="道路等级" name="motorwayLevel">
<a-input v-model:value="form.motorwayLevel" placeholder="请输入道路等级" allow-clear/>
</a-form-item>
<a-form-item label="测点参照物" name="refObj">
<a-input v-model:value="form.refObj" placeholder="请输入测点参照物" allow-clear/>
</a-form-item>
<a-form-item label="道路覆盖人口(万人)" name="people">
<a-input v-model:value="form.people" placeholder="请输入道路覆盖人口(万人)" allow-clear/>
</a-form-item>
<a-form-item label="监测站名" name="station">
<a-input v-model:value="form.station" placeholder="请输入监测站名" allow-clear/>
</a-form-item>
<a-form-item label="监测仪器型号" name="monitorInstrumentModel">
<a-input v-model:value="form.monitorInstrumentModel" placeholder="请输入测监测仪器型号" allow-clear/>
</a-form-item>
<a-form-item label="监测仪器编号" name="monitorInstrumentCode">
<a-input v-model:value="form.monitorInstrumentCode" placeholder="请输入监测仪器编号" allow-clear/>
</a-form-item>
<a-form-item label="监测前校准值" name="beforeMonitorValue">
<a-input v-model:value="form.beforeMonitorValue" placeholder="请输入监测前校准值" allow-clear/>
</a-form-item>
<a-form-item label="监测后校准值" name="afterMonitorValue">
<a-input v-model:value="form.afterMonitorValue" placeholder="请输入监测后校准值" allow-clear/>
</a-form-item>
<a-form-item label="声校准器测量声压值" name="soundPressureValue">
<a-input v-model:value="form.soundPressureValue" placeholder="请输入声校准器测量声压值" allow-clear/>
</a-form-item>
<a-form-item label="声校准仪器型号" name="soundInstrumentModel">
<a-input v-model:value="form.soundInstrumentModel" placeholder="请输入声校准仪器型号" allow-clear/>
</a-form-item>
<a-form-item label="声校准仪器编号" name="soundInstrumentCode">
<a-input v-model:value="form.soundInstrumentCode" placeholder="请输入声校准仪器编号" allow-clear/>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
<!-- 表格 --> <!-- 表格 -->
<ele-pro-table <ele-pro-table
v-model:selection="selectionList" v-model:selection="selectionList"
ref="table" ref="table"
row-key="airBasicInfoDictId" row-key="roadNoisePlaceId"
:datasource="url" :datasource="url"
:columns="columns" :columns="columns"
:where="where" :where="where"
:scroll="{ x: 'max-content' }" :scroll="{ x: 'max-content' }"
:need-page="false"
@done="(d) => (data = d.data)"
> >
<template #toolbar> <template #toolbar>
<a-space> <a-space>
<a-button @click="openEdit" type="primary">新增</a-button> <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 <a-popconfirm
:disabled="selectionList.length == 0" :disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`" :title="`确认删除${selectionList.length}条数据吗?`"
@@ -57,6 +159,7 @@
>删除 >删除
</a-button> </a-button>
</a-popconfirm> </a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</a-space> </a-space>
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
@@ -66,7 +169,8 @@
type="primary" type="primary"
shape="round" shape="round"
size="small" size="small"
>修改</a-button >修改
</a-button
> >
<a-popconfirm <a-popconfirm
:title="`确认删除这条数据吗?`" :title="`确认删除这条数据吗?`"
@@ -75,7 +179,8 @@
@confirm="remove(record)" @confirm="remove(record)"
> >
<a-button type="primary" danger shape="round" size="small" <a-button type="primary" danger shape="round" size="small"
>删除</a-button >删除
</a-button
> >
</a-popconfirm> </a-popconfirm>
</a-space> </a-space>
@@ -93,12 +198,16 @@ import {
savePlace, savePlace,
updatePlace, updatePlace,
removePlace, removePlace,
removeBatchPlace removeBatchPlace,
} from "@/api/ecology/noise/zone-noise-place"; copyBatchPlace,
getColumnOptions
} from "@/api/ecology/atmosphere/acid-rain-plcae";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
// import moment from "moment"; // import moment from "moment";
export default { export default {
name: "ZoneNoisePlace", name: "AcidRainPlace",
components: {}, components: {DownOutlined},
data() { data() {
return { return {
data: [], data: [],
@@ -107,6 +216,11 @@ export default {
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{
title: "年份",
dataIndex: "year",
sorter: true,
},
{ {
title: "点位名称", title: "点位名称",
dataIndex: "place", dataIndex: "place",
@@ -133,25 +247,29 @@ export default {
}, },
}, },
], ],
// 表格搜索条件 // 表格搜索条件
where: {}, where: {},
yearOptions: [],
// 表格选中数据 // 表格选中数据
selectionList: [], selectionList: [],
// 是否显示编辑弹窗 // 是否显示编辑弹窗
showEdit: false, showEdit: false,
showNYear:false,
cYear: undefined,
nYear:undefined,
// 表单数据 // 表单数据
form: {}, form: {},
loading: false, loading: false,
rules: { rules: {
place:[{required: true,message: '请输入点位名称'}], year: [{required: true, message: '请输入年份'}],
placeCode:[{required: true,message: '请输入点位编码'}], placeName: [{required: true, message: '请选择测点名称'}],
placeLng: [{required: true,message: '请输入测点经度',},], placeLng: [{required: true, message: '请输入测点经度',},],
placeLat: [{required: true,message: '请输入测点纬度',},], placeLat: [{required: true, message: '请输入测点纬度',},],
}, },
}; };
}, },
mounted() { mounted() {
this.getOptions();
}, },
methods: { methods: {
/* 刷新表格 */ /* 刷新表格 */
@@ -161,6 +279,19 @@ export default {
where: this.where, where: this.where,
}); });
}, },
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
}
})
}
})
},
/* 重置搜索 */ /* 重置搜索 */
reset() { reset() {
this.where = {}; this.where = {};
@@ -179,13 +310,14 @@ export default {
await this.$refs.form.validate(); await this.$refs.form.validate();
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
const form = this.form; const form = this.form;
if (form.airBasicInfoDictId) { if (form.roadNoisePlaceId) {
updatePlace(form) updatePlace(form)
.then((res) => { .then((res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions();
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -203,6 +335,7 @@ export default {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions();
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -218,7 +351,7 @@ export default {
/* 删除单个 */ /* 删除单个 */
remove(row) { remove(row) {
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
removePlace(row.airBasicInfoDictId).then((res) => { removePlace(row.roadNoisePlaceId).then((res) => {
hide(); hide();
if (res.data.code === 0) { if (res.data.code === 0) {
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
@@ -234,7 +367,7 @@ export default {
/* 批量删除 */ /* 批量删除 */
removeBatch() { removeBatch() {
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
const ids = this.selectionList.map((item) => item.airBasicInfoDictId); const ids = this.selectionList.map((item) => item.roadNoisePlaceId);
removeBatchPlace(ids).then((res) => { removeBatchPlace(ids).then((res) => {
if (res.data.code === 0) { if (res.data.code === 0) {
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
@@ -247,6 +380,40 @@ export default {
}).finally(() => { }).finally(() => {
hide(); hide();
}) })
},
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

@@ -1,213 +0,0 @@
<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.year" allowClear showSearch>
<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-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="area"
:datasource="url"
:columns="columns"
:where="where"
:needPage="false"
:initLoad="false"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import { pageZoneNoiseStatisticUrl, getColumnOptions } from "@/api/ecology/noise/zone-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
// import utils from "./utils";
export default {
name: "StatisticSoundZoneAverage",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: pageZoneNoiseStatisticUrl,
selection: [],
// 表格列配置
columns: [
{
title: "噪声源分类",
dataIndex: "source",
},
{
title: "测点数(个)",
dataIndex: "count",
},
{
title: "声源占比(%",
dataIndex: "rate",
},
{
title: "时段",
dataIndex: "timeSlot",
},
{
title: "监测结果",
children: [
{
title: "Leq",
dataIndex: "leq",
},
{
title: "L10",
dataIndex: "l10",
},
{
title: "L50",
dataIndex: "l50",
},
{
title: "L90",
dataIndex: "l90",
},
],
},
],
// 表格搜索条件
where: {},
yearOptions: [],
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.loadOptionData();
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("monitor_year").then((res) => {
this.yearOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
this.reload();
});
},
/* 刷新表格 */
reload() {
const columns = [
{
title: "城区",
dataIndex: "area"
}
]
this.yearOptions.forEach(item=>{
const {startYear,endYear} = this.where;
if((startYear&& Number(startYear)>Number(item.value))|| (endYear&&Number(endYear)<Number(item.value))){
console.log("");
}else{
columns.push({
title: item.value + "年噪声值",
dataIndex: item.value + "Leq"
})
}
})
this.columns = columns;
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.reload();
},
exportFile() {
const columns = [
{
title: "噪声源分类",
dataIndex: "source",
},
{
title: "测点数",
dataIndex: "count",
},
{
title: "声源占比%",
dataIndex: "rate",
},
{
title: "时段",
dataIndex: "timeSlot",
},
{
title: "Leq",
dataIndex: "leq",
},
{
title: "L10",
dataIndex: "l10",
},
{
title: "L50",
dataIndex: "l50",
},
{
title: "L90",
dataIndex: "l90",
},
];
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
},
};
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,181 @@
<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 {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";
// import utils from "./utils";
export default {
name: "StatisticAcidCity",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: statisticCity,
selection: [],
modelOptions: [
{label: "市", value: "city"},
{label: "县", value: "county"},
{label: "站点", value: "place"},
],
// 表格列配置
columns: [
{title: "xx", dataIndex: "place",align:"center"},
],
regionLevelOptions: [],
time: undefined,
// 表格搜索条件
where: {
},
// 表格选中数据
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 = {
};
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,181 @@
<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 {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";
// import utils from "./utils";
export default {
name: "StatisticAcidCounty",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: statisticCounty,
selection: [],
modelOptions: [
{label: "市", value: "city"},
{label: "县", value: "county"},
{label: "站点", value: "place"},
],
// 表格列配置
columns: [
{title: "xx", dataIndex: "place",align:"center"},
],
regionLevelOptions: [],
time: undefined,
// 表格搜索条件
where: {
},
// 表格选中数据
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 = {
};
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,38 +5,47 @@
<a-tab-pane key="base" tab="数据总览"> <a-tab-pane key="base" tab="数据总览">
<base-statistic></base-statistic> <base-statistic></base-statistic>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="city" tab="市统计">
<city-statistic></city-statistic>
</a-tab-pane>
<a-tab-pane key="county" tab="县统计">
<county-statistic></county-statistic>
</a-tab-pane>
<a-tab-pane key="ion" tab="酸雨离子统计">
<ion-statistic></ion-statistic>
</a-tab-pane>
</a-tabs> </a-tabs>
</a-card> </a-card>
</div> </div>
</template> </template>
<script> <script>
/** /**
* *
* *
* *
*/ */
import BaseStatistic from "./base.vue"; import BaseStatistic from "./base.vue";
import CityStatistic from "./city.vue";
import CountyStatistic from "./county.vue";
import IonStatistic from "./ion.vue";
export default { export default {
name: 'StatisticAcidRain', name: 'StatisticAcidRain',
components: { components: {
BaseStatistic, BaseStatistic, CityStatistic,CountyStatistic,IonStatistic
}, },
data() { data() {
return { return {
activeKey: 'base' activeKey: 'city'
}; };
}, },
methods: { methods: {}
} }
}
</script> </script>
<style scoped> <style scoped>

View File

@@ -0,0 +1,193 @@
<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 {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";
// import utils from "./utils";
export default {
name: "StatisticAcidion",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: statisticIon,
selection: [],
modelOptions: [
{label: "市", value: "city"},
{label: "县", value: "county"},
{label: "站点", value: "place"},
],
// 表格列配置
columns: [
{title: "点位", dataIndex: "place",align:"center"},
{title: "SO42", dataIndex: "so42",align:"center"},
{title: "NO3", dataIndex: "no3",align:"center"},
{title: "F", dataIndex: "f",align:"center"},
{title: "CL", dataIndex: "cl",align:"center"},
{title: "NH4", dataIndex: "nh4",align:"center"},
{title: "钙离子", dataIndex: "ca",align:"center"},
{title: "镁离子", dataIndex: "mg",align:"center"},
{title: "Na", dataIndex: "na",align:"center"},
{title: "k", dataIndex: "k",align:"center"},
{title: "总阴离子", dataIndex: "totalAnion",align:"center"},
{title: "总阳离子", dataIndex: "totalCations",align:"center"},
{title: "阴阳离子比例", dataIndex: "anionCationRatio",align:"center"},
],
regionLevelOptions: [],
time: undefined,
// 表格搜索条件
where: {
},
// 表格选中数据
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 = {
};
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

@@ -1,195 +0,0 @@
<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.year" allowClear showSearch>
<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-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="(record) => record.source + record.timeSlot"
:datasource="url"
:columns="columns"
:where="where"
:needPage="false"
:initLoad="false"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import { statisticSourceUrl, getColumnOptions } from "@/api/ecology/noise/zone-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
// import utils from "./utils";
export default {
name: "StatisticSoundZoneSource",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: statisticSourceUrl,
selection: [],
// 表格列配置
columns: [
{
title: "噪声源分类",
dataIndex: "source",
},
{
title: "测点数",
dataIndex: "count",
},
{
title: "声源占比%",
dataIndex: "rate",
},
{
title: "时段",
dataIndex: "timeSlot",
},
{
title: "监测结果",
children: [
{
title: "Leq",
dataIndex: "leq",
},
{
title: "L10",
dataIndex: "l10",
},
{
title: "L50",
dataIndex: "l50",
},
{
title: "L90",
dataIndex: "l90",
},
],
},
],
// 表格搜索条件
where: {},
yearOptions: [],
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.loadOptionData();
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("monitor_year").then((res) => {
this.yearOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
this.where.year = this.yearOptions[0].value;
this.reload();
});
},
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.reload();
},
exportFile() {
const columns = [
{
title: "噪声源分类",
dataIndex: "source",
},
{
title: "测点数",
dataIndex: "count",
},
{
title: "声源占比%",
dataIndex: "rate",
},
{
title: "时段",
dataIndex: "timeSlot",
},
{
title: "Leq",
dataIndex: "leq",
},
{
title: "L10",
dataIndex: "l10",
},
{
title: "L50",
dataIndex: "l50",
},
{
title: "L90",
dataIndex: "l90",
},
];
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
},
};
</script>
<style scoped lang="less">
</style>

View File

@@ -1,224 +0,0 @@
<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.startYear" allowClear showSearch>
<a-select-option
v-for="item in yearOptions"
:disabled="item.value > where.endYear"
: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.endYear" allowClear showSearch>
<a-select-option
v-for="item in yearOptions"
:disabled="item.value < where.startYear"
: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="(record) => record.source + record.timeSlot"
:datasource="url"
:columns="columns"
:where="where"
:needPage="false"
:initLoad="false"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import { statisticYearUrl, getColumnOptions } from "@/api/ecology/noise/zone-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
// import utils from "./utils";
export default {
name: "StatisticSoundZoneSource",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: statisticYearUrl,
selection: [],
// 表格列配置
columns: [
{
title: "年份",
dataIndex: "year",
},
{
title: "网格长",
dataIndex: "gridLength",
},
{
title: "网格宽",
dataIndex: "gridWidth",
},
{
title: "网格总数",
dataIndex: "gridCount",
},
{
title: "时段",
dataIndex: "timeSlot",
},
{
title: "监测结果",
children: [
{
title: "Leq",
dataIndex: "leq",
},
{
title: "L10",
dataIndex: "l10",
},
{
title: "L50",
dataIndex: "l50",
},
{
title: "L90",
dataIndex: "l90",
},
],
},
{
title: "质量等级",
dataIndex: "level",
},
],
// 表格搜索条件
where: {},
yearOptions: [],
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.loadOptionData();
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("monitor_year").then((res) => {
this.yearOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
this.reload();
});
},
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.reload();
},
exportFile() {
const columns = [
{
title: "年份",
dataIndex: "year",
},
{
title: "网格长",
dataIndex: "gridLength",
},
{
title: "网格宽",
dataIndex: "gridWidth",
},
{
title: "网格总数",
dataIndex: "gridCount",
},
{
title: "时段",
dataIndex: "timeSlot",
},
{
title: "Leq",
dataIndex: "leq",
},
{
title: "L10",
dataIndex: "l10",
},
{
title: "L50",
dataIndex: "l50",
},
{
title: "L90",
dataIndex: "l90",
},
{
title: "质量等级",
dataIndex: "level",
},
];
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
},
};
</script>
<style scoped lang="less">
</style>