噪声新增、修复

This commit is contained in:
weicw
2021-10-02 08:41:32 +08:00
parent 1c6338d61a
commit dffbbb2763
12 changed files with 1144 additions and 341 deletions

View File

@@ -53,6 +53,7 @@ const updateFunctionNoise = function (data) {
// -------------------------统计--------------------- // -------------------------统计---------------------
const pageFunctionNoiseStatisticUrl = '/sound/function/noise/statistic'; const pageFunctionNoiseStatisticUrl = '/sound/function/noise/statistic';
const pageFunctionNoiseStatisticAvgUrl = '/sound/function/noise/statistic/avg';
const getHistoryyears = function () { const getHistoryyears = function () {
return axios.get("/sound/function/noise/history-year") return axios.get("/sound/function/noise/history-year")
} }
@@ -85,6 +86,7 @@ export {
getGisBase, getGisBase,
getGisArea, getGisArea,
listAllFunctionNoiseUrl, listAllFunctionNoiseUrl,
listAllFunctionNoise listAllFunctionNoise,
pageFunctionNoiseStatisticAvgUrl
} }

View File

@@ -0,0 +1,41 @@
import axios from 'axios';
const baseUri = "/sound/zone/noiseSource";
const listAllUrl = baseUri + "";
// 添加
const saveSource = function (data) {
return axios.post("/sound/zone/noiseSource",data)
}
// 删除
const removeSource = function (id) {
return axios.delete(`/sound/zone/noiseSource/${id}`,)
}
// 批量删除
const removeBatchSource = function (ids) {
return axios.delete("/sound/zone/noiseSource/batch",{data:ids})
}
// 修改
const updateSource = function (data) {
return axios.put("/sound/zone/noiseSource",data)
}
const getColumnOptions = function(column){
return axios.get("/sound/zone/noiseSource/options",{params:{column}})
}
const copyBatchSource = function (data){
return axios.post("/sound/zone/noiseSource/copyBatch",data)
}
export {
listAllUrl,
saveSource,
updateSource,
removeBatchSource,
removeSource,
getColumnOptions,
copyBatchSource
}

View File

@@ -53,6 +53,7 @@ const updateZoneNoise = function (data) {
// -------------------------统计--------------------- // -------------------------统计---------------------
const pageZoneNoiseStatisticUrl = '/sound/zone/noise/statistic'; const pageZoneNoiseStatisticUrl = '/sound/zone/noise/statistic';
const statisticLevelDistributionUrl = '/sound/zone/noise/statistic/levelDistribution';
const statisticSourceUrl = '/sound/zone/noise/statistic/source'; const statisticSourceUrl = '/sound/zone/noise/statistic/source';
const statisticYearUrl = '/sound/zone/noise/statistic/year'; const statisticYearUrl = '/sound/zone/noise/statistic/year';
const getHistoryyears = function () { const getHistoryyears = function () {
@@ -80,6 +81,7 @@ export {
getColumnOptions, getColumnOptions,
statisticSourceUrl, statisticSourceUrl,
statisticYearUrl, statisticYearUrl,
listALlZoneNoise listALlZoneNoise,
statisticLevelDistributionUrl
} }

View File

@@ -1,216 +1,222 @@
<template> <template>
<div class=""> <div class="">
<!-- 搜索表单 --> <!-- 搜索表单 -->
<a-form <a-form
:model="where" :model="where"
: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-row> <a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="年份"> <a-form-item label="年份">
<a-select v-model:value="where.year"> <a-select v-model:value="where.year">
<a-select-option v-for="item in yearOptions" :key="item.value">{{ <a-select-option v-for="item in yearOptions" :key="item.value">{{
item.label item.label
}}</a-select-option> }}
</a-select> </a-select-option>
</a-form-item> </a-select>
</a-col> </a-form-item>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> </a-col>
<a-form-item label="季度"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-select v-model:value="where.quarter" allowClear> <a-form-item label="季度">
<a-select-option value="1">第一季度</a-select-option> <a-select v-model:value="where.quarter" allowClear>
<a-select-option value="2">季度</a-select-option> <a-select-option value="1">季度</a-select-option>
<a-select-option value="3">季度</a-select-option> <a-select-option value="2">季度</a-select-option>
<a-select-option value="4">季度</a-select-option> <a-select-option value="3">季度</a-select-option>
</a-select> <a-select-option value="4">第四季度</a-select-option>
</a-form-item> </a-select>
</a-col> </a-form-item>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> </a-col>
<a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space> <a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }">
<a-button type="primary" @click="reload">查询</a-button> <a-space>
<a-button @click="reset">重置</a-button> <a-button type="primary" @click="reload">查询</a-button>
<a-button @click="exportFile">导出excel</a-button> <a-button @click="reset">重置</a-button>
</a-space> <a-button @click="exportFile">导出excel</a-button>
</a-form-item> </a-space>
</a-col> </a-form-item>
</a-row> </a-col>
</a-form> </a-row>
<ele-pro-table </a-form>
ref="table" <ele-pro-table
row-key="id" ref="table"
:datasource="url" row-key="id"
:columns="columns" :datasource="url"
:where="where" :columns="columns"
:needPage="false" :where="where"
:initLoad="false" :needPage="false"
@done="(d) => (data = d.data)" :initLoad="false"
:scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)"
> :scroll="{ x: 'max-content' }"
<template #toolbar> >
<!-- <a-space> <template #toolbar>
<!-- <a-space>
</a-space> --> </a-space> -->
</template> </template>
</ele-pro-table> </ele-pro-table>
</div> </div>
</template> </template>
<script> <script>
// import _ from "lodash"; // import _ from "lodash";
import XLSX from "xlsx"; import XLSX from "xlsx";
import { import {
pageFunctionNoiseStatisticUrl, pageFunctionNoiseStatisticUrl,
getColumnOptions, getColumnOptions,
} from "@/api/ecology/noise/function-sound"; } from "@/api/ecology/noise/function-sound";
const columns = [ const columns = [
{ {
title: "功能区类别", title: "年份",
dataIndex: "col1", dataIndex: "year",
}, },
{ {
title: "1类区域", title: "功能区类别",
align: "center", dataIndex: "col1",
children: [ },
{ {
title: "昼间", title: "1类区域",
align: "center", align: "center",
dataIndex: "colD1", children: [
}, {
{ title: "昼间",
title: "夜间", align: "center",
align: "center", dataIndex: "colD1",
dataIndex: "colN1", },
}, {
], title: "夜间",
}, align: "center",
{ dataIndex: "colN1",
title: "2类区域", },
align: "center", ],
children: [ },
{ {
title: "昼间", title: "2类区域",
align: "center", align: "center",
dataIndex: "colD2", children: [
}, {
{ title: "昼间",
title: "夜间", align: "center",
align: "center", dataIndex: "colD2",
dataIndex: "colN2", },
}, {
], title: "夜间",
}, align: "center",
{ dataIndex: "colN2",
title: "3类区域", },
align: "center", ],
children: [ },
{ {
title: "昼间", title: "3类区域",
align: "center", align: "center",
dataIndex: "colD3", children: [
}, {
{ title: "昼间",
title: "夜间", align: "center",
align: "center", dataIndex: "colD3",
dataIndex: "colN3", },
}, {
], title: "夜间",
}, align: "center",
{ dataIndex: "colN3",
title: "4类区域", },
align: "center", ],
children: [ },
{ {
title: "昼间", title: "4类区域",
align: "center", align: "center",
dataIndex: "colD4", children: [
}, {
{ title: "昼间",
title: "夜间", align: "center",
align: "center", dataIndex: "colD4",
dataIndex: "colN4", },
}, {
], title: "夜间",
}, align: "center",
dataIndex: "colN4",
},
],
},
]; ];
export default { export default {
name: "StatisticSoundFunctionAverage", name: "StatisticSoundFunctionAverage",
components: {}, components: {},
data() { data() {
return { return {
url: pageFunctionNoiseStatisticUrl, url: pageFunctionNoiseStatisticUrl,
data: [], data: [],
where: {}, where: {},
columns, columns,
yearOptions: [], yearOptions: [],
}; };
},
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();
});
}, },
/* 刷新表格 */ mounted() {
reload() { this.loadOptionData();
this.$refs.table.reload({
where: this.where,
});
}, },
/* 重置搜索 */ methods: {
reset() { /**获取下来框数据 */
this.where.year = this.yearOptions[0].value; loadOptionData() {
this.reload(); getColumnOptions("monitor_year").then((res) => {
}, this.yearOptions = res.data.data.map((item) => {
exportFile() { return {
let array = [ label: item,
["功能区类别", "1类区域","", "2类区域","", "3类区域", "","4类区域","",], value: item,
["", "以居住、文教 为主的区域","", "居住、商业、工业混杂区","", "适用于工业区", "","交通干线道路 两侧区域","",], };
["", "昼间","夜间", "昼间","夜间", "昼间", "夜间","昼间","夜间",], });
this.where.year = this.yearOptions[0].value;
this.reload();
});
},
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.where.year = this.yearOptions[0].value;
this.reload();
},
exportFile() {
let array = [
["功能区类别", "1类区域", "", "2类区域", "", "3类区域", "", "4类区域", "",],
["", "以居住、文教 为主的区域", "", "居住、商业、工业混杂区", "", "适用于工业区", "", "交通干线道路 两侧区域", "",],
["", "昼间", "夜间", "昼间", "夜间", "昼间", "夜间", "昼间", "夜间",],
]; ];
this.data.forEach((d) => { this.data.forEach((d) => {
array.push([ array.push([
d.col1, d.col1,
d.colD1, d.colD1,
d.colN1, d.colN1,
d.colD2, d.colD2,
d.colN2, d.colN2,
d.colD3, d.colD3,
d.colN3, d.colN3,
d.colD4, d.colD4,
d.colN4, d.colN4,
]); ]);
}); });
let sheet = XLSX.utils.aoa_to_sheet(array); let sheet = XLSX.utils.aoa_to_sheet(array);
// 合并单元格 // 合并单元格
sheet['!merges'] = [ sheet['!merges'] = [
{s: {r: 0, c: 0}, e: {r: 2, c: 0}}, {s: {r: 0, c: 0}, e: {r: 2, c: 0}},
{s: {r: 0, c: 1}, e: {r: 0, c: 2}}, {s: {r: 0, c: 1}, e: {r: 0, c: 2}},
{s: {r: 0, c: 3}, e: {r: 0, c: 4}}, {s: {r: 0, c: 3}, e: {r: 0, c: 4}},
{s: {r: 0, c: 5}, e: {r: 0, c: 6}}, {s: {r: 0, c: 5}, e: {r: 0, c: 6}},
{s: {r: 0, c: 7}, e: {r: 0, c: 8}}, {s: {r: 0, c: 7}, e: {r: 0, c: 8}},
{s: {r: 1, c: 1}, e: {r: 1, c: 2}}, {s: {r: 1, c: 1}, e: {r: 1, c: 2}},
{s: {r: 1, c: 3}, e: {r: 1, c: 4}}, {s: {r: 1, c: 3}, e: {r: 1, c: 4}},
{s: {r: 1, c: 5}, e: {r: 1, c: 6}}, {s: {r: 1, c: 5}, e: {r: 1, c: 6}},
{s: {r: 1, c: 7}, e: {r: 1, c: 8}} {s: {r: 1, c: 7}, e: {r: 1, c: 8}}
]; ];
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString()); this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
}, },
},
}; };
</script> </script>

View File

@@ -5,7 +5,7 @@
<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="average" tab="市达标率"> <a-tab-pane key="average" tab="市达标率、均值">
<average-statistic></average-statistic> <average-statistic></average-statistic>
</a-tab-pane> </a-tab-pane>
<!-- <a-tab-pane key="quarter" tab="季度报告"> <!-- <a-tab-pane key="quarter" tab="季度报告">

View File

@@ -0,0 +1,218 @@
<template>
<div class="">
<!-- 搜索表单 -->
<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">
<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 label="季度">
<a-select v-model:value="where.quarter" allowClear>
<a-select-option value="1">第一季度</a-select-option>
<a-select-option value="2">第二季度</a-select-option>
<a-select-option value="3">第三季度</a-select-option>
<a-select-option value="4">第四季度</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
ref="table"
row-key="id"
:datasource="url"
:columns="columns"
:where="where"
:needPage="false"
:initLoad="false"
@done="(d) => (data = d.data)"
:scroll="{ x: 'max-content' }"
>
<template #toolbar>
<!-- <a-space>
</a-space> -->
</template>
</ele-pro-table>
</div>
</template>
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import {
pageFunctionNoiseStatisticUrl,
getColumnOptions,
} from "@/api/ecology/noise/function-sound";
const columns = [
{
title: "功能区类别",
dataIndex: "col1",
},
{
title: "1类区域",
align: "center",
children: [
{
title: "昼间",
align: "center",
dataIndex: "colD1",
},
{
title: "夜间",
align: "center",
dataIndex: "colN1",
},
],
},
{
title: "2类区域",
align: "center",
children: [
{
title: "昼间",
align: "center",
dataIndex: "colD2",
},
{
title: "夜间",
align: "center",
dataIndex: "colN2",
},
],
},
{
title: "3类区域",
align: "center",
children: [
{
title: "昼间",
align: "center",
dataIndex: "colD3",
},
{
title: "夜间",
align: "center",
dataIndex: "colN3",
},
],
},
{
title: "4类区域",
align: "center",
children: [
{
title: "昼间",
align: "center",
dataIndex: "colD4",
},
{
title: "夜间",
align: "center",
dataIndex: "colN4",
},
],
},
];
export default {
name: "StatisticSoundFunctionAverage",
components: {},
data() {
return {
url: pageFunctionNoiseStatisticUrl,
data: [],
where: {},
columns,
yearOptions: [],
};
},
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.where.year = this.yearOptions[0].value;
this.reload();
},
exportFile() {
let array = [
["功能区类别", "1类区域","", "2类区域","", "3类区域", "","4类区域","",],
["", "以居住、文教 为主的区域","", "居住、商业、工业混杂区","", "适用于工业区", "","交通干线道路 两侧区域","",],
["", "昼间","夜间", "昼间","夜间", "昼间", "夜间","昼间","夜间",],
];
this.data.forEach((d) => {
array.push([
d.col1,
d.colD1,
d.colN1,
d.colD2,
d.colN2,
d.colD3,
d.colN3,
d.colD4,
d.colN4,
]);
});
let sheet = XLSX.utils.aoa_to_sheet(array);
// 合并单元格
sheet['!merges'] = [
{s: {r: 0, c: 0}, e: {r: 2, c: 0}},
{s: {r: 0, c: 1}, e: {r: 0, c: 2}},
{s: {r: 0, c: 3}, e: {r: 0, c: 4}},
{s: {r: 0, c: 5}, e: {r: 0, c: 6}},
{s: {r: 0, c: 7}, e: {r: 0, c: 8}},
{s: {r: 1, c: 1}, e: {r: 1, c: 2}},
{s: {r: 1, c: 3}, e: {r: 1, c: 4}},
{s: {r: 1, c: 5}, e: {r: 1, c: 6}},
{s: {r: 1, c: 7}, e: {r: 1, c: 8}}
];
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
},
};
</script>
<style scoped>
</style>

View File

@@ -14,25 +14,26 @@
<!-- 搜索表单 --> <!-- 搜索表单 -->
<a-form :model="where" layout="inline" :labelCol="{ offset: 1 }"> <a-form :model="where" layout="inline" :labelCol="{ offset: 1 }">
<a-row> <a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-button @click="exportFile">导出excel</a-button>
<a-form-item label="昼夜:"> <!-- <a-col :lg="6" :md="12" :sm="24" :xs="24">-->
<a-select <!-- <a-form-item label="昼夜:">-->
:options="timeSlotOptions" <!-- <a-select-->
v-model:value="where.timeSlot" <!-- :options="timeSlotOptions"-->
placeholder="昼夜" <!-- v-model:value="where.timeSlot"-->
> <!-- placeholder="昼夜"-->
</a-select> <!-- >-->
</a-form-item> <!-- </a-select>-->
</a-col> <!-- </a-form-item>-->
<a-col :lg="4" :md="12" :sm="24" :xs="24"> <!-- </a-col>-->
<a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }"> <!-- <a-col :lg="4" :md="12" :sm="24" :xs="24">-->
<a-space> <!-- <a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }">-->
<a-button type="primary" @click="reload">查询</a-button> <!-- <a-space>-->
<a-button @click="reset">重置</a-button> <!-- <a-button type="primary" @click="reload">查询</a-button>-->
<a-button @click="exportFile">导出excel</a-button> <!-- <a-button @click="reset">重置</a-button>-->
</a-space> <!-- <a-button @click="exportFile">导出excel</a-button>-->
</a-form-item> <!-- </a-space>-->
</a-col> <!-- </a-form-item>-->
<!-- </a-col>-->
</a-row> </a-row>
</a-form> </a-form>
<!-- <a-space> <!-- <a-space>
@@ -54,7 +55,13 @@ const columns = [
{title: "平均路宽(米)",dataIndex: "roadWidthAvg",}, {title: "平均路宽(米)",dataIndex: "roadWidthAvg",},
{title: "车流量(辆/20分钟)",dataIndex: "trafficFlow",}, {title: "车流量(辆/20分钟)",dataIndex: "trafficFlow",},
{title: "超70分贝路段长度占总路长比例(%)",dataIndex: "badProportion",}, {title: "超70分贝路段长度占总路长比例(%)",dataIndex: "badProportion",},
{title: "Leq(分贝)",dataIndex: "leq",}, {title: "Leq(分贝)",dataIndex: "leq",customRender:({text})=>{
if(typeof text == "number"){
return text.toFixed(1)
}
return text
}},
{title: "噪声等级",dataIndex: "level",},
]; ];
@@ -116,27 +123,22 @@ export default {
this.reload(); this.reload();
}, },
exportFile() { exportFile() {
let array = [ const columns = this.columns.filter(item=>item.dataIndex)
["测点", "路段", "城区", "路长", "路宽", "平均Leq", "平均SD"], const arr = [];
]; const th = columns.map((item) => item.title);
this.data.forEach((d) => { arr.push(th);
array.push([ this.data.forEach((d) => {
d.place, const td = columns.map((item) => {
d.road, let val = d[item.dataIndex]
d.area, if(typeof val == "number"){
d.roadLength, val = val.toFixed(1);
d.roadWidth, }
d.avgLeq, return val;
d.avgSD, });
]); arr.push(td);
}); });
let sheet = XLSX.utils.aoa_to_sheet(array); let sheet = XLSX.utils.aoa_to_sheet(arr);
// sheet['!merges'] = [ this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
// {s: {r: 0, c: 1}, e: {r: 0, c: 5}}, // 合并第0行第1列到第0行第5列
// {s: {r: 0, c: 0}, e: {r: 1, c: 0}}, // 合并第0行第0列到第1行第0列
// {s: {r: 0, c: 6}, e: {r: 1, c: 6}} // 合并第0行第6列到第1行第6列
// ];
this.$util.exportSheet(XLSX, sheet, "道路交通噪声统计表");
}, },
}, },
}; };

View File

@@ -8,7 +8,9 @@
<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-tab-pane key="noiseSource" tab="声源">
<noise-source></noise-source>
</a-tab-pane>
</a-tabs> </a-tabs>
</a-card> </a-card>
</div> </div>
@@ -21,6 +23,7 @@
* *
*/ */
import LeqLevel from "./leq-level" import LeqLevel from "./leq-level"
import NoiseSource from "./source"
import Place from "./place" import Place from "./place"
@@ -28,7 +31,8 @@ export default {
name: 'ZoneNoiseDictIndex', name: 'ZoneNoiseDictIndex',
components: { components: {
LeqLevel, LeqLevel,
Place Place,
NoiseSource
}, },
data() { data() {
return { return {

View File

@@ -0,0 +1,390 @@
<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 ? '修改' : '添加'"
: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="year">
<a-input-number v-model:value="form.year" :min="1970" :max="2050" />
</a-form-item>
<a-form-item label="声源" name="sourceName">
<a-input
v-model:value="form.sourceName"
placeholder="请输入声源"
allow-clear
/>
</a-form-item>
<a-form-item label="声源代码" name="sourceCode">
<a-input
v-model:value="form.sourceCode"
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-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}条数据吗?`"
ok-text="Yes"
cancel-text="No"
@confirm="removeBatch"
>
<a-button
:disabled="selectionList.length == 0"
type="primary"
ghost
danger
>删除
</a-button>
</a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</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,
saveSource,
updateSource,
removeSource,
removeBatchSource,
copyBatchSource,
getColumnOptions
} from "@/api/ecology/noise/zone-noise-source";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
// import moment from "moment";
export default {
name: "ZoneNoiseSource",
components: {DownOutlined},
data() {
return {
data: [],
// 表格数据接口
url: listAllUrl,
selection: [],
// 表格列配置
columns: [
{
title: "年份",
dataIndex: "year",
sorter: true,
},
{
title: "声源",
dataIndex: "sourceName",
},
{
title: "声源代码",
dataIndex: "sourceCode",
},
{
title: "排序",
dataIndex: "sortNumber",
},
{
title: "操作",
key: "action",
width: 150,
align: "center",
fixed: "right",
slots: {
customRender: "action",
},
},
],
// 表格搜索条件
where: {},
// 表格选中数据
selectionList: [],
// 是否显示编辑弹窗
showEdit: false,
showNYear:false,
cYear: undefined,
nYear:undefined,
yearOptions:[],
// 表单数据
form: {},
loading: false,
rules: {
sourceName:[{required: true,message: '请输入声源'}],
sourceCode:[{required: true,message: '请输入声源代码'}],
sortNumber: [{required: true,message: '请输入排序',},],
},
};
},
mounted() {
this.getOptions()
},
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 hide = this.$message.loading('请求中..', 0);
const form = this.form;
if (form.id) {
updateSource(form)
.then((res) => {
if (res.data.code == 0) {
this.showEdit = false;
this.$message.success(res.data.msg);
this.reload();
this.getOptions()
} else {
this.$message.error(res.data.msg);
}
})
.catch((error) => {
this.$message.error(error.message);
})
.finally(() => {
hide();
});
} else {
saveSource(form)
.then((res) => {
if (res.data.code == 0) {
this.showEdit = false;
this.$message.success(res.data.msg);
this.reload();
this.getOptions()
} else {
this.$message.error(res.data.msg);
}
})
.catch((error) => {
this.$message.error(error.message);
})
.finally(() => {
hide();
});
}
},
/* 删除单个 */
remove(row) {
const hide = this.$message.loading('请求中..', 0);
removeSource(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);
removeBatchSource(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();
})
},
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);
copyBatchSource({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>
<style scoped lang="less">
</style>

View File

@@ -8,25 +8,26 @@
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" :wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
> >
<a-row> <a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-space>
<a-form-item label="年份"> <!-- <a-button type="primary" @click="reload">查询</a-button>-->
<a-select v-model:value="where.year" allowClear showSearch> <!-- <a-button @click="reset">重置</a-button> -->
<a-select-option <a-button @click="exportFile">导出Excel</a-button>
v-for="item in yearOptions" </a-space>
:key="item.value" <!-- <a-col :lg="6" :md="12" :sm="24" :xs="24">-->
>{{ item.label }} <!-- <a-form-item label="年份">-->
</a-select-option <!-- <a-select v-model:value="where.year" allowClear showSearch>-->
> <!-- <a-select-option-->
</a-select> <!-- v-for="item in yearOptions"-->
</a-form-item> <!-- :key="item.value"-->
</a-col> <!-- >{{ item.label }}-->
<!-- </a-select-option-->
<!-- >-->
<!-- </a-select>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item class="ele-text-right" :wrapper-col="{ span: 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-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -146,9 +147,14 @@ export default {
columns.push({ columns.push({
title: item.value + "年噪声值", title: item.value + "年噪声值",
dataIndex: item.value + "Leq", dataIndex: item.value + "Leq",
customRender: ({text})=>{return Number(text).toFixed(1)} customRender: ({text})=>{return Number(text)?Number(text).toFixed(1):undefined}
}) })
columns.push({
title: item.value + "年噪声等级",
dataIndex: item.value + "Level",
})
} }
}) })
@@ -163,41 +169,7 @@ export default {
this.reload(); this.reload();
}, },
exportFile() { exportFile() {
const columns = [ const columns = this.columns.filter(item=>item.dataIndex)
{
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 arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
arr.push(th); arr.push(th);

View File

@@ -1,58 +1,61 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card :bordered="false"> <a-card :bordered="false">
<a-tabs v-model:activeKey="activeKey"> <a-tabs v-model:activeKey="activeKey">
<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="source-statistic" tab="声源"> <a-tab-pane key="source-statistic" tab="声源">
<source-statistic></source-statistic> <source-statistic></source-statistic>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="average" tab="城区"> <a-tab-pane key="average" tab="城区">
<average-statistic></average-statistic> <average-statistic></average-statistic>
</a-tab-pane> </a-tab-pane>
<!-- <a-tab-pane key="quarter" tab="季度报告"> <!-- <a-tab-pane key="quarter" tab="季度报告">
<quarter-statistic></quarter-statistic> <quarter-statistic></quarter-statistic>
</a-tab-pane> --> </a-tab-pane> -->
<a-tab-pane key="year-compare" tab="市"> <a-tab-pane key="year-compare" tab="市">
<year-statistic></year-statistic> <year-statistic></year-statistic>
</a-tab-pane> </a-tab-pane>
</a-tabs> <a-tab-pane key="level-distribution" tab="等级分布">
</a-card> <level-distribution></level-distribution>
</div> </a-tab-pane>
</a-tabs>
</a-card>
</div>
</template> </template>
<script> <script>
/** /**
* *
* *
* *
*/ */
import BaseStatistic from "./base.vue"; import BaseStatistic from "./base.vue";
import AverageStatistic from "./average.vue"; import AverageStatistic from "./average.vue";
import SourceStatistic from "./source.vue"; import SourceStatistic from "./source.vue";
import YearStatistic from "./year.vue"; import YearStatistic from "./year.vue";
import LevelDistribution from "./level-distribution";
export default { export default {
name: 'StatisticSoundZone', name: 'StatisticSoundZone',
components: { components: {
BaseStatistic, BaseStatistic,
SourceStatistic, SourceStatistic,
// Compare, // Compare,
AverageStatistic, AverageStatistic,
YearStatistic YearStatistic,
LevelDistribution
}, },
data() { data() {
return { return {
activeKey: 'base' activeKey: 'base'
}; };
}, },
methods: { methods: {}
} }
}
</script> </script>
<style scoped> <style scoped>

View File

@@ -0,0 +1,163 @@
<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 label="区域等级">
<a-select v-model:value="where.regionLevel" >
<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.timeSlot" >
<a-select-option
v-for="item in timeSlotOptions"
: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="level"
: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 {statisticLevelDistributionUrl, 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: statisticLevelDistributionUrl,
selection: [],
// 表格列配置
columns: [
{ title: "噪声等级",dataIndex: "level",},
{ title: "范围(分贝)",dataIndex: "levelDesc",},
{ title: "覆盖点(个)",dataIndex: "size",},
{ title: "覆盖面积(平方公里)",dataIndex: "area",},
{ title: "所占比例(%",dataIndex: "ratio",},
],
// 表格搜索条件
where: {regionLevel :"市级",timeSlot:"昼"},
regionLevelOptions:[
{label: "市级",value: "市级"},
{label: "县级",value: "县级"}
],
timeSlotOptions:[
{label:"昼",value:"昼"},
{label:"夜",value:"夜"},
],
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 arr = [];
const th = this.columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = this.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>