This commit is contained in:
weicw
2021-08-30 10:04:38 +08:00
parent 76d2c9bba0
commit ab71482bae
26 changed files with 3267 additions and 20012 deletions

View File

@@ -48,7 +48,8 @@ export default {
row.timeSlot = "夜"
}
if (row.indexL10 < row.indexL50 || row.indexL50 < row.indexL90) {
throw new Error(row.place + "数值有误")
throw new Error(row.place + "数值有误" + `${row.indexL10},${row.indexL10},${row.indexL50},${row.indexL90}`)
}
return row;
})
@@ -67,7 +68,7 @@ export default {
monitorInstrumentCode: item[7],
beforeMonitorValue: item[8],
afterMonitorValue: item[9],
soundPressureValue: item[10],
soundPressureValue: Number(item[10]) || null,
soundInstrumentModel: item[11],
soundInstrumentCode: item[12],

View File

@@ -1,5 +1,42 @@
<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"
@@ -7,135 +44,94 @@
:columns="columns"
:where="where"
:needPage="false"
:initLoad="false"
@done="(d) => (data = d.data)"
:scroll="{ x: 'max-content' }"
>
<template #toolbar>
<!-- 搜索表单 -->
<a-form :model="where" layout="inline" :labelCol="{ offset: 1 }">
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="昼夜:">
<a-select
:options="timeSlotOptions"
v-model:value="where.timeSlot"
placeholder="昼夜"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="8" :md="12" :sm="24" :xs="24">
<a-form-item label="时间范围:">
<!-- <a-month-picker v-model:value="timeScope" placeholder="起始" /> -->
<a-range-picker v-model:value="timeScope" format="YYYY-MM-DD" />
</a-form-item>
</a-col>
<a-col :lg="4" :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>
<!-- <a-space>
</a-space> -->
</template>
<template #Leq="{ text, record }">
<a-tag
v-if="
(where.timeSlot == '昼' && text <= 68) ||
(where.timeSlot == '夜' && text <= 58)
"
color="green"
>{{ text }}</a-tag
>
<a-tag
v-else-if="
(record.timeSlot == '昼' && text > 68 && text <= 70) ||
(record.timeSlot == '夜' && text > 58 && text <= 60)
"
color="blue"
>{{ text }}</a-tag
>
<a-tag
v-else-if="
(record.timeSlot == '昼' && text > 70 && text <= 72) ||
(record.timeSlot == '夜' && text > 60 && text <= 62)
"
color="red"
>{{ text }}</a-tag
>
<a-tag
v-else-if="
(record.timeSlot == '昼' && text > 62 && text <= 74) ||
(record.timeSlot == '夜' && text > 62 && text <= 64)
"
color="red"
>{{ text }}</a-tag
>
<a-tag
v-else-if="
(record.timeSlot == '昼' && text > 74) ||
(record.timeSlot == '夜' && text > 64)
"
color="red"
>{{ text }}</a-tag
>
<template v-else color="#FFF">{{ text }}</template>
</template>
</ele-pro-table>
</div>
</template>
<script>
import _ from "lodash";
// import _ from "lodash";
import XLSX from "xlsx";
import { pageFunctionNoiseStatisticUrl } from "@/api/ecology/function-sound";
import {
pageFunctionNoiseStatisticUrl,
getColumnOptions,
} from "@/api/ecology/function-sound";
const columns = [
{
title: "城区",
dataIndex: "area",
},
{
title: "市",
dataIndex: "city",
title: "功能区类别",
dataIndex: "col1",
},
{
title: "路长",
dataIndex: "functionLength",
title: "1类区域",
align: "center",
children: [
{
title: "昼间",
align: "center",
dataIndex: "colD1",
},
{
title: "夜间",
align: "center",
dataIndex: "colN1",
},
],
},
{
title: "路宽",
dataIndex: "functionWidth",
title: "2类区域",
align: "center",
children: [
{
title: "昼间",
align: "center",
dataIndex: "colD2",
},
{
title: "夜间",
align: "center",
dataIndex: "colN2",
},
],
},
{
title: "LeqdB(A)",
dataIndex: "avgLeq",
slots: { customRender: "Leq" },
sorter: true,
title: "3类区域",
align: "center",
children: [
{
title: "昼间",
align: "center",
dataIndex: "colD3",
},
{
title: "夜间",
align: "center",
dataIndex: "colN3",
},
],
},
{
title: "SDdB(A)",
dataIndex: "avgSD",
},
{
title: "L10dB(A)",
dataIndex: "avgL10",
},
{
title: "L50dB(A)",
dataIndex: "avgL50",
},
{
title: "L90dB(A)",
dataIndex: "avgL90",
title: "4类区域",
align: "center",
children: [
{
title: "昼间",
align: "center",
dataIndex: "colD4",
},
{
title: "夜间",
align: "center",
dataIndex: "colN4",
},
],
},
];
export default {
@@ -145,110 +141,74 @@ export default {
return {
url: pageFunctionNoiseStatisticUrl,
data: [],
where: {
model: "area",
timeSlot: "昼"
},
timeScope: [],
where: {},
columns,
modelOptions: [
{
value: "place",
label: "测点",
},
{
value: "function",
label: "路段",
},
{
value: "area",
label: "城区",
},
{
value: "city",
label: "市",
},
],
timeSlotOptions: [
{
value: "昼",
label: "昼",
},
{
value: "夜",
label: "夜",
},
],
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: {
model: this.where.model,
timeStart:
this.timeScope.length == 2
? this.timeScope[0].format("Y-M-D")
: null,
timeEnd:
this.timeScope.length == 2
? this.timeScope[1].format("Y-M-D")
: null,
timeSlot: this.where.timeSlot,
},
where: this.where,
});
let cloneColumns = _.cloneDeep(columns);
if (this.where.model == "area") {
this.columns = cloneColumns.filter((item) => {
return item.dataIndex != "place" && item.dataIndex != "function";
});
} else if (this.where.model == "function") {
this.columns = cloneColumns.filter((item) => {
return item.dataIndex != "place";
});
} else if (this.where.model == "city") {
this.columns = cloneColumns.filter((item) => {
return (
item.dataIndex != "place" &&
item.dataIndex != "function" &&
item.dataIndex != "area"
);
});
}
},
/* 重置搜索 */
reset() {
this.where = {
model: "area",
timeSlot: "",
};
this.this.timeScope = [];
this.where.year = this.yearOptions[0].value;
this.reload();
},
exportFile() {
let array = [
["测点", "路段", "城区", "路长", "路宽", "平均Leq", "平均SD"],
["功能区类别", "1类区域","", "2类区域","", "3类区域", "","4类区域","",],
["", "以居住、文教 为主的区域","", "居住、商业、工业混杂区","", "适用于工业区", "","交通干线道路 两侧区域","",],
["", "昼间","夜间", "昼间","夜间", "昼间", "夜间","昼间","夜间",],
];
this.data.forEach((d) => {
array.push([
d.place,
d.function,
d.area,
d.functionLength,
d.functionWidth,
d.avgLeq,
d.avgSD,
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: 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, "道路交通噪声统计表");
// 合并单元格
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());
},
},
};

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/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

@@ -5,7 +5,7 @@
<a-tab-pane key="base" tab="总览">
<base-statistic></base-statistic>
</a-tab-pane>
<a-tab-pane key="average" tab="平均">
<a-tab-pane key="average" tab="市达标率">
<average-statistic></average-statistic>
</a-tab-pane>
<!-- <a-tab-pane key="quarter" tab="季度报告">
@@ -27,8 +27,8 @@
*/
import BaseStatistic from "./base.vue";
// import QuarterStatistic from "./quarter.vue";
import Compare from "./compare.vue"
import AverageStatistic from "./average.vue"
import Compare from "./compare.vue";
import AverageStatistic from "./average.vue";
export default {
name: 'StatisticSoundFunction',