同比页
This commit is contained in:
167
src/views/sound/road/statistic/compare.vue
Normal file
167
src/views/sound/road/statistic/compare.vue
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
<template>
|
||||||
|
<div class="">
|
||||||
|
<ele-pro-table ref="table" row-key="id" :datasource="url" :columns="columns" :where="where" :needPage="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="modelOptions" v-model:value="where.model" placeholder="统计模块">
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<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>
|
||||||
|
</ele-pro-table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import _ from "lodash";
|
||||||
|
import XLSX from 'xlsx';
|
||||||
|
import {
|
||||||
|
pageRoadNoiseStatisticUrl
|
||||||
|
} from "@/api/ecology/road-sound"
|
||||||
|
const columns = [{
|
||||||
|
title: '测点',
|
||||||
|
dataIndex: 'place',
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '路段',
|
||||||
|
dataIndex: 'road',
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '城区',
|
||||||
|
dataIndex: 'area',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '市',
|
||||||
|
dataIndex: 'city',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
export default {
|
||||||
|
name: 'StatisticSoundRoadCompare',
|
||||||
|
components: {
|
||||||
|
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
url: pageRoadNoiseStatisticUrl,
|
||||||
|
data: [],
|
||||||
|
where: {
|
||||||
|
model: "place"
|
||||||
|
},
|
||||||
|
timeScope: [],
|
||||||
|
columns,
|
||||||
|
modelOptions: [{
|
||||||
|
value: "place",
|
||||||
|
label: "测点",
|
||||||
|
}, {
|
||||||
|
value: "road",
|
||||||
|
label: "路段",
|
||||||
|
}, {
|
||||||
|
value: "area",
|
||||||
|
label: "城区",
|
||||||
|
},{
|
||||||
|
value: "city",
|
||||||
|
label: "市"
|
||||||
|
}],
|
||||||
|
timeSlotOptions: [{
|
||||||
|
value: "昼",
|
||||||
|
label: "昼"
|
||||||
|
}, {
|
||||||
|
value: "夜",
|
||||||
|
label: "夜"
|
||||||
|
}]
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/* 刷新表格 */
|
||||||
|
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
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let cloneColumns = _.cloneDeep(columns);
|
||||||
|
if (this.where.model == "area") {
|
||||||
|
this.columns = cloneColumns.filter(item => {
|
||||||
|
return item.dataIndex != "place" && item.dataIndex != "road";
|
||||||
|
})
|
||||||
|
} else if (this.where.model == "road") {
|
||||||
|
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 != "road" && item.dataIndex != "area";
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/* 重置搜索 */
|
||||||
|
reset() {
|
||||||
|
this.where = {
|
||||||
|
model: "place",
|
||||||
|
timeSlot: "昼"
|
||||||
|
};
|
||||||
|
this.this.timeScope = []
|
||||||
|
|
||||||
|
this.reload();
|
||||||
|
},
|
||||||
|
exportFile() {
|
||||||
|
let array = [
|
||||||
|
['测点', '路段', '城区', '路长', '路宽', '平均Leq', '平均SD']
|
||||||
|
];
|
||||||
|
this.data.forEach(d => {
|
||||||
|
array.push([d.place, d.road, d.area, d.roadLength, d.roadWidth, d.avgLeq, d.avgSD]);
|
||||||
|
});
|
||||||
|
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, '道路交通噪声统计表');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -17,6 +17,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
import BaseStatistic from "./base.vue";
|
import BaseStatistic from "./base.vue";
|
||||||
import QuarterStatistic from "./quarter.vue";
|
import QuarterStatistic from "./quarter.vue";
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
<a-tab-pane tab="噪声信息" key="noise">
|
<a-tab-pane tab="噪声信息" key="noise">
|
||||||
<noise-bill ref="noise"></noise-bill>
|
<noise-bill ref="noise"></noise-bill>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane tab="其他信息" key="place">
|
<!-- <a-tab-pane tab="其他信息" key="place">
|
||||||
<place-bill ref="place"></place-bill>
|
<place-bill ref="place"></place-bill>
|
||||||
</a-tab-pane>
|
</a-tab-pane> -->
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
</a-card>
|
</a-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
import XLSX from 'xlsx';
|
import XLSX from 'xlsx';
|
||||||
import utils from "./utils";
|
import utils from "./utils";
|
||||||
import NoiseBill from "./noise-bill.vue";
|
import NoiseBill from "./noise-bill.vue";
|
||||||
import PlaceBill from "./place-bill.vue";
|
// import PlaceBill from "./place-bill.vue";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
saveZoneNoiseBill,
|
saveZoneNoiseBill,
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
name: "ZoneCollectIndex",
|
name: "ZoneCollectIndex",
|
||||||
components: {
|
components: {
|
||||||
NoiseBill,
|
NoiseBill,
|
||||||
PlaceBill
|
// PlaceBill
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
billName: sheetNames[0] + reportDate,
|
billName: sheetNames[0] + reportDate,
|
||||||
zoneNoiseList: billData
|
zoneNoiseList: billData
|
||||||
}).then(res=>{
|
}).then(res=>{
|
||||||
if(res.data.code === 1){
|
if(res.data.code != 0){
|
||||||
this.$message.error("表格格式有误,请检查后重新上传!");
|
this.$message.error("表格格式有误,请检查后重新上传!");
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
billName: sheetNames[1] + reportDate2,
|
billName: sheetNames[1] + reportDate2,
|
||||||
zoneNoiseList: billData2
|
zoneNoiseList: billData2
|
||||||
}).then(res=>{
|
}).then(res=>{
|
||||||
if(res.data.code === 1){
|
if(res.data.code != 0){
|
||||||
this.$message.error("表格格式有误,请检查后重新上传!");
|
this.$message.error("表格格式有误,请检查后重新上传!");
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|||||||
Reference in New Issue
Block a user