字典、统计

This commit is contained in:
weicw
2021-09-18 14:51:31 +08:00
parent 9c1f1c1b8c
commit f212f334ef
21 changed files with 3228 additions and 2319 deletions

View File

@@ -28,6 +28,10 @@ const getFunctionNoiseBill = function (id) {
} }
// -------------------------数据--------------------- // -------------------------数据---------------------
const pageFunctionNoiseUrl = '/sound/function/noise/page'; const pageFunctionNoiseUrl = '/sound/function/noise/page';
const listAllFunctionNoiseUrl = '/sound/function/noise';
const listAllFunctionNoise = function (params){
return axios.get(listAllFunctionNoiseUrl, {params})
}
// 添加 // 添加
const saveFunctionNoise = function (data) { const saveFunctionNoise = function (data) {
return axios.post("/sound/function/noise",data) return axios.post("/sound/function/noise",data)
@@ -79,6 +83,8 @@ export {
getHistoryyears, getHistoryyears,
getColumnOptions, getColumnOptions,
getGisBase, getGisBase,
getGisArea getGisArea,
listAllFunctionNoiseUrl,
listAllFunctionNoise
} }

View File

@@ -0,0 +1,32 @@
import axios from 'axios';
const baseUri = "/sound/zone/noiseLeqLevel";
const listAllUrl = baseUri + "";
// 添加
const saveLeqLevel = function (data) {
return axios.post("/sound/zone/noiseLeqLevel",data)
}
// 删除
const removeLeqLevel = function (id) {
return axios.delete(`/sound/zone/noiseLeqLevel/${id}`,)
}
// 批量删除
const removeBatchLeqLevel = function (ids) {
return axios.delete("/sound/zone/noiseLeqLevel/batch",{data:ids})
}
// 修改
const updateLeqLevel = function (data) {
return axios.put("/sound/zone/noiseLeqLevel",data)
}
export {
listAllUrl,
saveLeqLevel,
updateLeqLevel,
removeBatchLeqLevel,
removeLeqLevel
}

View File

@@ -0,0 +1,32 @@
import axios from 'axios';
const baseUri = "/sound/zone/place";
const listAllUrl = baseUri + "";
// 添加
const savePlace = function (data) {
return axios.post("/sound/zone/place",data)
}
// 删除
const removePlace = function (id) {
return axios.delete(`/sound/zone/place/${id}`,)
}
// 批量删除
const removeBatchPlace = function (ids) {
return axios.delete("/sound/zone/place/batch",{data:ids})
}
// 修改
const updatePlace = function (data) {
return axios.put("/sound/zone/place",data)
}
export {
listAllUrl,
savePlace,
updatePlace,
removeBatchPlace,
removePlace
}

View File

@@ -28,6 +28,10 @@ const getZoneNoiseBill = function (id) {
} }
// -------------------------数据--------------------- // -------------------------数据---------------------
const pageZoneNoiseUrl = '/sound/zone/noise/page'; const pageZoneNoiseUrl = '/sound/zone/noise/page';
const listAllZoneNoiseUrl = '/sound/zone/noise';
const listALlZoneNoise = function (params){
return axios.get(listAllZoneNoiseUrl,{params})
}
// 添加 // 添加
const saveZoneNoise = function (data) { const saveZoneNoise = function (data) {
return axios.post("/sound/zone/noise",data) return axios.post("/sound/zone/noise",data)
@@ -75,6 +79,7 @@ export {
getHistoryyears, getHistoryyears,
getColumnOptions, getColumnOptions,
statisticSourceUrl, statisticSourceUrl,
statisticYearUrl statisticYearUrl,
listALlZoneNoise
} }

View File

@@ -0,0 +1,46 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="place" tab="点位信息">
<place></place>
</a-tab-pane>
<a-tab-pane key="leqLevel" tab="Leq等级">
<leq-level></leq-level>
</a-tab-pane>
</a-tabs>
</a-card>
</div>
</template>
<script>
/**
*
*
*
*/
import LeqLevel from "./leq-level"
import Place from "./place"
export default {
name: 'ZoneNoiseDictIndex',
components: {
LeqLevel,
Place
},
data() {
return {
activeKey: 'place'
};
},
methods: {}
}
</script>
<style scoped>
</style>

View File

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

@@ -0,0 +1,334 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-modal
v-model:visible="showEdit"
:title="form.zoneNoisePlaceId !== undefined ? '修改' : '添加'"
:confirm-loading="loading"
:width="800"
: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="placeName">
<a-input v-model:value="form.placeName" placeholder="请输入测点名称" allow-clear />
</a-form-item>
<a-form-item label="点位编码" name="placeCode">
<a-input v-model:value="form.placeCode" placeholder="请输入点位编码" allow-clear />
</a-form-item>
<a-form-item label="测点经度" name="placeLng">
<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="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>
</a-modal>
<!-- 表格 -->
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="zoneNoisePlaceId"
: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,
savePlace,
updatePlace,
removePlace,
removeBatchPlace
} from "@/api/ecology/noise/zone-noise-place";
// import moment from "moment";
export default {
name: "ZoneNoisePlace",
components: {},
data() {
return {
data: [],
// 表格数据接口
url: listAllUrl,
selection: [],
// 表格列配置
columns: [
{
title: "测点名称",
dataIndex: "placeName",
sorter: true,
}, {
title: "点位编码",
dataIndex: "placeCode",
sorter: true,
},
{
title: "测点经度",
dataIndex: "placeLng",
sorter: true,
},
{
title: "测点纬度",
dataIndex: "placeLat",
sorter: true,
},
{
title: "测点参照物",
dataIndex: "refObj",
sorter: true,
},
{
title: "监测站名",
dataIndex: "station",
sorter: true,
},
{
title: "监测仪器型号",
dataIndex: "monitorInstrumentModel",
sorter: true,
},
{
title: "监测仪器编号",
dataIndex: "monitorInstrumentCode",
sorter: true,
},
{
title: "监测前校准值",
dataIndex: "beforeMonitorValue",
sorter: true,
},
{
title: "声校准器测量声压值",
dataIndex: "soundPressureValue",
sorter: true,
},
{
title: "声校准仪器型号",
dataIndex: "soundInstrumentModel",
sorter: true,
},
{
title: "声校准仪器编号",
dataIndex: "soundInstrumentCode",
sorter: true,
},
{
title: "操作",
key: "action",
width: 150,
align: "center",
fixed: "right",
slots: {
customRender: "action",
},
},
],
// 表格搜索条件
where: {},
// 表格选中数据
selectionList: [],
// 是否显示编辑弹窗
showEdit: false,
// 表单数据
form: {},
loading: false,
rules: {
placeName:[{required: true,message: '请输入测点名称'}],
placeCode:[{required: true,message: '请输入点位编码'}],
placeLng: [{required: true,message: '请输入测点经度',},],
placeLat: [{required: true,message: '请输入测点纬度',},],
},
};
},
mounted() {
},
methods: {
/* 刷新表格 */
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.zoneNoisePlaceId) {
updatePlace(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 {
savePlace(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);
removePlace(row.zoneNoisePlaceId).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.zoneNoisePlaceId);
removeBatchPlace(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

@@ -76,7 +76,7 @@ export default {
); );
// 解析成对象数组 // 解析成对象数组
const billName = aoa[0][0]; const billName = file.name;
const billData = utils.toObjData(functionNoiseList); const billData = utils.toObjData(functionNoiseList);
const billData2 = utils.toPlaceData(functionNoiseList2); const billData2 = utils.toPlaceData(functionNoiseList2);
@@ -163,7 +163,7 @@ export default {
}); });
// 解析成对象数组 // 解析成对象数组
const billName = aoa[0][0]; const billName = file.name;
const billData = utils.toAreaObjData(functionNoiseList); const billData = utils.toAreaObjData(functionNoiseList);
if (!billData || billData.length == 0) { if (!billData || billData.length == 0) {

View File

@@ -49,7 +49,7 @@ export default {
} }
if (row.indexL10 < row.indexL50 || row.indexL50 < row.indexL90) { if (row.indexL10 < row.indexL50 || row.indexL50 < row.indexL90) {
throw new Error(row.place + "数值有误" + `${row.indexL10},${row.indexL10},${row.indexL50},${row.indexL90}`) throw new Error(row.place + "数值有误" + `${row.indexLeq},${row.indexL10},${row.indexL50},${row.indexL90}`)
} }
return row; return row;
}) })
@@ -81,12 +81,12 @@ export default {
return excelData.map(item => { return excelData.map(item => {
const monitorTime = new Date(); const monitorTime = new Date();
monitorTime.setFullYear(item[1]); monitorTime.setFullYear(item[1]);
monitorTime.setMonth(item[14] - 1); monitorTime.setMonth(item[9] - 1);
monitorTime.setDate(item[15]); monitorTime.setDate(item[10]);
monitorTime.setHours(item[16]); monitorTime.setHours(item[11]);
monitorTime.setMinutes(item[17]); monitorTime.setMinutes(item[23]);
let quarter = 1; let quarter = 1;
const month = item[14] const month = item[9]
if (month < 4) { if (month < 4) {
quarter = 1 quarter = 1
} else if (month < 7) { } else if (month < 7) {

File diff suppressed because it is too large Load Diff

View File

@@ -11,9 +11,9 @@
<!-- <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="同比">-->
<compare></compare> <!-- <compare></compare>-->
</a-tab-pane> <!-- </a-tab-pane>-->
</a-tabs> </a-tabs>
</a-card> </a-card>
</div> </div>
@@ -27,7 +27,7 @@
*/ */
import BaseStatistic from "./base.vue"; import BaseStatistic from "./base.vue";
// import QuarterStatistic from "./quarter.vue"; // import QuarterStatistic from "./quarter.vue";
import Compare from "./compare.vue"; // import Compare from "./compare.vue";
import AverageStatistic from "./average.vue"; import AverageStatistic from "./average.vue";
export default { export default {
@@ -35,7 +35,7 @@
components: { components: {
BaseStatistic, BaseStatistic,
// QuarterStatistic, // QuarterStatistic,
Compare, // Compare,
AverageStatistic AverageStatistic
}, },
data() { data() {

View File

@@ -86,9 +86,9 @@ export default {
); );
// 解析成对象数组 // 解析成对象数组
const billName = aoa[0][0]; const billName = file.name;
const billData = utils.toObjData(roadNoiseList); const billData = utils.toObjData(roadNoiseList);
const billName2 = aoa2[0][0]; const billName2 = file.name;
const billData2 = utils.toObjData(roadNoiseList2); const billData2 = utils.toObjData(roadNoiseList2);
// 其他信息 // 其他信息
const billData3 = utils.toPlaceData(roadNoiseList3); const billData3 = utils.toPlaceData(roadNoiseList3);
@@ -199,7 +199,7 @@ export default {
); );
// 解析成对象数组 // 解析成对象数组
const billName = aoa[0][0]; const billName = file.name;
const billData = utils.toAreaObjData(roadNoiseList); const billData = utils.toAreaObjData(roadNoiseList);
if (!billData || billData.length == 0) { if (!billData || billData.length == 0) {

View File

@@ -605,7 +605,13 @@ export default {
listAll(this.where).then(res=>{ listAll(this.where).then(res=>{
if(res.data.code == 0){ if(res.data.code == 0){
res.data.data.forEach((d) => { res.data.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]); const td = columns.map((item) => {
let val = d[item.dataIndex];
if(["indexLeq","indexL10","indexL50","indexL90","indexLmax","indexLmin","indexSd"].includes(item.dataIndex)){
val = Number(val).toFixed(1);
}
return val;
});
arr.push(td); arr.push(td);
}); });
let sheet = XLSX.utils.aoa_to_sheet(arr); let sheet = XLSX.utils.aoa_to_sheet(arr);

View File

@@ -1,242 +1,244 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card style="width: 100%" :bordered="false"> <a-card style="width: 100%" :bordered="false">
<template #title> <template #title>
<a-space> <a-space>
<a-upload <a-upload
:before-upload="importFileCity" :before-upload="importFileCity"
:showUploadList="false" :showUploadList="false"
accept=".xls,.xlsx,.csv" accept=".xls,.xlsx,.csv"
> >
<a-button>市级导入</a-button> <a-button>市级导入</a-button>
</a-upload> </a-upload>
<!-- <a-upload <a-upload
:before-upload="importFileArea" :before-upload="importFileArea"
:showUploadList="false" :showUploadList="false"
accept=".xls,.xlsx,.csv" accept=".xls,.xlsx,.csv"
> >
<a-button>县级导入</a-button> <a-button>县级导入</a-button>
</a-upload> --> </a-upload>
</a-space> </a-space>
</template> </template>
<a-tabs v-model:activeKey="activeKey"> <a-tabs v-model:activeKey="activeKey">
<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-tabs> </a-tabs>
</a-card> </a-card>
</div> </div>
</template> </template>
<script> <script>
import XLSX from "xlsx"; import XLSX from "xlsx";
import utils from "./utils"; import utils from "./utils";
import { Modal } from "ant-design-vue"; import {Modal} from "ant-design-vue";
import NoiseBill from "./noise-bill.vue"; import NoiseBill from "./noise-bill.vue";
import { saveZoneNoiseBill } from "@/api/ecology/noise/zone-sound"; import {saveZoneNoiseBill} from "@/api/ecology/noise/zone-sound";
export default { export default {
name: "ZoneCollectIndex", name: "ZoneCollectIndex",
components: { components: {
NoiseBill, NoiseBill,
},
data() {
return {
activeKey: "noise",
};
},
methods: {
/* 导入本地excel文件 */
importFileCity(file) {
const hide = this.$message.loading("导入中..", 0);
let reader = new FileReader();
reader.onload = (e) => {
try {
let data = new Uint8Array(e.target.result);
let workbook = XLSX.read(data, {
type: "array",
});
//0.昼间数据 1.夜间数据 2.其他信息
let sheetNames = workbook.SheetNames;
// 解析成二维数组
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
header: 1,
});
let aoa2 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[1]], {
header: 1,
});
const reportDate = aoa[1][0].replace(/[^\d]+/g, "-");
const reportDate2 = aoa2[1][0].replace(/[^\d]+/g, "-");
const zoneNoiseList = aoa.filter(
(item) => {
return item.length >= 26 && typeof item[0] == "number"}
);
const zoneNoiseList2 = aoa2.filter(
(item) => item.length >= 26 && typeof item[0] == "number"
);
// 解析成对象数组
const billName = aoa[0][0];
const billData = utils.toObjData(zoneNoiseList);
const billName2 = aoa2[0][0];
const billData2 = utils.toObjData(zoneNoiseList2);
if (
(!billData || billData.length == 0) &&
(!billData2 || billData2.length == 0)
) {
hide()
Modal.error({
title: "导入失败",
content: "找不到数据",
});
return;
}
const tasks = [];
if (billData.length > 0) {
tasks.push(
saveZoneNoiseBill({
reportTime: new Date(reportDate).getTime(),
billName: billName,
regionLevel: "市级",
zoneNoiseList: billData,
})
);
}
if (billData2.length > 0) {
tasks.push(
saveZoneNoiseBill({
reportTime: new Date(reportDate2).getTime(),
billName: billName2,
regionLevel: "市级",
zoneNoiseList: billData2,
})
);
}
// 上传到服务器
Promise.all(tasks)
.then(() => {
Modal.success({
title: "导入成功",
content: `成功导入${billData.length + billData2.length}条数据`,
});
this.$refs.noise && this.$refs.noise.reload();
})
.catch(() => {
Modal.error({
title: "导入失败",
content: "数据上传出错",
});
})
.finally(() => {
hide();
});
} catch (error) {
hide();
Modal.error({
title: "导入失败",
content: error.message,
});
}
// console.log(billData);
};
reader.readAsArrayBuffer(file);
return false;
}, },
importFileArea(file) { data() {
const hide = this.$message.loading("导入中..", 0); return {
activeKey: "noise",
};
},
methods: {
/* 导入本地excel文件 */
importFileCity(file) {
const hide = this.$message.loading("导入中..", 0);
let reader = new FileReader(); let reader = new FileReader();
reader.onload = (e) => {
try {
let data = new Uint8Array(e.target.result);
let workbook = XLSX.read(data, {
type: "array",
});
//0.昼间数据 1.夜间数据 2.其他信息
let sheetNames = workbook.SheetNames;
// 解析成二维数组
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
header: 1,
});
let aoa2 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[1]], {
header: 1,
});
reader.onload = (e) => { const reportDate = aoa[1][0].replace(/[^\d]+/g, "-");
try { const reportDate2 = aoa2[1][0].replace(/[^\d]+/g, "-");
let data = new Uint8Array(e.target.result);
let workbook = XLSX.read(data, {
type: "array",
});
//0.昼间数据 1.夜间数据 2.其他信息
let sheetNames = workbook.SheetNames;
// 解析成二维数组
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
header: 1,
});
const reportDate = aoa[1][0].replace(/[^\d]+/g, "-"); const zoneNoiseList = aoa.filter(
const zoneNoiseList = aoa.filter( (item) => {
(item) => { return item.length >= 26 && typeof item[0] == "number"
}
);
const zoneNoiseList2 = aoa2.filter(
(item) => item.length >= 26 && typeof item[0] == "number"
);
return item.length >= 35 && item[0] != "行政区划代码"
}
);
// 解析成对象数组 // 解析成对象数组
const billName = aoa[0][0]; const billName = file.name;
const billData = utils.toAreaObjData(zoneNoiseList); const billData = utils.toObjData(zoneNoiseList);
const billName2 = file.name;
const billData2 = utils.toObjData(zoneNoiseList2);
if (
(!billData || billData.length == 0) &&
(!billData2 || billData2.length == 0)
) {
hide()
Modal.error({
title: "导入失败",
content: "找不到数据",
});
return;
}
if (!billData || billData.length == 0) { const tasks = [];
hide(); if (billData.length > 0) {
Modal.error({ tasks.push(
title: "导入失败", saveZoneNoiseBill({
content: "找不到可用数据", reportTime: new Date(reportDate).getTime(),
}); billName: billName,
regionLevel: "市级",
zoneNoiseList: billData,
})
);
}
return; if (billData2.length > 0) {
} tasks.push(
saveZoneNoiseBill({
reportTime: new Date(reportDate2).getTime(),
billName: billName2,
regionLevel: "市级",
zoneNoiseList: billData2,
})
);
}
if (billData.length > 0) { // 上传到服务器
// 上传到服务器
saveZoneNoiseBill({ Promise.all(tasks)
reportTime: new Date(reportDate).getTime(), .then(() => {
billName: billName, Modal.success({
regionLevel: "县级", title: "导入成功",
zoneNoiseList: billData, content: `成功导入${billData.length + billData2.length}条数据`,
}) });
.then((res) => { this.$refs.noise && this.$refs.noise.reload();
if (res.data.code == 0) { })
Modal.success({ .catch(() => {
title: "导入成功", Modal.error({
content: `成功导入${ title: "导入失败",
billData.length content: "数据上传出错",
}条数据`, });
}); })
this.$refs.noise && this.$refs.noise.reload(); .finally(() => {
} else { hide();
Modal.error({ });
title: "导入失败", } catch (error) {
content: "数据上传出错", hide();
}); Modal.error({
title: "导入失败",
content: error.message,
});
} }
}) // console.log(billData);
.catch(() => { };
Modal.error({ reader.readAsArrayBuffer(file);
title: "导入失败",
content: "数据上传出错", return false;
}); },
}) importFileArea(file) {
.finally(() => { const hide = this.$message.loading("导入中..", 0);
hide();
}); let reader = new FileReader();
}
} catch (error) { reader.onload = (e) => {
hide(); try {
Modal.error({ let data = new Uint8Array(e.target.result);
title: "导入失败", let workbook = XLSX.read(data, {
content: error.message, type: "array",
}); });
} //0.昼间数据 1.夜间数据 2.其他信息
// console.log(billData); let sheetNames = workbook.SheetNames;
}; // 解析成二维数组
reader.readAsArrayBuffer(file); let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
return false; header: 1,
});
const reportDate = aoa[1][0].replace(/[^\d]+/g, "-");
const zoneNoiseList = aoa.filter(
(item) => {
return item.length >= 28 && item[0] && !item[0].toString().includes("行政区划代码")
}
);
// 解析成对象数组
const billName = file.name;
const billData = utils.toAreaObjData(zoneNoiseList);
if (!billData || billData.length == 0) {
hide();
Modal.error({
title: "导入失败",
content: "找不到可用数据",
});
return;
}
if (billData.length > 0) {
// 上传到服务器
saveZoneNoiseBill({
reportTime: new Date(reportDate).getTime(),
billName: billName,
regionLevel: "县级",
zoneNoiseList: billData,
})
.then((res) => {
if (res.data.code == 0) {
Modal.success({
title: "导入成功",
content: `成功导入${
billData.length
}条数据`,
});
this.$refs.noise && this.$refs.noise.reload();
} else {
Modal.error({
title: "导入失败",
content: "数据上传出错",
});
}
})
.catch(() => {
Modal.error({
title: "导入失败",
content: "数据上传出错",
});
})
.finally(() => {
hide();
});
}
} catch (error) {
hide();
Modal.error({
title: "导入失败",
content: error.message,
});
}
// console.log(billData);
};
reader.readAsArrayBuffer(file);
return false;
},
}, },
},
}; };
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@@ -60,6 +60,7 @@ export default {
if (row.indexL10 < row.indexL50 || row.indexL50 < row.indexL90) { if (row.indexL10 < row.indexL50 || row.indexL50 < row.indexL90) {
throw new Error(row.place + "数值有误") throw new Error(row.place + "数值有误")
} }
// console.log(monitorTime)
return row; return row;
}) })
@@ -93,12 +94,12 @@ export default {
return excelData.map(item => { return excelData.map(item => {
const monitorTime = new Date(); const monitorTime = new Date();
monitorTime.setFullYear(item[1]); monitorTime.setFullYear(item[1]);
monitorTime.setMonth(item[14] - 1); monitorTime.setMonth(item[10] - 1);
monitorTime.setDate(item[15]); monitorTime.setDate(item[11]);
monitorTime.setHours(item[16]); monitorTime.setHours(item[12]);
monitorTime.setMinutes(item[17]); monitorTime.setMinutes(item[13]);
let quarter = 1; let quarter = 1;
const month = item[14] const month = item[10]
if (month < 4) { if (month < 4) {
quarter = 1 quarter = 1
} else if (month < 7) { } else if (month < 7) {
@@ -108,55 +109,49 @@ export default {
} else { } else {
quarter = 4 quarter = 4
} }
let timeSlot = "夜"; const row = {
if (item[16] >= 6 && item[16] <= 22) {
timeSlot = "昼"
}
const row = {
regionCode: item[0], regionCode: item[0],
regionLevel: "县级",
monitorYear: item[1], monitorYear: item[1],
placeCode: item[2], placeCode: item[2],
place: item[3], place: item[3],
placeLng: item[4], placeLng: item[4],
placeLat: item[5], placeLat: item[5],
road: item[6], reqObj: item[6],
roadLength: item[7], gridLength: item[7],
roadWidth: item[8], people: item[8],
motorway: item[9], functionCode: item[9],
motorwayType: item[10], monitorMonth: item[10],
motorwayLevel: item[11], monitorDay: item[11],
refObj: item[12], monitorHour: item[12],
people: item[13], monitorMinute: item[13],
monitorMonth: item[14], sourceCode: item[14],
monitorDay: item[15], indexLeq: item[15],
monitorHour: item[16], indexL10: item[16],
monitorMinute: item[17], indexL50: item[17],
smallTrafficFlow: item[18], indexL90: item[18],
largeTrafficFlow: item[19], indexLmax: item[19],
indexLeq: item[20], indexLmin: item[20],
indexL10: item[21], indexSd: item[21],
indexL50: item[22], station: item[22],
indexL90: item[23], monitorInstrumentModel: item[23],
indexLmax: item[24], monitorInstrumentCode: item[24],
indexLmin: item[25], beforeMonitorValue: item[25],
indexSd: item[26], afterMonitorValue: item[26],
station: item[27], soundPressureValue: item[27],
monitorInstrumentModel: item[28], soundInstrumentModel: item[28],
monitorInstrumentCode: item[29], soundInstrumentCode: item[29],
beforeMonitorValue: item[30],
afterMonitorValue: item[31],
soundPressureValue: item[32],
soundInstrumentModel: item[33],
soundInstrumentCode: item[34],
remark: item[35],
city: '南宁', city: '南宁',
timeSlot, regionLevel: "县级",
monitorTime: monitorTime.getTime(), monitorTime: monitorTime.getTime(),
quarter quarter
} }
if(row.indexL10 < row.indexL50 || row.indexL50 < row.indexL90){
if (row.monitorHour >= 6 && row.monitorHour < 22) {
row.timeSlot = "昼"
}else{
row.timeSlot = "夜"
}
if (row.indexL10 < row.indexL50 || row.indexL50 < row.indexL90) {
throw new Error(row.place + "数值有误") throw new Error(row.place + "数值有误")
} }
return row; return row;

View File

@@ -113,11 +113,11 @@ import {
updateLeqLevel, updateLeqLevel,
removeLeqLevel, removeLeqLevel,
removeBatchLeqLevel removeBatchLeqLevel
} from "@/api/ecology/noise/road-noise-leq-level"; } from "@/api/ecology/noise/zone-noise-leq-level";
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
// import moment from "moment"; // import moment from "moment";
export default { export default {
name: "RoadNoiseLeqLevel", name: "ZoneNoiseLeqLevel",
components: {}, components: {},
data() { data() {
return { return {

View File

@@ -3,7 +3,7 @@
<a-card :bordered="false"> <a-card :bordered="false">
<a-modal <a-modal
v-model:visible="showEdit" v-model:visible="showEdit"
:title="form.roadNoisePlaceId !== undefined ? '修改' : '添加'" :title="form.zoneNoisePlaceId !== undefined ? '修改' : '添加'"
:confirm-loading="loading" :confirm-loading="loading"
:width="800" :width="800"
:body-style="{ paddingBottom: '8px' }" :body-style="{ paddingBottom: '8px' }"
@@ -19,27 +19,22 @@
<a-form-item label="测点名称" name="placeName"> <a-form-item label="测点名称" name="placeName">
<a-input v-model:value="form.placeName" placeholder="请输入测点名称" allow-clear /> <a-input v-model:value="form.placeName" placeholder="请输入测点名称" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="点位编码" name="placeCode">
<a-input v-model:value="form.placeCode" placeholder="请输入点位编码" allow-clear />
</a-form-item>
<a-form-item label="测点经度" name="placeLng"> <a-form-item label="测点经度" name="placeLng">
<a-input v-model:value="form.placeLng" placeholder="请输入测点经度" allow-clear /> <a-input v-model:value="form.placeLng" placeholder="请输入测点经度" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="测点纬度" name="placeLat"> <a-form-item label="测点纬度" name="placeLat">
<a-input v-model:value="form.placeLat" placeholder="请输入测点纬度" allow-clear /> <a-input v-model:value="form.placeLat" placeholder="请输入测点纬度" allow-clear />
</a-form-item> </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-form-item label="测点参照物" name="refObj">
<a-input v-model:value="form.refObj" placeholder="请输入测点参照物" allow-clear /> <a-input v-model:value="form.refObj" placeholder="请输入测点参照物" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="道路覆盖人口(万人)" name="people"> <!-- <a-form-item label="网格覆盖人口(万人)" name="people">-->
<a-input v-model:value="form.people" placeholder="请输入道路覆盖人口(万人)" allow-clear /> <!-- <a-input v-model:value="form.people" placeholder="请输入网格覆盖人口(万人)" allow-clear />-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="监测站名" name="station"> <a-form-item label="监测站名" name="station">
<a-input v-model:value="form.station" placeholder="请输入监测站名" allow-clear /> <a-input v-model:value="form.station" placeholder="请输入监测站名" allow-clear />
</a-form-item> </a-form-item>
@@ -70,7 +65,7 @@
<ele-pro-table <ele-pro-table
v-model:selection="selectionList" v-model:selection="selectionList"
ref="table" ref="table"
row-key="roadNoisePlaceId" row-key="zoneNoisePlaceId"
:datasource="url" :datasource="url"
:columns="columns" :columns="columns"
:where="where" :where="where"
@@ -131,10 +126,10 @@ import {
updatePlace, updatePlace,
removePlace, removePlace,
removeBatchPlace removeBatchPlace
} from "@/api/ecology/noise/road-noise-place"; } from "@/api/ecology/noise/zone-noise-place";
// import moment from "moment"; // import moment from "moment";
export default { export default {
name: "RoadNoisePlace", name: "ZoneNoisePlace",
components: {}, components: {},
data() { data() {
return { return {
@@ -148,6 +143,10 @@ export default {
title: "测点名称", title: "测点名称",
dataIndex: "placeName", dataIndex: "placeName",
sorter: true, sorter: true,
}, {
title: "点位编码",
dataIndex: "placeCode",
sorter: true,
}, },
{ {
title: "测点经度", title: "测点经度",
@@ -159,31 +158,12 @@ export default {
dataIndex: "placeLat", dataIndex: "placeLat",
sorter: true, sorter: true,
}, },
{
title: "机动车车道数",
dataIndex: "motorway",
sorter: true,
},
{
title: "车道类别",
dataIndex: "motorwayType",
sorter: true,
},
{
title: "道路等级",
dataIndex: "motorwayLevel",
sorter: true,
},
{ {
title: "测点参照物", title: "测点参照物",
dataIndex: "refObj", dataIndex: "refObj",
sorter: true, sorter: true,
}, },
{
title: "道路覆盖人口(万人)",
dataIndex: "people",
sorter: true,
},
{ {
title: "监测站名", title: "监测站名",
dataIndex: "station", dataIndex: "station",
@@ -241,7 +221,8 @@ export default {
form: {}, form: {},
loading: false, loading: false,
rules: { rules: {
placeName:[{required: true,message: '请选择测点名称'}], placeName:[{required: true,message: '请输入测点名称'}],
placeCode:[{required: true,message: '请输入点位编码'}],
placeLng: [{required: true,message: '请输入测点经度',},], placeLng: [{required: true,message: '请输入测点经度',},],
placeLat: [{required: true,message: '请输入测点纬度',},], placeLat: [{required: true,message: '请输入测点纬度',},],
}, },
@@ -275,7 +256,7 @@ 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.roadNoisePlaceId) { if (form.zoneNoisePlaceId) {
updatePlace(form) updatePlace(form)
.then((res) => { .then((res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
@@ -314,7 +295,7 @@ export default {
/* 删除单个 */ /* 删除单个 */
remove(row) { remove(row) {
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
removePlace(row.roadNoisePlaceId).then((res) => { removePlace(row.zoneNoisePlaceId).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);
@@ -330,7 +311,7 @@ export default {
/* 批量删除 */ /* 批量删除 */
removeBatch() { removeBatch() {
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
const ids = this.selectionList.map((item) => item.roadNoisePlaceId); const ids = this.selectionList.map((item) => item.zoneNoisePlaceId);
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);

View File

@@ -1,211 +1,214 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card :bordered="false"> <a-card :bordered="false">
<!-- 搜索表单 --> <!-- 搜索表单 -->
<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" allowClear showSearch> <a-select v-model:value="where.year" allowClear showSearch>
<a-select-option <a-select-option
v-for="item in yearOptions" v-for="item in yearOptions"
:key="item.value" :key="item.value"
>{{ item.label }}</a-select-option >{{ item.label }}
> </a-select-option
</a-select> >
</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>
<!-- 表格 --> </a-form>
<ele-pro-table <!-- 表格 -->
v-model:selection="selectionList" <ele-pro-table
ref="table" v-model:selection="selectionList"
row-key="area" ref="table"
:datasource="url" row-key="area"
:columns="columns" :datasource="url"
:where="where" :columns="columns"
:needPage="false" :where="where"
:initLoad="false" :needPage="false"
:scroll="{ x: 'max-content' }" :initLoad="false"
@done="(d) => (data = d.data)" :scroll="{ x: 'max-content' }"
> @done="(d) => (data = d.data)"
</ele-pro-table> >
</a-card> </ele-pro-table>
</div> </a-card>
<!-- 编辑弹窗 --> </div>
<!-- 编辑弹窗 -->
</template> </template>
<script> <script>
// import _ from "lodash"; // import _ from "lodash";
import XLSX from "xlsx"; import XLSX from "xlsx";
import { pageZoneNoiseStatisticUrl, getColumnOptions } from "@/api/ecology/noise/zone-sound"; import {pageZoneNoiseStatisticUrl, getColumnOptions} from "@/api/ecology/noise/zone-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN"; import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
// import utils from "./utils"; // import utils from "./utils";
export default { export default {
name: "StatisticSoundZoneAverage", name: "StatisticSoundZoneAverage",
components: {}, components: {},
data() { data() {
return { return {
data: [], data: [],
locale, locale,
bill: {}, bill: {},
// 表格数据接口 // 表格数据接口
url: pageZoneNoiseStatisticUrl, url: pageZoneNoiseStatisticUrl,
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{ {
title: "噪声源分类", title: "噪声源分类",
dataIndex: "source", dataIndex: "source",
}, },
{ {
title: "测点数(个)", title: "测点数(个)",
dataIndex: "count", dataIndex: "count",
}, },
{ {
title: "声源占比(%", title: "声源占比(%",
dataIndex: "rate", dataIndex: "rate",
}, },
{ {
title: "时段", title: "时段",
dataIndex: "timeSlot", dataIndex: "timeSlot",
}, },
{ {
title: "监测结果", title: "监测结果",
children: [ children: [
{ {
title: "Leq", title: "Leq",
dataIndex: "leq", dataIndex: "leq",
}, },
{ {
title: "L10", title: "L10",
dataIndex: "l10", dataIndex: "l10",
}, },
{ {
title: "L50", title: "L50",
dataIndex: "l50", dataIndex: "l50",
}, },
{ {
title: "L90", title: "L90",
dataIndex: "l90", dataIndex: "l90",
}, },
], ],
}, },
], ],
// 表格搜索条件 // 表格搜索条件
where: {}, where: {},
yearOptions: [], yearOptions: [],
// 表格选中数据 // 表格选中数据
selectionList: [], 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();
});
}, },
/* 刷新表格 */ mounted() {
reload() { this.loadOptionData();
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,
});
}, },
/* 重置搜索 */ methods: {
reset() { /**获取下来框数据 */
this.reload(); loadOptionData() {
}, getColumnOptions("monitor_year").then((res) => {
exportFile() { this.yearOptions = res.data.data.map((item) => {
const columns = [ return {
{ label: item,
title: "噪声源分类", value: item,
dataIndex: "source", };
}, });
{ this.reload();
title: "测点数", });
dataIndex: "count",
},
{
title: "声源占比%",
dataIndex: "rate",
},
{
title: "时段",
dataIndex: "timeSlot",
}, },
/* 刷新表格 */
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",
customRender: ({text})=>{return Number(text).toFixed(1)}
{ })
title: "Leq", }
dataIndex: "leq",
})
this.columns = columns;
this.$refs.table.reload({
where: this.where,
});
}, },
{ /* 重置搜索 */
title: "L10", reset() {
dataIndex: "l10", this.reload();
}, },
{ exportFile() {
title: "L50", const columns = [
dataIndex: "l50", {
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());
}, },
{
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> </script>

View File

@@ -1,474 +1,530 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card :bordered="false"> <a-card :bordered="false">
<!-- 搜索表单 --> <!-- 搜索表单 -->
<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.regionLevel" allowClear showSearch> <a-select v-model:value="where.regionLevel" allowClear showSearch>
<a-select-option <a-select-option
v-for="(item) in regionLevelOptions" v-for="(item) in regionLevelOptions"
:key="item.value" :key="item.value"
>{{ item.label }}</a-select-option >{{ item.label }}
> </a-select-option
</a-select> >
</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.place" allowClear showSearch> <a-form-item label="年份:">
<a-select-option <a-select v-model:value="where.monitorYear" allowClear showSearch>
v-for="(item) in palceOptions" <a-select-option
:key="item.value" v-for="(item) in yearOptions"
>{{ item.label }}</a-select-option :key="item.value"
> >{{ item.label }}
</a-select> </a-select-option
</a-form-item> >
</a-col> </a-select>
</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.area" allowClear showSearch> <a-form-item label="季度:">
<a-select-option <a-select v-model:value="where.quarter" allowClear showSearch>
v-for="(item) in areaOptions" <a-select-option
:key="item.value" v-for="(item) in quarterOptions"
>{{ item.label }}</a-select-option :key="item.value"
> >{{ item.label }}
</a-select> </a-select-option
</a-form-item> >
</a-col> </a-select>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> </a-form-item>
<a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }"> </a-col>
<a-space> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-button type="primary" @click="reload">查询</a-button> <a-form-item label="城区">
<a-button @click="reset">重置</a-button> <a-select v-model:value="where.area" allowClear showSearch>
<a-button @click="exportFile">导出Excel</a-button> <a-select-option
</a-space> v-for="(item) in areaOptions"
</a-form-item> :key="item.value"
</a-col> >{{ item.label }}
</a-row> </a-select-option
</a-form> >
<!-- 表格 --> </a-select>
<ele-pro-table </a-form-item>
v-model:selection="selectionList" </a-col>
ref="table" <a-col :lg="6" :md="12" :sm="24" :xs="24">
row-key="zoneNoiseId" <a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }">
:datasource="url" <a-space>
:columns="columns" <a-button type="primary" @click="reload">查询</a-button>
:where="where" <a-button @click="reset">重置</a-button>
:scroll="{ x: 'max-content' }" <a-button @click="exportFile">导出Excel</a-button>
@done="(d) => (data = d.data)" </a-space>
> </a-form-item>
<template #Leq="{ text,record }"> </a-col>
<a-tag v-if="(record.timeSlot == '昼' && text <= 68) || (record.timeSlot == '夜' && text <= 58)" color="green">{{text}}</a-tag> </a-row>
<a-tag v-else-if="(record.timeSlot == '昼' && text > 68 && text <=70) || (record.timeSlot == '夜' && text > 58 && text <=60)" color="blue">{{text}}</a-tag> </a-form>
<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> <ele-pro-table
<a-tag v-else-if="(record.timeSlot == '昼' && text > 74 ) || (record.timeSlot == '夜' && text > 64)" color="red">{{text}}</a-tag> v-model:selection="selectionList"
<template v-else color="#FFF">{{text}}</template> ref="table"
</template> row-key="zoneNoiseId"
</ele-pro-table> :datasource="url"
</a-card> :columns="columns"
</div> :where="where"
<!-- 编辑弹窗 --> :scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
<template #Leq="{ text,record }">
<a-tag v-if="(record.timeSlot == '昼' && text <= 68) || (record.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>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template> </template>
<script> <script>
// import _ from "lodash"; // import _ from "lodash";
import XLSX from "xlsx"; import XLSX from "xlsx";
import { pageZoneNoiseUrl, getColumnOptions } from "@/api/ecology/noise/zone-sound"; import {pageZoneNoiseUrl, getColumnOptions,listALlZoneNoise} from "@/api/ecology/noise/zone-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN"; import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment"; import moment from "moment";
// import utils from "./utils"; // import utils from "./utils";
export default { export default {
name: "StatisticSoundZoneBase", name: "StatisticSoundZoneBase",
components: {}, components: {},
data() { data() {
return { return {
data: [], data: [],
locale, locale,
bill: {}, bill: {},
// 表格数据接口 // 表格数据接口
url: pageZoneNoiseUrl, url: pageZoneNoiseUrl,
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{ {
title: "监测日期", title: "监测日期",
dataIndex: "monitorTime", dataIndex: "monitorTime",
sorter: true, sorter: true,
customRender: ({text})=> moment(text,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm") customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
}, },
{ {
title: "测点名称", title: "测点名称",
dataIndex: "place", dataIndex: "place",
sorter: true, sorter: true,
}, },
{ {
title: "所属城区", title: "所属城区",
dataIndex: "area", dataIndex: "area",
sorter: true, sorter: true,
}, },
{ {
title: "网格长(米)", title: "网格长(米)",
dataIndex: "gridLength", dataIndex: "gridLength",
sorter: true, sorter: true,
}, },
{ {
title: "网格宽(米)", title: "网格宽(米)",
dataIndex: "gridWidth", dataIndex: "gridWidth",
sorter: true, sorter: true,
}, },
{ {
title: "网格点号", title: "网格点号",
dataIndex: "gridNo", dataIndex: "gridNo",
sorter: true, sorter: true,
}, },
{ {
title: "主要声源", title: "主要声源",
dataIndex: "source", dataIndex: "source",
sorter: true, sorter: true,
}, },
{ {
title: "时段", title: "时段",
dataIndex: "timeSlot", dataIndex: "timeSlot",
sorter: true, sorter: true,
}, },
// { // {
// title: '月', // title: '月',
// dataIndex: 'monitorMonth', // dataIndex: 'monitorMonth',
// sorter: true // sorter: true
// }, // },
// { // {
// title: '日', // title: '日',
// dataIndex: 'monitorDay', // dataIndex: 'monitorDay',
// sorter: true // sorter: true
// }, // },
// { // {
// title: '时', // title: '时',
// dataIndex: 'monitorHour', // dataIndex: 'monitorHour',
// sorter: true // sorter: true
// }, // },
// { // {
// title: '分', // title: '分',
// dataIndex: 'monitorMinute', // dataIndex: 'monitorMinute',
// sorter: true // sorter: true
// }, // },
{ {
title: "LeqdB(A)", title: "LeqdB(A)",
dataIndex: "indexLeq", dataIndex: "indexLeq",
slots: {customRender: "Leq"}, slots: {customRender: "Leq"},
sorter: true, sorter: true,
}, },
{ {
title: "SDdB(A)", title: "SDdB(A)",
dataIndex: "indexSd", dataIndex: "indexSd",
sorter: true, sorter: true,
}, },
{ {
title: "L10dB(A)", title: "L10dB(A)",
dataIndex: "indexL10", dataIndex: "indexL10",
sorter: true, sorter: true,
}, },
{ {
title: "L50dB(A)", title: "L50dB(A)",
dataIndex: "indexL50", dataIndex: "indexL50",
sorter: true, sorter: true,
}, },
{ {
title: "L90dB(A)", title: "L90dB(A)",
dataIndex: "indexL90", dataIndex: "indexL90",
sorter: true, sorter: true,
}, },
{ {
title: "LmindB(A)", title: "LmindB(A)",
dataIndex: "indexLmin", dataIndex: "indexLmin",
sorter: true, sorter: true,
}, },
{ {
title: "LmaxdB(A)", title: "LmaxdB(A)",
dataIndex: "indexLmax", dataIndex: "indexLmax",
sorter: true, sorter: true,
}, },
{ {
title: "监测站名", title: "监测站名",
dataIndex: "station", dataIndex: "station",
sorter: true, sorter: true,
}, },
{ {
title: "监测仪器型号", title: "监测仪器型号",
dataIndex: "monitorInstrumentModel", dataIndex: "monitorInstrumentModel",
sorter: true, sorter: true,
}, },
{ {
title: "监测仪器编号", title: "监测仪器编号",
dataIndex: "monitorInstrumentCode", dataIndex: "monitorInstrumentCode",
sorter: true, sorter: true,
}, },
{ {
title: "监测前校准值", title: "监测前校准值",
dataIndex: "beforeMonitorValue", dataIndex: "beforeMonitorValue",
sorter: true, sorter: true,
}, },
{ {
title: "声校准器测量声压值", title: "声校准器测量声压值",
dataIndex: "soundPressureValue", dataIndex: "soundPressureValue",
sorter: true, sorter: true,
}, },
{ {
title: "声校准仪器型号", title: "声校准仪器型号",
dataIndex: "soundInstrumentModel", dataIndex: "soundInstrumentModel",
sorter: true, sorter: true,
}, },
{ {
title: "声校准仪器编号", title: "声校准仪器编号",
dataIndex: "soundInstrumentCode", dataIndex: "soundInstrumentCode",
sorter: true, sorter: true,
}, },
{ {
title: "区域等级", title: "区域等级",
dataIndex: "regionLevel", dataIndex: "regionLevel",
sorter: true, sorter: true,
}, },
{ {
title: "备注", title: "备注",
dataIndex: "remark", dataIndex: "remark",
sorter: true, sorter: true,
}, },
{ {
title: "创建人", title: "创建人",
dataIndex: "username", dataIndex: "username",
sorter: true, sorter: true,
}, },
], ],
palceOptions: [], palceOptions: [],
areaOptions: [], yearOptions:[],
regionLevelOptions: [], quarterOptions:[],
// 表格搜索条件 areaOptions: [],
where: { regionLevelOptions: [],
checked: 1, // 表格搜索条件
}, where: {
// 表格选中数据 checked: 1,
selectionList: [], },
}; // 表格选中数据
}, selectionList: [],
mounted() { };
this.loadOptionData();
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("place").then((res) => {
this.palceOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("area").then((res) => {
this.areaOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("region_level").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
}, },
/* 刷新表格 */ mounted() {
reload() { this.loadOptionData();
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("place").then((res) => {
this.palceOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("area").then((res) => {
this.areaOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("region_level").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("monitor_year").then((res) => {
this.yearOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("quarter").then((res) => {
this.quarterOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
},
/* 刷新表格 */
reload() {
this.$refs.table.reload({ this.$refs.table.reload({
where: this.where, where: this.where,
}); });
},
/* 重置搜索 */
reset() {
this.where = {
checked: 1,
};
this.reload();
},
exportFile() {
const columns = [
{
title: "行政区划代码",
dataIndex: "regionCode",
sorter: true,
},
{
title: "监测年度",
dataIndex: "monitorYear",
sorter: true,
},
{
title: "点位编码",
dataIndex: "placeCode",
sorter: true,
},
{
title: "测点名称",
dataIndex: "place",
sorter: true,
},
{
title: "测点经度",
dataIndex: "placeLng",
sorter: true,
},
{
title: "测点纬度",
dataIndex: "placeLat",
sorter: true,
},
{
title: "测点参照物",
dataIndex: "refObj",
sorter: true,
},
{
title: "网格边长",
dataIndex: "gridLength",
sorter: true,
},
{
title: "网格覆盖人口(万)",
dataIndex: "people",
sorter: true,
},
{
title: "功能区代码",
dataIndex: "functionCode",
sorter: true,
},
{
title: "月",
dataIndex: "monitorMonth",
sorter: true,
},
{
title: "日",
dataIndex: "monitorDay",
sorter: true,
},
{
title: "时",
dataIndex: "monitorHour",
sorter: true,
},
{
title: "分",
dataIndex: "monitorMinute",
sorter: true,
},
{
title: "Leq",
dataIndex: "indexLeq",
sorter: true,
},
{
title: "L10",
dataIndex: "indexL10",
sorter: true,
},
{
title: "L50",
dataIndex: "indexL50",
sorter: true,
},
{
title: "L90",
dataIndex: "indexL90",
sorter: true,
},
{
title: "最大值",
dataIndex: "indexLmax",
sorter: true,
},
{
title: "最小值",
dataIndex: "indexLmin",
sorter: true,
},
{
title: "标准差(SD)",
dataIndex: "indexSd",
sorter: true,
},
{
title: "监测站名",
dataIndex: "station",
sorter: true,
},
{
title: "监测仪器型号",
dataIndex: "monitorInstrumentModel",
sorter: true,
},
{
title: "监测仪器编号",
dataIndex: "monitorInstrumentCode",
sorter: true,
},
{
title: "监测前校准值",
dataIndex: "beforeMonitorValue",
sorter: true,
},
{
title: "声校准器测量声压值",
dataIndex: "soundPressureValue",
sorter: true,
},
{
title: "声校准仪器型号",
dataIndex: "soundInstrumentModel",
sorter: true,
},
{
title: "声校准仪器编号",
dataIndex: "soundInstrumentCode",
sorter: true,
},
{
title: "区域等级",
dataIndex: "regionLevel",
sorter: true,
},
{
title: "备注",
dataIndex: "remark",
sorter: true,
},
];
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
listALlZoneNoise(this.where).then(res=>{
res.data.data.forEach((d) => {
const td = columns.map((item) => {
let val = d[item.dataIndex];
if(["indexLeq","indexL10","indexL50","indexL90","indexLmax","indexLmin","indexSd"].includes(item.dataIndex)){
val = Number(val).toFixed(1);
}
return val;
});
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
})
},
}, },
/* 重置搜索 */
reset() {
this.where = {
checked: 1,
};
this.reload();
},
exportFile() {
const columns = [
{
title: "行政区划代码",
dataIndex: "regionCode",
sorter: true,
},
{
title: "监测年度",
dataIndex: "monitorYear",
sorter: true,
},
{
title: "点位编码",
dataIndex: "placeCode",
sorter: true,
},
{
title: "测点名称",
dataIndex: "place",
sorter: true,
},
{
title: "测点经度",
dataIndex: "placeLng",
sorter: true,
},
{
title: "测点纬度",
dataIndex: "placeLat",
sorter: true,
},
{
title: "测点参照物",
dataIndex: "refObj",
sorter: true,
},
{
title: "网格边长",
dataIndex: "gridLength",
sorter: true,
},
{
title: "网格覆盖人口(万)",
dataIndex: "people",
sorter: true,
},
{
title: "功能区代码",
dataIndex: "functionCode",
sorter: true,
},
{
title: "月",
dataIndex: "monitorMonth",
sorter: true,
},
{
title: "日",
dataIndex: "monitorDay",
sorter: true,
},
{
title: "时",
dataIndex: "monitorHour",
sorter: true,
},
{
title: "分",
dataIndex: "monitorMinute",
sorter: true,
},
{
title: "Leq",
dataIndex: "indexLeq",
sorter: true,
},
{
title: "L10",
dataIndex: "indexL10",
sorter: true,
},
{
title: "L50",
dataIndex: "indexL50",
sorter: true,
},
{
title: "L90",
dataIndex: "indexL90",
sorter: true,
},
{
title: "最大值",
dataIndex: "indexLmax",
sorter: true,
},
{
title: "最小值",
dataIndex: "indexLmin",
sorter: true,
},
{
title: "标准差(SD)",
dataIndex: "indexSd",
sorter: true,
},
{
title: "监测站名",
dataIndex: "station",
sorter: true,
},
{
title: "监测仪器型号",
dataIndex: "monitorInstrumentModel",
sorter: true,
},
{
title: "监测仪器编号",
dataIndex: "monitorInstrumentCode",
sorter: true,
},
{
title: "监测前校准值",
dataIndex: "beforeMonitorValue",
sorter: true,
},
{
title: "声校准器测量声压值",
dataIndex: "soundPressureValue",
sorter: true,
},
{
title: "声校准仪器型号",
dataIndex: "soundInstrumentModel",
sorter: true,
},
{
title: "声校准仪器编号",
dataIndex: "soundInstrumentCode",
sorter: true,
},
{
title: "区域等级",
dataIndex: "regionLevel",
sorter: true,
},
{
title: "备注",
dataIndex: "remark",
sorter: true,
},
];
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> </script>

View File

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