字典,统计

This commit is contained in:
weicw
2021-09-15 18:38:16 +08:00
parent c18e732ef4
commit 9c1f1c1b8c
68 changed files with 3856 additions and 779 deletions

View File

@@ -33,7 +33,7 @@ import XLSX from "xlsx";
import utils from "./utils";
import { Modal } from "ant-design-vue";
import NoiseBill from "./noise-bill.vue";
import { saveFunctionNoiseBill } from "@/api/ecology/function-sound";
import { saveFunctionNoiseBill } from "@/api/ecology/noise/function-sound";
export default {
name: "FunctionCollectIndex",
components: {

View File

@@ -112,7 +112,7 @@
removeBatchFunctionNoiseBill,
updateFunctionNoiseBill,
verifyFunctionNoiseBill
} from "@/api/ecology/function-sound";
} from "@/api/ecology/noise/function-sound";
import moment from "moment";
export default {
name: 'FunctionCollectNoiseBill',

View File

@@ -391,7 +391,7 @@ import {
updateFunctionNoise,
getFunctionNoiseBill,
getColumnOptions,
} from "@/api/ecology/function-sound";
} from "@/api/ecology/noise/function-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
// import utils from "./utils";

View File

@@ -0,0 +1,297 @@
<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="functionType">
<a-input
v-model:value="form.functionType"
placeholder="请输入功能区类别"
allow-clear
/>
</a-form-item>
<a-form-item label="功能区代码" name="functionCode">
<a-input
v-model:value="form.functionCode"
placeholder="请输入功能区代码"
allow-clear
/>
</a-form-item>
<a-form-item label="父级功能区类别" name="ParentFunctionType">
<a-input
v-model:value="form.ParentFunctionType"
placeholder="请输入父级功能区类别"
allow-clear
/>
</a-form-item>
<a-form-item label="昼间限值" name="maxLd">
<a-input-number :step="1" :precision="0" v-model:value="form.maxLd" />
</a-form-item>
<a-form-item label="夜间限值" name="maxLn">
<a-input-number :step="1" :precision="0" v-model:value="form.maxLn" />
</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,
saveFunctionType,
updateFunctionType,
removeFunctionType,
removeBatchFunctionType
} from "@/api/ecology/noise/function-noise-function-type";
// import moment from "moment";
export default {
name: "FunctionNoiseFunctionType",
components: {},
data() {
return {
data: [],
// 表格数据接口
url: listAllUrl,
selection: [],
// 表格列配置
columns: [
{
title: "功能区类别",
dataIndex: "functionType",
},
{
title: "功能区代码",
dataIndex: "functionCode",
},
{
title: "父级功能区类别",
dataIndex: "parentFunctionType",
},
{
title: "昼间限值",
dataIndex: "maxLd",
customRender: ({text})=>{
return text!=undefined? text.toFixed(0):undefined
}
},
{
title: "夜间限值",
dataIndex: "maxLn",
customRender: ({text})=>{
return text!=undefined? text.toFixed(0):undefined
}
},
{
title: "排序",
dataIndex: "sortNumber",
},
{
title: "操作",
key: "action",
width: 150,
align: "center",
fixed: "right",
slots: {
customRender: "action",
},
},
],
// 表格搜索条件
where: {},
// 表格选中数据
selectionList: [],
// 是否显示编辑弹窗
showEdit: false,
// 表单数据
form: {},
loading: false,
rules: {
functionType:[{required: true,message: '请输入功能区类别'}],
functionCode:[{required: true,message: '请输入功能区代码'}],
maxLd: [{required: true,message: '请输入昼间限值',},],
maxLn: [{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 hide = this.$message.loading('请求中..', 0);
const form = this.form;
if (form.id) {
updateFunctionType(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 {
saveFunctionType(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);
removeFunctionType(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);
removeBatchFunctionType(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,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="功能区类别信息">
<function-type></function-type>
</a-tab-pane>
</a-tabs>
</a-card>
</div>
</template>
<script>
/**
*
*
*
*/
import FunctionType from "./function-type"
import Place from "./place"
export default {
name: 'FunctionNoiseDictIndex',
components: {
FunctionType,
Place
},
data() {
return {
activeKey: 'place'
};
},
methods: {}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,349 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-modal
v-model:visible="showEdit"
:title="form.roadNoisePlaceId !== 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="placeHeight">
<a-input v-model:value="form.placeHeight" placeholder="请输入测点高度" allow-clear />
</a-form-item>
<a-form-item label="功能区类型" name="functionType">
<a-input v-model:value="form.functionType" placeholder="请输入功能区类型" allow-clear />
</a-form-item>
<a-form-item label="功能区代码" name="functionCode">
<a-input v-model:value="form.functionCode" 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="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="functionNoisePlaceId"
: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/function-noise-place";
// import moment from "moment";
export default {
name: "FunctionNoisePlace",
components: {},
data() {
return {
data: [],
// 表格数据接口
url: listAllUrl,
selection: [],
// 表格列配置
columns: [
{
title: "测点名称",
dataIndex: "placeName",
sorter: true,
},
{
title: "点位编码",
dataIndex: "placeCode",
sorter: true,
},
{
title: "功能区类别",
dataIndex: "functionType",
sorter: true,
},
{
title: "功能区代码",
dataIndex: "functionCode",
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: '请选择测点名称'}],
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.functionNoisePlaceId) {
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.functionNoisePlaceId).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.functionNoisePlaceId);
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

@@ -63,7 +63,7 @@ import XLSX from "xlsx";
import {
pageFunctionNoiseStatisticUrl,
getColumnOptions,
} from "@/api/ecology/function-sound";
} from "@/api/ecology/noise/function-sound";
const columns = [
{
title: "功能区类别",

View File

@@ -91,7 +91,7 @@
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import { pageFunctionNoiseUrl, getColumnOptions } from "@/api/ecology/function-sound";
import { pageFunctionNoiseUrl, getColumnOptions } from "@/api/ecology/noise/function-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
// import utils from "./utils";

View File

@@ -106,7 +106,7 @@ import XLSX from "xlsx";
import {
pageFunctionNoiseCompare,
getHistoryyears,
} from "@/api/ecology/function-sound";
} from "@/api/ecology/noise/function-sound";
export default {
name: "StatisticSoundFunctionCompare",
components: {},

View File

@@ -63,7 +63,7 @@ import XLSX from "xlsx";
import {
pageFunctionNoiseStatisticUrl,
getColumnOptions,
} from "@/api/ecology/function-sound";
} from "@/api/ecology/noise/function-sound";
const columns = [
{
title: "功能区类别",

View File

@@ -47,7 +47,7 @@ import XLSX from "xlsx";
import {
pageFunctionNoiseCompare,
getHistoryyears,
} from "@/api/ecology/function-sound";
} from "@/api/ecology/noise/function-sound";
export default {
name: "StatisticSoundFunctionCompare",
components: {},

View File

@@ -1,263 +1,264 @@
<template>
<div class="ele-body">
<a-card style="width: 100%" :bordered="false">
<template #title>
<a-space>
<a-upload
:before-upload="importFileCity"
:showUploadList="false"
accept=".xls,.xlsx,.csv"
>
<a-button>市级导入</a-button>
</a-upload>
<a-upload
:before-upload="importFileArea"
:showUploadList="false"
accept=".xls,.xlsx,.csv"
>
<a-button>县级导入</a-button>
</a-upload>
</a-space>
</template>
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane tab="噪声信息" key="noise">
<noise-bill ref="noise"></noise-bill>
</a-tab-pane>
</a-tabs>
</a-card>
</div>
<div class="ele-body">
<a-card style="width: 100%" :bordered="false">
<template #title>
<a-space>
<a-upload
:before-upload="importFileCity"
:showUploadList="false"
accept=".xls,.xlsx,.csv"
>
<a-button>市级导入</a-button>
</a-upload>
<a-upload
:before-upload="importFileArea"
:showUploadList="false"
accept=".xls,.xlsx,.csv"
>
<a-button>县级导入</a-button>
</a-upload>
</a-space>
</template>
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane tab="噪声信息" key="noise">
<noise-bill ref="noise"></noise-bill>
</a-tab-pane>
</a-tabs>
</a-card>
</div>
</template>
<script>
import XLSX from "xlsx";
import utils from "./utils";
import { Modal } from "ant-design-vue";
import {Modal} from "ant-design-vue";
import NoiseBill from "./noise-bill.vue";
import { saveRoadNoiseBill } from "@/api/ecology/road-sound";
import {saveRoadNoiseBill} from "@/api/ecology/noise/road-sound";
export default {
name: "RoadCollectIndex",
components: {
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,
});
let aoa3 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[2]], {
header: 1,
});
const reportDate = aoa[1][0].replace(/[^\d]+/g, "-");
const reportDate2 = aoa2[1][0].replace(/[^\d]+/g, "-");
const roadNoiseList = aoa.filter(
(item) => {
console.log(item.length)
return item.length >= 21 && typeof item[0] == "number"}
);
const roadNoiseList2 = aoa2.filter(
(item) => item.length >= 21 && typeof item[0] == "number"
);
const roadNoiseList3 = aoa3.filter(
(item) => item.length >= 16 && typeof item[1] == "number"
);
// 解析成对象数组
const billName = aoa[0][0];
const billData = utils.toObjData(roadNoiseList);
const billName2 = aoa2[0][0];
const billData2 = utils.toObjData(roadNoiseList2);
// 其他信息
const billData3 = utils.toPlaceData(roadNoiseList3);
if (
(!billData || billData.length == 0) &&
(!billData2 || billData2.length == 0)
) {
hide()
Modal.error({
title: "导入失败",
content: "找不到数据",
});
return;
}
const tasks = [];
if (billData.length > 0) {
billData.forEach((item) => {
Object.assign(
item,
billData3.find((b3Item) => b3Item.place == item.place)
);
});
tasks.push(
saveRoadNoiseBill({
reportTime: new Date(reportDate).getTime(),
billName: billName,
regionLevel: "市级",
roadNoiseList: billData,
})
);
}
if (billData2.length > 0) {
billData.forEach((item) => {
Object.assign(
item,
billData3.find((b3Item) => b3Item.place == item.place)
);
});
tasks.push(
saveRoadNoiseBill({
reportTime: new Date(reportDate2).getTime(),
billName: billName2,
regionLevel: "市级",
roadNoiseList: billData2,
})
);
}
// 上传到服务器
Promise.all(tasks)
.then(() => {
Modal.success({
title: "导入成功",
content: `成功导入${billData.length + billData2.length}条数据`,
});
this.$refs.noise && this.$refs.noise.reload();
this.$refs.place && this.$refs.place.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;
name: "RoadCollectIndex",
components: {
NoiseBill,
},
importFileArea(file) {
const hide = this.$message.loading("导入中..", 0);
data() {
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,
});
let aoa3 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[2]], {
header: 1,
});
const reportDate = aoa[1][0].replace(/[^\d]+/g, "-");
const reportDate2 = aoa2[1][0].replace(/[^\d]+/g, "-");
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,
});
const roadNoiseList = aoa.filter(
(item) => {
console.log(item.length)
return item.length >= 21 && typeof item[0] == "number"
}
);
const roadNoiseList2 = aoa2.filter(
(item) => item.length >= 21 && typeof item[0] == "number"
);
const roadNoiseList3 = aoa3.filter(
(item) => item.length >= 16 && typeof item[1] == "number"
);
const reportDate = aoa[1][0].replace(/[^\d]+/g, "-");
const roadNoiseList = aoa.filter(
(item) => {
// 解析成对象数组
const billName = aoa[0][0];
const billData = utils.toObjData(roadNoiseList);
const billName2 = aoa2[0][0];
const billData2 = utils.toObjData(roadNoiseList2);
// 其他信息
const billData3 = utils.toPlaceData(roadNoiseList3);
if (
(!billData || billData.length == 0) &&
(!billData2 || billData2.length == 0)
) {
hide()
Modal.error({
title: "导入失败",
content: "找不到数据",
});
return;
}
return item.length >= 35 && item[0] != "行政区划代码"
}
);
const tasks = [];
if (billData.length > 0) {
billData.forEach((item) => {
Object.assign(
item,
billData3.find((b3Item) => b3Item.place == item.place)
);
});
tasks.push(
saveRoadNoiseBill({
reportTime: new Date(reportDate).getTime(),
billName: billName,
regionLevel: "市级",
roadNoiseList: billData,
})
);
}
// 解析成对象数组
const billName = aoa[0][0];
const billData = utils.toAreaObjData(roadNoiseList);
if (billData2.length > 0) {
billData.forEach((item) => {
Object.assign(
item,
billData3.find((b3Item) => b3Item.place == item.place)
);
});
tasks.push(
saveRoadNoiseBill({
reportTime: new Date(reportDate2).getTime(),
billName: billName2,
regionLevel: "市级",
roadNoiseList: billData2,
})
);
}
if (!billData || billData.length == 0) {
hide();
Modal.error({
title: "导入失败",
content: "找不到可用数据",
});
// 上传到服务器
return;
}
if (billData.length > 0) {
// 上传到服务器
saveRoadNoiseBill({
reportTime: new Date(reportDate).getTime(),
billName: billName,
regionLevel: "县级",
roadNoiseList: 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: "数据上传出错",
});
Promise.all(tasks)
.then(() => {
Modal.success({
title: "导入成功",
content: `成功导入${billData.length + billData2.length}条数据`,
});
this.$refs.noise && this.$refs.noise.reload();
this.$refs.place && this.$refs.place.reload();
})
.catch(() => {
Modal.error({
title: "导入失败",
content: "数据上传出错",
});
})
.finally(() => {
hide();
});
} catch (error) {
hide();
Modal.error({
title: "导入失败",
content: error.message,
});
}
})
.catch(() => {
Modal.error({
title: "导入失败",
content: "数据上传出错",
});
})
.finally(() => {
hide();
});
}
} catch (error) {
hide();
Modal.error({
title: "导入失败",
content: error.message,
});
}
// console.log(billData);
};
reader.readAsArrayBuffer(file);
return false;
// console.log(billData);
};
reader.readAsArrayBuffer(file);
return false;
},
importFileArea(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,
});
// const reportDate = aoa[1][0].replace(/[^\d]+/g, "-");
const roadNoiseList = aoa.filter(
(item) => {
return item.length >= 35 && item[0] && !item[0].toString().includes("行政区划代码")
// return item.length >= 35 && item[0] != "行政区划代码"
}
);
// 解析成对象数组
const billName = aoa[0][0];
const billData = utils.toAreaObjData(roadNoiseList);
if (!billData || billData.length == 0) {
hide();
Modal.error({
title: "导入失败",
content: "找不到可用数据",
});
return;
}
if (billData.length > 0) {
// 上传到服务器
saveRoadNoiseBill({
// reportTime: new Date(reportDate).getTime(),
billName: billName,
regionLevel: "县级",
roadNoiseList: 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>

View File

@@ -111,7 +111,7 @@
removeBatchRoadNoiseBill,
updateRoadNoiseBill,
verifyRoadNoiseBill
} from "@/api/ecology/road-sound";
} from "@/api/ecology/noise/road-sound";
import moment from "moment";
export default {
name: 'RoadCollectNoiseBill',

View File

@@ -465,7 +465,7 @@ import {
updateRoadNoise,
getRoadNoiseBill,
getColumnOptions,
} from "@/api/ecology/road-sound";
} from "@/api/ecology/noise/road-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
// import utils from "./utils";
@@ -487,6 +487,9 @@ export default {
title: "监测日期",
dataIndex: "monitorTime",
sorter: true,
customRender: ({text})=>{
return moment(text).format("Y-M-D H:m")
}
},
{
title: "测点名称",

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: 'RoadNoiseDictIndex',
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/road-noise-leq-level";
import { message } from 'ant-design-vue';
// import moment from "moment";
export default {
name: "RoadNoiseLeqLevel",
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,353 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-modal
v-model:visible="showEdit"
:title="form.roadNoisePlaceId !== 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="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="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-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="roadNoisePlaceId"
: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/road-noise-place";
// import moment from "moment";
export default {
name: "RoadNoisePlace",
components: {},
data() {
return {
data: [],
// 表格数据接口
url: listAllUrl,
selection: [],
// 表格列配置
columns: [
{
title: "测点名称",
dataIndex: "placeName",
sorter: true,
},
{
title: "测点经度",
dataIndex: "placeLng",
sorter: true,
},
{
title: "测点纬度",
dataIndex: "placeLat",
sorter: true,
},
{
title: "机动车车道数",
dataIndex: "motorway",
sorter: true,
},
{
title: "车道类别",
dataIndex: "motorwayType",
sorter: true,
},
{
title: "道路等级",
dataIndex: "motorwayLevel",
sorter: true,
},
{
title: "测点参照物",
dataIndex: "refObj",
sorter: true,
},
{
title: "道路覆盖人口(万人)",
dataIndex: "people",
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: '请选择测点名称'}],
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.roadNoisePlaceId) {
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.roadNoisePlaceId).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.roadNoisePlaceId);
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

@@ -96,7 +96,7 @@
<script>
import _ from "lodash";
import XLSX from "xlsx";
import { pageRoadNoiseStatisticUrl } from "@/api/ecology/road-sound";
import { pageRoadNoiseStatisticUrl } from "@/api/ecology/noise/road-sound";
const columns = [
{
title: "城区",

View File

@@ -5,7 +5,9 @@
<a-form
:model="where"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18, }, sm: { span: 24 } }"
labelAlign="left"
layout="vertical"
>
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
@@ -19,6 +21,28 @@
</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.monitorYear" 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.timeSlot" allowClear showSearch>
<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 label="测点名称:">
<a-select v-model:value="where.place" allowClear showSearch>
@@ -52,8 +76,12 @@
</a-select>
</a-form-item>
</a-col>
</a-row>
<a-row>
<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-left" :wrapper-col="{ span: 24 }">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
@@ -91,7 +119,7 @@
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import { pageRoadNoiseUrl, getColumnOptions } from "@/api/ecology/road-sound";
import { pageRoadNoiseUrl, getColumnOptions,listAll } from "@/api/ecology/noise/road-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
// import moment from "moment";
// import utils from "./utils";
@@ -107,6 +135,7 @@ export default {
url: pageRoadNoiseUrl,
selection: [],
// 表格列配置
yearOptions:[],
columns: [
{
title: "监测日期",
@@ -304,6 +333,7 @@ export default {
palceOptions: [],
areaOptions: [],
roadOptions: [],
timeSlotOptions:[],
regionLevelOptions: [],
// 表格搜索条件
where: {
@@ -351,6 +381,23 @@ export default {
};
});
});
getColumnOptions("monitor_year").then((res) => {
this.yearOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("time_slot").then((res) => {
this.timeSlotOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
},
/* 刷新表格 */
reload() {
@@ -555,12 +602,17 @@ export default {
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());
listAll(this.where).then(res=>{
if(res.data.code == 0){
res.data.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());
}
})
},
},
};

View File

@@ -1,506 +1,265 @@
<template>
<div class="">
<a-form :model="where" :rules="whereRules" :labelCol="{ offset: 1 }">
<a-row>
<!-- <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="统计模块:">
<a-select
:options="groupModelOptions"
v-model:value="where.groupModel"
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="groupTimeLengthOptions"
v-model:value="where.groupTimeLength"
placeholder=""
>
</a-select>
</a-form-item>
</a-col> -->
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item name="timeRange" label="时间范围:">
<a-range-picker
@panelChange="timeRangePanelChange"
v-model:value="timeRange"
format="YYYY"
:mode="['year', 'year']"
/>
</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>
<div class="">
<a-form labelAlign="left"
layout="vertical" :model="where" :rules="whereRules"
: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 name="timeRange" label="时间范围:">
<a-range-picker
@panelChange="timeRangePanelChange"
v-model:value="timeRange"
format="YYYY"
:mode="['year', 'year']"
/>
</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="12" :md="12" :sm="24" :xs="24">
<a-form-item label="类型:">
<a-select
v-model:value="where.valueType"
:options="valueTypeOptions"
mode="multiple"
placeholder="至少选择一项"
>
</a-select>
</a-form-item>
</a-col>
<!-- <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="时间范围:">
<a-range-picker @change="reportTimeScopeChange" :mode="['year','year']" separator="~" v-model:value="where.reportTimeScope" ><a-range-picker>
<template #renderExtraFooter>
extra footer
</template>
</a-range-picker>
</a-form-item>
</a-col> -->
<a-col :lg="24" :md="24" :sm="24" :xs="24">
<a-form-item class="ele-text-left" :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-if="hisYears.length > 0"
ref="table"
row-key="id"
:datasource="url"
:columns="columns"
:where="where"
:needPage="false"
:initLoad="false"
:scroll="{ x: 'max-content' }"
:method="'POST'"
@done="(d) => (data = d.data)"
>
<template #toolbar>
<!-- 搜索表单 -->
<a-col :lg="12" :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-if="hisYears.length > 0"
ref="table"
row-key="id"
:datasource="url"
:columns="columns"
:where="where"
:needPage="false"
:initLoad="false"
:scroll="{ x: 'max-content' }"
:method="'POST'"
@done="(d) => (data = d.data)"
>
<template #toolbar>
<!-- 搜索表单 -->
<!-- <a-space>
<!-- <a-space>
</a-space> -->
</template>
</ele-pro-table>
</div>
</a-space> -->
</template>
</ele-pro-table>
</div>
</template>
<script>
// import _ from "lodash";
import { ref } from "vue";
import XLSX from "xlsx";
import {
pageRoadNoiseCompare,
getHistoryyears,
} from "@/api/ecology/road-sound";
pageRoadNoiseCompare,
getHistoryyears,
} from "@/api/ecology/noise/road-sound";
export default {
name: "StatisticSoundRoadCompare",
components: {},
data() {
const groupModelOptions = [
{ label: "测点", value: "place" },
{ label: "城区", value: "area" },
{ label: "市", value: "city" },
];
const groupTimeLengthOptions = [
{
label: "年",
value: "monitor_year",
},
{
label: "季度",
value: "quarter",
},
];
name: "StatisticSoundRoadCompare",
components: {},
data() {
// const valueTypeOptions = ['Leq','SD','L10','L50','L90','Lmin','Lmax'];
const valueTypeOptions = [
{
label: "Leq",
value: "index_Leq",
},
{
label: "SD",
value: "index_SD",
},
{
label: "L10",
value: "index_L10",
},
{
label: "L50",
value: "index_L50",
},
{
label: "L90",
value: "index_L90",
},
{
label: "Lmin",
value: "index_Lmin",
},
{
label: "Lmax",
value: "index_Lmax",
},
];
const groupTimeLengthOptions = [
{
label: "年",
value: "monitor_year",
},
{
label: "季度",
value: "quarter",
},
];
const whereRules = {};
return {
url: pageRoadNoiseCompare,
data: [],
where: {
groupModel: "area",
groupTimeLength: "monitor_year",
reportTimeScope: [],
valueType: ["index_Leq"],
timeSlot: "",
timeRange: [],
regionLevel: "市级"
},
timeRange: [],
whereRules,
hisYears: [],
timeScope: [],
columns: [{title: "年", dataIndex: "year"}],
groupTimeLengthOptions,
timeSlotOptions: [
{
value: "昼",
label: "昼",
},
{
value: "夜",
label: "夜",
},
],
};
},
mounted() {
getHistoryyears().then((res) => {
this.hisYears = res.data.data;
this.$nextTick(() => {
this.reload();
});
});
},
methods: {
/* 刷新表格 */
reload() {
if (this.where.valueType.length == 0) {
this.$message.error("请至少选择一个类型");
return;
}
const whereRules = {};
return {
url: pageRoadNoiseCompare,
data: [],
where: {
groupModel: "area",
groupTimeLength: "monitor_year",
reportTimeScope: [],
valueType: ["index_Leq"],
timeRange: [],
regionLevel: "市级"
},
timeRange: [],
whereRules,
hisYears: [],
timeScope: [],
columns: [{ title: "年", dataIndex: "year" }],
groupModelOptions,
groupTimeLengthOptions,
valueTypeOptions: ref(valueTypeOptions),
timeSlotOptions: [
{
value: "昼",
label: "昼",
// 结束时间必须大于开始时间
if (this.where.timeRange && this.where.timeRange.length == 2) {
if (this.where.timeRange[0] > this.where.timeRange[1]) {
this.$message.error("结束时间必须大于起始时间");
return;
}
this.where.startYear = this.where.timeRange[0];
this.where.endYear = this.where.timeRange[1];
}
this.stableDone();
this.$refs.table.reload({
where: this.where,
});
},
{
value: "夜",
label: "夜",
/* 重置搜索 */
reset() {
this.where = {
groupModel: "area",
groupTimeLength: "monitor_year",
reportTimeScope: [],
valueType: ["index_Leq"],
timeRange: [],
timeSlot: "昼",
regionLevel: "市级"
};
this.this.timeScope = [];
this.reload();
},
],
};
},
mounted() {
getHistoryyears().then((res) => {
this.hisYears = res.data.data;
this.$nextTick(() => {
this.reload();
});
});
},
methods: {
/* 刷新表格 */
reload() {
if (this.where.valueType.length == 0) {
this.$message.error("请至少选择一个类型");
return;
}
// 结束时间必须大于开始时间
if (this.where.timeRange && this.where.timeRange.length == 2) {
if (this.where.timeRange[0] > this.where.timeRange[1]) {
this.$message.error("结束时间必须大于起始时间");
return;
}
this.where.startYear = this.where.timeRange[0];
this.where.endYear = this.where.timeRange[1];
}
this.stableDone();
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.where = {
groupModel: "area",
groupTimeLength: "monitor_year",
reportTimeScope: [],
valueType: ["index_Leq"],
timeRange: [],
regionLevel: "市级"
};
this.this.timeScope = [];
this.reload();
},
reportTimeScopeChange(d, dstr) {
console.log(d, dstr);
},
timeRangePanelChange(val) {
val[0] && (this.where.timeRange[0] = val[0].year());
val[1] && (this.where.timeRange[1] = val[1].year());
this.timeRange = val;
},
// 数据加载完成
stableDone() {
const columns = [];
if (this.where.groupModel == "area") {
columns.push({
title: "城区",
dataIndex: "area",
sorter: true,
});
} else if (this.where.groupModel == "place") {
columns.push({
title: "测点",
dataIndex: "area",
sorter: true,
});
} else if (this.where.groupModel == "city") {
columns.push({
title: "城市",
dataIndex: "area",
sorter: true,
});
}
this.hisYears.forEach((item) => {
if (
(!this.where.timeRange[0] || this.where.timeRange[0] <= item) &&
(!this.where.timeRange[1] || this.where.timeRange[1] >= item)
) {
if (this.where.groupTimeLength == "quarter") {
columns.push({
title: item + "年第一季度Leq",
dataIndex: item + "1" + "Leq",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第二季度Leq",
dataIndex: item + "2" + "Leq",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第三季度Leq",
dataIndex: item + "3" + "Leq",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第四季度Leq",
dataIndex: item + "4" + "Leq",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第一季度SD",
dataIndex: item + "1" + "Sd",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第二季度SD",
dataIndex: item + "2" + "Sd",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第三季度SD",
dataIndex: item + "3" + "Sd",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第四季度SD",
dataIndex: item + "4" + "Sd",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第一季度L10",
dataIndex: item + "1" + "L10",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第二季度L10",
dataIndex: item + "2" + "L10",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第三季度L10",
dataIndex: item + "3" + "L10",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第四季度L10",
dataIndex: item + "4" + "L10",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第一季度L50",
dataIndex: item + "1" + "L50",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第二季度L50",
dataIndex: item + "2" + "L50",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第三季度L50",
dataIndex: item + "3" + "L50",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第四季度L50",
dataIndex: item + "4" + "L50",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第一季度L90",
dataIndex: item + "1" + "L90",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第二季度L90",
dataIndex: item + "2" + "L90",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第三季度L90",
dataIndex: item + "3" + "L90",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第四季度L90",
dataIndex: item + "4" + "L90",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第一季度Lmin",
dataIndex: item + "1" + "Lmin",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第二季度Lmin",
dataIndex: item + "2" + "Lmin",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第三季度Lmin",
dataIndex: item + "3" + "Lmin",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第四季度Lmin",
dataIndex: item + "4" + "Lmin",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第一季度Lmax",
dataIndex: item + "1" + "Lmax",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第二季度Lmax",
dataIndex: item + "2" + "Lmax",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第三季度Lmax",
dataIndex: item + "3" + "Lmax",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
columns.push({
title: item + "年第四季度Lmax",
dataIndex: item + "4" + "Lmax",
customRender: ({ text }) =>text? Number(text).toFixed(1):"",
});
} else {
if (this.where.valueType.includes("index_Leq")) {
columns.push({
title: item + "年Leq",
dataIndex: item + "Leq",
customRender: ({ text }) => {
const val = text ? Number(text).toFixed(1) : "";
return val;
},
});
}
if (this.where.valueType.includes("index_SD")) {
columns.push({
title: item + "年SD",
dataIndex: item + "Sd",
customRender: ({ text }) => {
const val = text ? Number(text).toFixed(1) : "";
return val;
},
});
}
if (this.where.valueType.includes("index_L10")) {
columns.push({
title: item + "年L10",
dataIndex: item + "L10",
customRender: ({ text }) => {
const val = text ? Number(text).toFixed(1) : "";
return val;
},
});
reportTimeScopeChange(d, dstr) {
console.log(d, dstr);
},
timeRangePanelChange(val) {
val[0] && (this.where.timeRange[0] = val[0].year());
val[1] && (this.where.timeRange[1] = val[1].year());
this.timeRange = val;
},
// 数据加载完成
stableDone() {
const columns = [];
if (this.where.groupModel == "area") {
columns.push({
title: "城区",
dataIndex: "area",
sorter: true,
});
} else if (this.where.groupModel == "place") {
columns.push({
title: "测点",
dataIndex: "area",
sorter: true,
});
} else if (this.where.groupModel == "city") {
columns.push({
title: "城市",
dataIndex: "area",
sorter: true,
});
}
if (this.where.valueType.includes("index_L50")) {
columns.push({
title: item + "年L50",
dataIndex: item + "L50",
customRender: ({ text }) => {
const val = text ? Number(text).toFixed(1) : "";
return val;
},
});
}
if (this.where.valueType.includes("index_L90")) {
columns.push({
title: item + "年L90",
dataIndex: item + "L90",
customRender: ({ text }) => {
const val = text ? Number(text).toFixed(1) : "";
return val;
},
});
}
if (this.where.valueType.includes("index_Lmin")) {
columns.push({
title: item + "年Lmin",
dataIndex: item + "Lmin",
customRender: ({ text }) => {
const val = text ? Number(text).toFixed(1) : "";
return val;
},
});
}
if (this.where.valueType.includes("index_Lmax")) {
columns.push({
title: item + "年Lmax",
dataIndex: item + "Lmax",
customRender: ({ text }) => {
const val = text ? Number(text).toFixed(1) : "";
return val;
},
});
}
}
}
});
//
this.columns = columns;
this.hisYears.forEach((item) => {
if (
(!this.where.timeRange[0] || this.where.timeRange[0] <= item) &&
(!this.where.timeRange[1] || this.where.timeRange[1] >= item)
) {
if (this.where.valueType.includes("index_Leq")) {
columns.push({
title: item + "年",
align:"center",
children: [
{
title:"Leq",
dataIndex: item + "Leq",
align:"center",
customRender: ({text}) => {
const val = text ? Number(text).toFixed(1) : "";
return val;
},
},
{
title:"等级",
align:"center",
dataIndex: item + "LeqLevel",
}
]
});
}
}
});
//
this.columns = columns;
},
exportFile() {
const arr = [];
const th1 = [];
const th2 = [];
const merges = []; // 合并
const columnsTemp = []; // 树形结构整理成list
this.columns.forEach((item,index)=>{
if(item.children){
item.children.forEach(citem=>{
th1.push(item.title)
th2.push(citem.title)
columnsTemp.push(citem)
})
merges.push({s: {r: 0, c: th1.length-2}, e: {r: 0, c: th1.length-1}})
}else{
th1.push(item.title)
th2.push("")
columnsTemp.push(item)
merges.push({s: {r: 0, c: index}, e: {r: 1, c: index}})
}
})
arr.push(th1,th2);
this.data.forEach((d) => {
const td = columnsTemp.map((item) => {
if (typeof d[item.dataIndex] == "number") {
return d[item.dataIndex].toFixed(1);
}
return d[item.dataIndex];
});
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
sheet['!merges'] = merges;
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
},
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>

View File

@@ -14,6 +14,9 @@
<a-tab-pane key="year-compare" tab="同比">
<compare></compare>
</a-tab-pane>
<a-tab-pane key="year-end" tab="年终统计">
<year-end></year-end>
</a-tab-pane>
</a-tabs>
</a-card>
</div>
@@ -29,12 +32,13 @@
// import QuarterStatistic from "./quarter.vue";
import Compare from "./compare.vue"
import AverageStatistic from "./average.vue"
import YearEnd from "./year-end"
export default {
name: 'StatisticSoundRoad',
components: {
BaseStatistic,
// QuarterStatistic,
YearEnd,
Compare,
AverageStatistic
},

View File

@@ -0,0 +1,146 @@
<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="timeSlotOptions"
v-model:value="where.timeSlot"
placeholder="昼夜"
>
</a-select>
</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 XLSX from "xlsx";
import { roadNoiseYearEnd } from "@/api/ecology/noise/road-sound";
const columns = [
{title: "年份",dataIndex: "year",},
{title: "路段总长度(米)",dataIndex: "roadLengthTotal",},
{title: "监测点数",dataIndex: "placeTotal",},
{title: "平均路长(米)",dataIndex: "roadLengthAvg",},
{title: "平均路宽(米)",dataIndex: "roadWidthAvg",},
{title: "车流量(辆/20分钟)",dataIndex: "trafficFlow",},
{title: "超70分贝路段长度占总路长比例(%)",dataIndex: "badProportion",},
{title: "Leq(分贝)",dataIndex: "leq",},
];
export default {
name: "StatisticSoundRoadYearEnd",
components: {},
data() {
return {
url: roadNoiseYearEnd,
data: [],
where: {
timeSlot: "昼"
},
timeScope: [],
columns,
modelOptions: [
{
value: "place",
label: "测点",
},
{
value: "road",
label: "路段",
},
{
value: "area",
label: "城区",
},
{
value: "city",
label: "市",
},
],
timeSlotOptions: [
{
value: "昼",
label: "昼",
},
{
value: "夜",
label: "夜",
},
],
};
},
methods: {
/* 刷新表格 */
reload() {
},
/* 重置搜索 */
reset() {
this.where = {
model: "area",
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>

View File

@@ -33,7 +33,7 @@ import XLSX from "xlsx";
import utils from "./utils";
import { Modal } from "ant-design-vue";
import NoiseBill from "./noise-bill.vue";
import { saveZoneNoiseBill } from "@/api/ecology/zone-sound";
import { saveZoneNoiseBill } from "@/api/ecology/noise/zone-sound";
export default {
name: "ZoneCollectIndex",
components: {

View File

@@ -111,7 +111,7 @@
removeBatchZoneNoiseBill,
updateZoneNoiseBill,
verifyZoneNoiseBill
} from "@/api/ecology/zone-sound";
} from "@/api/ecology/noise/zone-sound";
import moment from "moment";
export default {
name: 'ZoneCollectNoiseBill',

View File

@@ -340,7 +340,7 @@ import {
updateZoneNoise,
getZoneNoiseBill,
getColumnOptions,
} from "@/api/ecology/zone-sound";
} from "@/api/ecology/noise/zone-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
// import utils from "./utils";

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/road-noise-leq-level";
import { message } from 'ant-design-vue';
// import moment from "moment";
export default {
name: "RoadNoiseLeqLevel",
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,353 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<a-modal
v-model:visible="showEdit"
:title="form.roadNoisePlaceId !== 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="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="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-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="roadNoisePlaceId"
: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/road-noise-place";
// import moment from "moment";
export default {
name: "RoadNoisePlace",
components: {},
data() {
return {
data: [],
// 表格数据接口
url: listAllUrl,
selection: [],
// 表格列配置
columns: [
{
title: "测点名称",
dataIndex: "placeName",
sorter: true,
},
{
title: "测点经度",
dataIndex: "placeLng",
sorter: true,
},
{
title: "测点纬度",
dataIndex: "placeLat",
sorter: true,
},
{
title: "机动车车道数",
dataIndex: "motorway",
sorter: true,
},
{
title: "车道类别",
dataIndex: "motorwayType",
sorter: true,
},
{
title: "道路等级",
dataIndex: "motorwayLevel",
sorter: true,
},
{
title: "测点参照物",
dataIndex: "refObj",
sorter: true,
},
{
title: "道路覆盖人口(万人)",
dataIndex: "people",
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: '请选择测点名称'}],
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.roadNoisePlaceId) {
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.roadNoisePlaceId).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.roadNoisePlaceId);
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

@@ -52,7 +52,7 @@
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import { pageZoneNoiseStatisticUrl, getColumnOptions } from "@/api/ecology/zone-sound";
import { pageZoneNoiseStatisticUrl, 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 {

View File

@@ -81,7 +81,7 @@
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import { pageZoneNoiseUrl, getColumnOptions } from "@/api/ecology/zone-sound";
import { pageZoneNoiseUrl, getColumnOptions } from "@/api/ecology/noise/zone-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
// import utils from "./utils";

View File

@@ -52,7 +52,7 @@
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import { statisticSourceUrl, getColumnOptions } from "@/api/ecology/zone-sound";
import { statisticSourceUrl, 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 {

View File

@@ -65,7 +65,7 @@
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import { statisticYearUrl, getColumnOptions } from "@/api/ecology/zone-sound";
import { statisticYearUrl, 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 {