区域声源统计

This commit is contained in:
weicw
2021-08-26 11:55:51 +08:00
parent f68ca5f61d
commit 59e13d11c1
4 changed files with 204 additions and 73 deletions

View File

@@ -1,71 +0,0 @@
import axios from 'axios';
// ----------------------列表-----------------------
const pageBillUrl = '/sound/zone/place/bill/page';
// 添加
const saveZonePlaceBill = function (data) {
return axios.post("/sound/zone/place/bill",data)
}
// 删除
const removeZonePlaceBill = function (id) {
return axios.delete(`/sound/zone/place/bill/${id}`,)
}
// 批量删除
const removeBatchZonePlaceBill = function (ids) {
return axios.delete("/sound/zone/place/bill/batch",{data:ids})
}
// 修改
const updateZonePlaceBill = function (data) {
return axios.put("/sound/zone/place/bill",data)
}
// 审核
const verifyZonePlaceBill = function (data) {
return axios.put("/sound/zone/place/bill/verify",data);
}
const getZonePlaceBill = function (id) {
return axios.get(`/sound/zone/place/bill/${id}`)
}
// -------------------------数据---------------------
const pageZonePlaceUrl = '/sound/zone/place/page';
// 添加
const saveZonePlace = function (data) {
return axios.post("/sound/zone/place",data)
}
// 删除
const removeZonePlace = function (id) {
return axios.delete(`/sound/zone/place/${id}`,)
}
// 批量删除
const removeBatchZonePlace = function (ids) {
return axios.delete("/sound/zone/place/batch",{data:ids})
}
// 修改
const updateZonePlace = function (data) {
return axios.put("/sound/zone/place",data)
}
// -------------------------统计---------------------
const pageZonePlaceStatisticUrl = '/sound/zone/place/statistic';
const getHistoryyears = function () {
return axios.get("/sound/zone/place/history-year")
}
export {
pageBillUrl,
saveZonePlaceBill,
removeZonePlaceBill,
updateZonePlaceBill,
removeBatchZonePlaceBill,
verifyZonePlaceBill,
getZonePlaceBill,
pageZonePlaceUrl,
saveZonePlace,
removeZonePlace,
updateZonePlace,
removeBatchZonePlace,
pageZonePlaceStatisticUrl,
getHistoryyears
}

View File

@@ -49,12 +49,14 @@ const updateZoneNoise = function (data) {
// -------------------------统计---------------------
const pageZoneNoiseStatisticUrl = '/sound/zone/noise/statistic';
const statisticSourceUrl = '/sound/zone/noise/statistic/source';
const getHistoryyears = function () {
return axios.get("/sound/zone/noise/history-year")
}
const getColumnOptions = function(column){
return axios.get("/sound/zone/noise/options",{params:{column}})
}
export {
pageBillUrl,
saveZoneNoiseBill,
@@ -70,6 +72,7 @@ export {
removeBatchZoneNoise,
pageZoneNoiseStatisticUrl,
getHistoryyears,
getColumnOptions
getColumnOptions,
statisticSourceUrl
}

View File

@@ -5,6 +5,9 @@
<a-tab-pane key="base" tab="总览">
<base-statistic></base-statistic>
</a-tab-pane>
<a-tab-pane key="source-statistic" tab="声源">
<source-statistic></source-statistic>
</a-tab-pane>
<a-tab-pane key="average" tab="平均">
<average-statistic></average-statistic>
</a-tab-pane>
@@ -29,12 +32,13 @@
// import QuarterStatistic from "./quarter.vue";
import Compare from "./compare.vue"
import AverageStatistic from "./average.vue"
import SourceStatistic from "./source.vue"
export default {
name: 'StatisticSoundZone',
components: {
BaseStatistic,
// QuarterStatistic,
SourceStatistic,
Compare,
AverageStatistic
},

View File

@@ -0,0 +1,195 @@
<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/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>