This commit is contained in:
weicw
2021-09-29 21:01:56 +08:00
parent 1fc4e2590a
commit ddf83b104b
14 changed files with 1203 additions and 491 deletions

View File

@@ -23,13 +23,16 @@ const updateFunctionType = function (data) {
const getColumnOptions = function(column){ const getColumnOptions = function(column){
return axios.get("/sound/function/functionType/options",{params:{column}}) return axios.get("/sound/function/functionType/options",{params:{column}})
} }
const copyBatchFunctionType = function (data){
return axios.post("/sound/function/functionType/copyBatch",data)
}
export { export {
listAllUrl, listAllUrl,
saveFunctionType, saveFunctionType,
updateFunctionType, updateFunctionType,
removeBatchFunctionType, removeBatchFunctionType,
removeFunctionType, removeFunctionType,
getColumnOptions getColumnOptions,
copyBatchFunctionType
} }

View File

@@ -25,6 +25,9 @@ const getColumnOptions = function(column){
return axios.get("/sound/function/place/options",{params:{column}}) return axios.get("/sound/function/place/options",{params:{column}})
} }
const copyBatchPlace = function (data){
return axios.post("/sound/function/place/copyBatch",data)
}
export { export {
listAllUrl, listAllUrl,
@@ -32,6 +35,6 @@ export {
updatePlace, updatePlace,
removeBatchPlace, removeBatchPlace,
removePlace, removePlace,
getColumnOptions getColumnOptions,
copyBatchPlace
} }

View File

@@ -24,6 +24,10 @@ const updateLeqLevel = function (data) {
const getColumnOptions = function(column){ const getColumnOptions = function(column){
return axios.get("/sound/road/noiseLeqLevel/options",{params:{column}}) return axios.get("/sound/road/noiseLeqLevel/options",{params:{column}})
} }
const copyBatchLeqLevel = function (data){
return axios.post("/sound/road/noiseLeqLevel/copyBatch",data)
}
export { export {
@@ -32,6 +36,7 @@ export {
updateLeqLevel, updateLeqLevel,
removeBatchLeqLevel, removeBatchLeqLevel,
removeLeqLevel, removeLeqLevel,
getColumnOptions getColumnOptions,
copyBatchLeqLevel
} }

View File

@@ -24,6 +24,10 @@ const getColumnOptions = function(column){
return axios.get("/sound/zone/noiseLeqLevel/options",{params:{column}}) return axios.get("/sound/zone/noiseLeqLevel/options",{params:{column}})
} }
const copyBatchLeqLevel = function (data){
return axios.post("/sound/zone/noiseLeqLevel/copyBatch",data)
}
export { export {
listAllUrl, listAllUrl,
@@ -31,6 +35,7 @@ export {
updateLeqLevel, updateLeqLevel,
removeBatchLeqLevel, removeBatchLeqLevel,
removeLeqLevel, removeLeqLevel,
getColumnOptions getColumnOptions,
copyBatchLeqLevel
} }

View File

@@ -25,7 +25,7 @@ const getColumnOptions = function(column){
return axios.get("/sound/zone/place/options",{params:{column}}) return axios.get("/sound/zone/place/options",{params:{column}})
} }
const copyBatchPlace = function (data){ const copyBatchPlace = function (data){
return axios.post("/sound/zone/copyBatch",data) return axios.post("/sound/zone/place/copyBatch",data)
} }

View File

@@ -60,7 +60,7 @@ export default {
const reportDate = aoa[2][0].replace(/[^\d]+/g, "-"); const reportDate = aoa[2][0].replace(/[^\d]+/g, "-");
const acidList = aoa.filter((item) => { const acidList = aoa.filter((item) => {
return item.length >= 23 && item[0] && !item[0].includes("编号"); return item.length >= 16 && item[0] && !item[0].includes("编号");
}); });
// 解析成对象数组 // 解析成对象数组
const billName = aoa[0][0] + aoa[1][0]; const billName = aoa[0][0] + aoa[1][0];

View File

@@ -1,284 +1,309 @@
<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"
layout="vertical" layout="vertical"
: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-range-picker v-model:value="time"/>
<a-select-option </a-form-item>
v-for="(item) in regionLevelOptions" </a-col>
:key="item.value" <a-col :lg="6" :md="12" :sm="24" :xs="24">
>{{ item.label }}</a-select-option <a-form-item label="区域等级:">
> <a-select v-model:value="where.regionLevel" allowClear showSearch>
</a-select> <a-select-option
</a-form-item> v-for="(item) in regionLevelOptions"
</a-col> :key="item.value"
</a-row> >{{ item.label }}
<a-row> </a-select-option
<a-col :lg="24" :md="24" :sm="24" :xs="24"> >
<a-space> </a-select>
<a-button type="primary" @click="reload">查询</a-button> </a-form-item>
<a-button @click="reset">重置</a-button> </a-col>
<a-button @click="exportFile">导出Excel</a-button> <a-col :lg="6" :md="12" :sm="24" :xs="24">
</a-space> <a-form-item label="监测点:">
</a-col> <a-select v-model:value="where.place" allowClear showSearch>
</a-row> <a-select-option
</a-form> v-for="(item) in placeOptions"
<!-- 表格 --> :key="item.value"
<ele-pro-table >{{ item.label }}
v-model:selection="selectionList" </a-select-option
ref="table" >
row-key="ambientAirId" </a-select>
:datasource="url" </a-form-item>
:columns="columns" </a-col>
:where="where" </a-row>
:scroll="{ x: 'max-content' }" <a-row>
@done="(d) => (data = d.data)" <a-col :lg="24" :md="24" :sm="24" :xs="24">
> <a-space>
<a-button type="primary" @click="reload">查询</a-button>
</ele-pro-table> <a-button @click="reset">重置</a-button>
</a-card> <a-button @click="exportFile">导出Excel</a-button>
</div> </a-space>
<!-- 编辑弹窗 --> </a-col>
</a-row>
</a-form>
<!-- 表格 -->
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="ambientAirId"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
</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 { pageAirUrl, getColumnOptions,listAllAir } from "@/api/ecology/air"; import {pageAirUrl, getColumnOptions, listAllAir} from "@/api/ecology/air";
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: "StatisticAirBase", name: "StatisticAirBase",
components: {}, components: {},
data() { data() {
return { return {
data: [], data: [],
locale, locale,
bill: {}, bill: {},
// 表格数据接口 // 表格数据接口
url: pageAirUrl, url: pageAirUrl,
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{ {
title: "监测日期", title: "监测日期",
dataIndex: "monitorTime", dataIndex: "monitorTime",
sorter: true, sorter: true,
customRender: ({text})=> moment(text).format("YYYY-MM-DD HH:mm") customRender: ({text}) => moment(text).format("YYYY-MM-DD HH:mm")
}, },
{ {
title: "城市", title: "城市",
dataIndex: "city", dataIndex: "city",
sorter: true, sorter: true,
}, },
{ {
title: "测点名称", title: "测点名称",
dataIndex: "place", dataIndex: "place",
sorter: true, sorter: true,
}, },
{ {
title: "SO2/(μg/m3)", title: "SO2/(μg/m3)",
dataIndex: "so2", dataIndex: "so2",
sorter: true, sorter: true,
}, },
{ {
title: "NO2/(μg/m3)", title: "NO2/(μg/m3)",
dataIndex: "no2", dataIndex: "no2",
sorter: true, sorter: true,
}, },
{ {
title: "PM10/(μg/m3)", title: "PM10/(μg/m3)",
dataIndex: "pm10", dataIndex: "pm10",
sorter: true, sorter: true,
}, },
{ {
title: "CO/(mg/m3)", title: "CO/(mg/m3)",
dataIndex: "co", dataIndex: "co",
sorter: true, sorter: true,
}, },
{ {
title: "臭氧O3最大8小时滑动平均浓度/(μg/m3)", title: "臭氧O3最大8小时滑动平均浓度/(μg/m3)",
dataIndex: "o3", dataIndex: "o3",
sorter: true, sorter: true,
}, },
{ {
title: "PM2.5", title: "PM2.5",
dataIndex: "pm25", dataIndex: "pm25",
sorter: true, sorter: true,
}, },
{ {
title: "空气质量指数AQI", title: "空气质量指数AQI",
dataIndex: "aqi", dataIndex: "aqi",
sorter: true, sorter: true,
}, },
{ {
title: "首要污染物", title: "首要污染物",
dataIndex: "primaryPollutant", dataIndex: "primaryPollutant",
sorter: true, sorter: true,
}, },
{ {
title: "空气质量指数级别", title: "空气质量指数级别",
dataIndex: "aqiLevel", dataIndex: "aqiLevel",
sorter: true, sorter: true,
}, },
{ {
title: "空气质量状况", title: "空气质量状况",
dataIndex: "airQualityStatus", dataIndex: "airQualityStatus",
sorter: true, sorter: true,
}, },
{ {
title: "备注", title: "备注",
dataIndex: "remark", dataIndex: "remark",
sorter: true, sorter: true,
}, },
{ {
title: "创建人", title: "创建人",
dataIndex: "username", dataIndex: "username",
sorter: true, sorter: true,
} }
], ],
regionLevelOptions: [], regionLevelOptions: [
// 表格搜索条件 {label: "市区", value: "city"},
where: { {label: "城区", value: "area"},
checked: 1, {label: "县区", value: "county"},
}, {label: "站点", value: "place"},
// 表格选中数据 ],
selectionList: [], placeOptions:[],
}; time:[],
}, // 表格搜索条件
mounted() { where: {
this.loadOptionData(); checked: 1,
}, },
methods: { // 表格选中数据
/**获取下来框数据 */ selectionList: [],
loadOptionData() { };
getColumnOptions("region_level").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
}, },
/* 刷新表格 */ mounted() {
reload() { this.loadOptionData();
this.$refs.table.reload({
where: this.where,
});
}, },
/* 重置搜索 */ methods: {
reset() { /**获取下来框数据 */
this.where = { loadOptionData() {
checked: 1, getColumnOptions("place").then((res) => {
}; this.placeOptions = res.data.data.map((item) => {
this.reload(); return {
}, label: item,
exportFile() { value: item,
};
});
});
},
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.where = {
checked: 1,
};
this.reload();
},
exportFile() {
const columns = [ const columns = [
{ {
title: "监测日期", title: "监测日期",
dataIndex: "monitorTime", dataIndex: "monitorTime",
sorter: true, sorter: true,
customRender: ({text})=> moment(text).format("YYYY-MM-DD HH:mm") customRender: ({text}) => moment(text).format("YYYY-MM-DD HH:mm")
}, },
{ {
title: "城市", title: "城市",
dataIndex: "city", dataIndex: "city",
sorter: true, sorter: true,
}, },
{ {
title: "测点名称", title: "测点名称",
dataIndex: "place", dataIndex: "place",
sorter: true, sorter: true,
}, },
{ {
title: "SO2/(μg/m3)", title: "SO2/(μg/m3)",
dataIndex: "so2", dataIndex: "so2",
sorter: true, sorter: true,
}, },
{ {
title: "NO2/(μg/m3)", title: "NO2/(μg/m3)",
dataIndex: "no2", dataIndex: "no2",
sorter: true, sorter: true,
}, },
{ {
title: "PM10/(μg/m3)", title: "PM10/(μg/m3)",
dataIndex: "pm10", dataIndex: "pm10",
sorter: true, sorter: true,
}, },
{ {
title: "CO/(mg/m3)", title: "CO/(mg/m3)",
dataIndex: "co", dataIndex: "co",
sorter: true, sorter: true,
}, },
{ {
title: "臭氧O3最大8小时滑动平均浓度/(μg/m3)", title: "臭氧O3最大8小时滑动平均浓度/(μg/m3)",
dataIndex: "o3", dataIndex: "o3",
sorter: true, sorter: true,
}, },
{ {
title: "PM2.5", title: "PM2.5",
dataIndex: "pm25", dataIndex: "pm25",
sorter: true, sorter: true,
}, },
{ {
title: "空气质量指数AQI", title: "空气质量指数AQI",
dataIndex: "aqi", dataIndex: "aqi",
sorter: true, sorter: true,
}, },
{ {
title: "首要污染物", title: "首要污染物",
dataIndex: "primaryPollutant", dataIndex: "primaryPollutant",
sorter: true, sorter: true,
}, },
{ {
title: "空气质量指数级别", title: "空气质量指数级别",
dataIndex: "aqiLevel", dataIndex: "aqiLevel",
sorter: true, sorter: true,
}, },
{ {
title: "空气质量状况", title: "空气质量状况",
dataIndex: "airQualityStatus", dataIndex: "airQualityStatus",
sorter: true, sorter: true,
}, },
{ {
title: "备注", title: "备注",
dataIndex: "remark", dataIndex: "remark",
sorter: true, sorter: true,
}, },
{ {
title: "创建人", title: "创建人",
dataIndex: "username", dataIndex: "username",
sorter: true, sorter: true,
}, },
]; ];
const arr = []; const arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
arr.push(th); arr.push(th);
listAllAir(this.where).then(res=>{ listAllAir(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) => 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>

View File

@@ -1,6 +1,52 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card :bordered="false"> <a-card :bordered="false">
<a-form
:model="where"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="年份:">
<a-select v-model:value="where.year" allow-clear show-search>
<a-select-option
v-for="(item) in yearOptions"
:key="item.value"
>{{ item.label }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-space>
</a-col>
</a-row>
<a-row>
</a-row>
</a-form>
<a-modal
v-model:visible="showNYear"
:title="'批量复制'"
:confirm-loading="loading"
:body-style="{ paddingBottom: '8px' }"
@ok="copyBatch"
>
<a-form
ref="form"
:model="form"
:rules="rules"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-form-item label="新年份" name="nYear">
<a-input-number id="inputNumber" v-model:value="nYear" :min="1970" :max="2050" />
</a-form-item>
</a-form>
</a-modal>
<a-modal <a-modal
v-model:visible="showEdit" v-model:visible="showEdit"
:title="form.id !== undefined ? '修改' : '添加'" :title="form.id !== undefined ? '修改' : '添加'"
@@ -16,6 +62,9 @@
: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-form-item label="年份" name="year">
<a-input-number v-model:value="form.year" :min="1970" :max="2050" />
</a-form-item>
<a-form-item label="功能区类别" name="functionType"> <a-form-item label="功能区类别" name="functionType">
<a-input <a-input
v-model:value="form.functionType" v-model:value="form.functionType"
@@ -62,6 +111,19 @@
<template #toolbar> <template #toolbar>
<a-space> <a-space>
<a-button @click="openEdit" type="primary">新增</a-button> <a-button @click="openEdit" type="primary">新增</a-button>
<a-dropdown>
<template #overlay>
<a-menu @click="setCYear">
<a-menu-item v-for="item in yearOptions" :key="item.value">
{{ item.label }}
</a-menu-item>
</a-menu>
</template>
<a-button>
批量复制
<DownOutlined/>
</a-button>
</a-dropdown>
<a-popconfirm <a-popconfirm
:disabled="selectionList.length == 0" :disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`" :title="`确认删除${selectionList.length}条数据吗?`"
@@ -77,6 +139,7 @@
>删除 >删除
</a-button> </a-button>
</a-popconfirm> </a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</a-space> </a-space>
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
@@ -113,12 +176,16 @@ import {
saveFunctionType, saveFunctionType,
updateFunctionType, updateFunctionType,
removeFunctionType, removeFunctionType,
removeBatchFunctionType removeBatchFunctionType,
getColumnOptions,
copyBatchFunctionType
} from "@/api/ecology/noise/function-noise-function-type"; } from "@/api/ecology/noise/function-noise-function-type";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
// import moment from "moment"; // import moment from "moment";
export default { export default {
name: "FunctionNoiseFunctionType", name: "FunctionNoiseFunctionType",
components: {}, components: {DownOutlined},
data() { data() {
return { return {
data: [], data: [],
@@ -171,14 +238,19 @@ export default {
// 表格搜索条件 // 表格搜索条件
where: {}, where: {},
yearOptions: [],
// 表格选中数据 // 表格选中数据
selectionList: [], selectionList: [],
// 是否显示编辑弹窗 // 是否显示编辑弹窗
showEdit: false, showEdit: false,
showNYear:false,
cYear: undefined,
nYear:undefined,
// 表单数据 // 表单数据
form: {}, form: {},
loading: false, loading: false,
rules: { rules: {
year:[{required: true,message: '请输入年份'}],
functionType:[{required: true,message: '请输入功能区类别'}], functionType:[{required: true,message: '请输入功能区类别'}],
functionCode:[{required: true,message: '请输入功能区代码'}], functionCode:[{required: true,message: '请输入功能区代码'}],
maxLd: [{required: true,message: '请输入昼间限值',},], maxLd: [{required: true,message: '请输入昼间限值',},],
@@ -189,6 +261,7 @@ export default {
}; };
}, },
mounted() { mounted() {
this.getOptions();
}, },
methods: { methods: {
minLeqChange(e){ minLeqChange(e){
@@ -201,6 +274,19 @@ export default {
where: this.where, where: this.where,
}); });
}, },
getOptions(){
getColumnOptions("year").then(res => {
console.log(res)
if (res.data.code == 0) {
this.yearOptions = res.data.data.map(item => {
return {
label: item,
value: item
}
})
}
})
},
/* 重置搜索 */ /* 重置搜索 */
reset() { reset() {
this.where = {}; this.where = {};
@@ -226,6 +312,7 @@ export default {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions();
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -243,6 +330,7 @@ export default {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions();
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -287,6 +375,40 @@ export default {
}).finally(() => { }).finally(() => {
hide(); hide();
}) })
},
setCYear(e){
this.cYear = e.key;
this.showNYear = true;
},
copyBatch(){
const hide = this.$message.loading('请求中..', 0);
copyBatchFunctionType({cyear:Number(this.cYear),nyear:this.nYear}).then(res=>{
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
this.getOptions();
} else {
this.$message.error(res.data.msg);
}
this.showNYear = false;
}).catch(e => {
this.$message.error(e.message);
}).finally(() => {
hide();
})
},
exportData(){
const columns = this.columns.filter(item=>item.dataIndex);
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
} }
}, },

View File

@@ -1,6 +1,52 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card :bordered="false"> <a-card :bordered="false">
<a-form
:model="where"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="年份:">
<a-select v-model:value="where.year" allow-clear show-search>
<a-select-option
v-for="(item) in yearOptions"
:key="item.value"
>{{ item.label }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-space>
</a-col>
</a-row>
<a-row>
</a-row>
</a-form>
<a-modal
v-model:visible="showNYear"
:title="'批量复制'"
:confirm-loading="loading"
:body-style="{ paddingBottom: '8px' }"
@ok="copyBatch"
>
<a-form
ref="form"
:model="form"
:rules="rules"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-form-item label="新年份" name="nYear">
<a-input-number id="inputNumber" v-model:value="nYear" :min="1970" :max="2050" />
</a-form-item>
</a-form>
</a-modal>
<a-modal <a-modal
v-model:visible="showEdit" v-model:visible="showEdit"
:title="form.roadNoisePlaceId !== undefined ? '修改' : '添加'" :title="form.roadNoisePlaceId !== undefined ? '修改' : '添加'"
@@ -16,6 +62,9 @@
: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-form-item label="年份" name="year">
<a-input-number v-model:value="form.year" :min="1970" :max="2050" />
</a-form-item>
<a-form-item label="测点名称" name="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>
@@ -79,6 +128,19 @@
<template #toolbar> <template #toolbar>
<a-space> <a-space>
<a-button @click="openEdit" type="primary">新增</a-button> <a-button @click="openEdit" type="primary">新增</a-button>
<a-dropdown>
<template #overlay>
<a-menu @click="setCYear">
<a-menu-item v-for="item in yearOptions" :key="item.value">
{{ item.label }}
</a-menu-item>
</a-menu>
</template>
<a-button>
批量复制
<DownOutlined/>
</a-button>
</a-dropdown>
<a-popconfirm <a-popconfirm
:disabled="selectionList.length == 0" :disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`" :title="`确认删除${selectionList.length}条数据吗?`"
@@ -94,6 +156,7 @@
>删除 >删除
</a-button> </a-button>
</a-popconfirm> </a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</a-space> </a-space>
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
@@ -130,8 +193,11 @@ import {
savePlace, savePlace,
updatePlace, updatePlace,
removePlace, removePlace,
removeBatchPlace removeBatchPlace,
getColumnOptions,
copyBatchPlace
} from "@/api/ecology/noise/function-noise-place"; } from "@/api/ecology/noise/function-noise-place";
import XLSX from "xlsx";
// import moment from "moment"; // import moment from "moment";
export default { export default {
name: "FunctionNoisePlace", name: "FunctionNoisePlace",
@@ -144,6 +210,11 @@ export default {
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{
title: "年份",
dataIndex: "year",
sorter: true,
},
{ {
title: "测点名称", title: "测点名称",
dataIndex: "placeName", dataIndex: "placeName",
@@ -233,17 +304,22 @@ export default {
selectionList: [], selectionList: [],
// 是否显示编辑弹窗 // 是否显示编辑弹窗
showEdit: false, showEdit: false,
showNYear:false,
cYear: undefined,
nYear:undefined,
yearOptions: [],
// 表单数据 // 表单数据
form: {}, form: {},
loading: false, loading: false,
rules: { rules: {
placeName:[{required: true,message: '请选择测点名称'}], // placeName:[{required: true,message: '请选择测点名称'}],
placeLng: [{required: true,message: '请输入测点经度',},], // placeLng: [{required: true,message: '请输入测点经度',},],
placeLat: [{required: true,message: '请输入测点纬度',},], // placeLat: [{required: true,message: '请输入测点纬度',},],
}, },
}; };
}, },
mounted() { mounted() {
this.getOptions();
}, },
methods: { methods: {
/* 刷新表格 */ /* 刷新表格 */
@@ -278,6 +354,7 @@ export default {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions();
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -295,6 +372,7 @@ export default {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions();
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -339,7 +417,54 @@ export default {
}).finally(() => { }).finally(() => {
hide(); hide();
}) })
} },
getOptions(){
getColumnOptions("year").then(res => {
console.log(res)
if (res.data.code == 0) {
this.yearOptions = res.data.data.map(item => {
return {
label: item,
value: item
}
})
}
})
},
setCYear(e){
this.cYear = e.key;
this.showNYear = true;
},
exportData(){
const columns = this.columns.filter(item=>item.dataIndex);
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
copyBatch(){
const hide = this.$message.loading('请求中..', 0);
copyBatchPlace({cyear:Number(this.cYear),nyear:this.nYear}).then(res=>{
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
this.getOptions();
} else {
this.$message.error(res.data.msg);
}
this.showNYear = false;
}).catch(e => {
this.$message.error(e.message);
}).finally(() => {
hide();
})
},
}, },
}; };

View File

@@ -1,6 +1,52 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card :bordered="false"> <a-card :bordered="false">
<a-form
:model="where"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="年份:">
<a-select v-model:value="where.year" allow-clear show-search>
<a-select-option
v-for="(item) in yearOptions"
:key="item.value"
>{{ item.label }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-space>
</a-col>
</a-row>
<a-row>
</a-row>
</a-form>
<a-modal
v-model:visible="showNYear"
:title="'批量复制'"
:confirm-loading="loading"
:body-style="{ paddingBottom: '8px' }"
@ok="copyBatch"
>
<a-form
ref="form"
:model="form"
:rules="rules"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-form-item label="新年份" name="nYear">
<a-input-number id="inputNumber" v-model:value="nYear" :min="1970" :max="2050" />
</a-form-item>
</a-form>
</a-modal>
<a-modal <a-modal
v-model:visible="showEdit" v-model:visible="showEdit"
:title="form.id !== undefined ? '修改' : '添加'" :title="form.id !== undefined ? '修改' : '添加'"
@@ -16,6 +62,9 @@
: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-form-item label="年份" name="year">
<a-input-number v-model:value="form.year" :min="1970" :max="2050" />
</a-form-item>
<a-form-item label="最小值" name="minLeq"> <a-form-item label="最小值" name="minLeq">
<a-input-number @change="minLeqChange" :step=".1" :precision="1" v-model:value="form.minLeq" /> <a-input-number @change="minLeqChange" :step=".1" :precision="1" v-model:value="form.minLeq" />
</a-form-item> </a-form-item>
@@ -57,10 +106,25 @@
:columns="columns" :columns="columns"
:where="where" :where="where"
:scroll="{ x: 'max-content' }" :scroll="{ x: 'max-content' }"
:need-page="false"
@done="(d) => (data = d.data)"
> >
<template #toolbar> <template #toolbar>
<a-space> <a-space>
<a-button @click="openEdit" type="primary">新增</a-button> <a-button @click="openEdit" type="primary">新增</a-button>
<a-dropdown>
<template #overlay>
<a-menu @click="setCYear">
<a-menu-item v-for="item in yearOptions" :key="item.value">
{{ item.label }}
</a-menu-item>
</a-menu>
</template>
<a-button>
批量复制
<DownOutlined/>
</a-button>
</a-dropdown>
<a-popconfirm <a-popconfirm
:disabled="selectionList.length == 0" :disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`" :title="`确认删除${selectionList.length}条数据吗?`"
@@ -76,6 +140,7 @@
>删除 >删除
</a-button> </a-button>
</a-popconfirm> </a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</a-space> </a-space>
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
@@ -112,13 +177,19 @@ import {
saveLeqLevel, saveLeqLevel,
updateLeqLevel, updateLeqLevel,
removeLeqLevel, removeLeqLevel,
removeBatchLeqLevel removeBatchLeqLevel,
getColumnOptions,
copyBatchLeqLevel
} from "@/api/ecology/noise/road-noise-leq-level"; } from "@/api/ecology/noise/road-noise-leq-level";
import {DownOutlined} from '@ant-design/icons-vue';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import XLSX from "xlsx";
// import moment from "moment"; // import moment from "moment";
export default { export default {
name: "RoadNoiseLeqLevel", name: "RoadNoiseLeqLevel",
components: {}, components: {DownOutlined},
data() { data() {
return { return {
data: [], data: [],
@@ -127,6 +198,11 @@ export default {
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{
title: "年份",
dataIndex: "year",
sorter: true,
},
{ {
title: "时段", title: "时段",
dataIndex: "timeSlot", dataIndex: "timeSlot",
@@ -173,8 +249,13 @@ export default {
where: {}, where: {},
// 表格选中数据 // 表格选中数据
selectionList: [], selectionList: [],
// 是否显示编辑弹窗 // 是否显示编辑弹窗
showEdit: false, showEdit: false,
showNYear:false,
cYear: undefined,
nYear:undefined,
yearOptions:[],
// 表单数据 // 表单数据
form: {}, form: {},
loading: false, loading: false,
@@ -189,6 +270,7 @@ export default {
}; };
}, },
mounted() { mounted() {
this.getOptions()
}, },
methods: { methods: {
minLeqChange(e){ minLeqChange(e){
@@ -231,6 +313,7 @@ export default {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions()
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -248,6 +331,7 @@ export default {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions()
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -292,8 +376,56 @@ export default {
}).finally(() => { }).finally(() => {
hide(); hide();
}) })
},
getOptions(){
getColumnOptions("year").then(res => {
console.log(res)
if (res.data.code == 0) {
this.yearOptions = res.data.data.map(item => {
return {
label: item,
value: item
}
})
}
})
},
setCYear(e){
this.cYear = e.key;
this.showNYear = true;
},
copyBatch(){
const hide = this.$message.loading('请求中..', 0);
copyBatchLeqLevel({cyear:Number(this.cYear),nyear:this.nYear}).then(res=>{
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
this.getOptions();
} else {
this.$message.error(res.data.msg);
}
this.showNYear = false;
}).catch(e => {
this.$message.error(e.message);
}).finally(() => {
hide();
})
},
exportData(){
const columns = this.columns.filter(item=>item.dataIndex);
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
} }
}, },
}; };
</script> </script>

View File

@@ -4,8 +4,6 @@
<a-form <a-form
:model="where" :model="where"
layout="vertical"
: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>
@@ -20,16 +18,16 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-row>
<a-col :lg="24" :md="24" :sm="24" :xs="24">
<a-space> <a-space>
<a-button type="primary" @click="reload">查询</a-button> <a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button> <a-button @click="reset">重置</a-button>
</a-space> </a-space>
</a-col> </a-col>
</a-row> </a-row>
<a-row>
</a-row>
</a-form> </a-form>
<a-modal <a-modal
v-model:visible="showNYear" v-model:visible="showNYear"
@@ -66,7 +64,7 @@
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" :wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
> >
<a-form-item label="年份" name="year"> <a-form-item label="年份" name="year">
<a-input v-model:value="form.year" placeholder="请输入年份" allow-clear/> <a-input-number v-model:value="form.year" :min="1970" :max="2050" />
</a-form-item> </a-form-item>
<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/>
@@ -127,6 +125,8 @@
:columns="columns" :columns="columns"
:where="where" :where="where"
:scroll="{ x: 'max-content' }" :scroll="{ x: 'max-content' }"
:need-page="false"
@done="(d) => (data = d.data)"
> >
<template #toolbar> <template #toolbar>
<a-space> <a-space>
@@ -159,6 +159,7 @@
>删除 >删除
</a-button> </a-button>
</a-popconfirm> </a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</a-space> </a-space>
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
@@ -202,6 +203,7 @@ import {
getColumnOptions getColumnOptions
} from "@/api/ecology/noise/road-noise-place"; } from "@/api/ecology/noise/road-noise-place";
import {DownOutlined} from '@ant-design/icons-vue'; import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
// import moment from "moment"; // import moment from "moment";
export default { export default {
name: "RoadNoisePlace", name: "RoadNoisePlace",
@@ -319,6 +321,7 @@ export default {
form: {}, form: {},
loading: false, loading: false,
rules: { rules: {
year: [{required: true, message: '请输入年份'}],
placeName: [{required: true, message: '请选择测点名称'}], placeName: [{required: true, message: '请选择测点名称'}],
placeLng: [{required: true, message: '请输入测点经度',},], placeLng: [{required: true, message: '请输入测点经度',},],
placeLat: [{required: true, message: '请输入测点纬度',},], placeLat: [{required: true, message: '请输入测点纬度',},],
@@ -458,6 +461,19 @@ export default {
}).finally(() => { }).finally(() => {
hide(); hide();
}) })
},
exportData(){
const columns = this.columns.filter(item=>item.dataIndex);
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
} }
}, },

View File

@@ -1,6 +1,52 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card :bordered="false"> <a-card :bordered="false">
<a-form
:model="where"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="年份:">
<a-select v-model:value="where.year" allow-clear show-search>
<a-select-option
v-for="(item) in yearOptions"
:key="item.value"
>{{ item.label }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-space>
</a-col>
</a-row>
<a-row>
</a-row>
</a-form>
<a-modal
v-model:visible="showNYear"
:title="'批量复制'"
:confirm-loading="loading"
:body-style="{ paddingBottom: '8px' }"
@ok="copyBatch"
>
<a-form
ref="form"
:model="form"
:rules="rules"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-form-item label="新年份" name="nYear">
<a-input-number id="inputNumber" v-model:value="nYear" :min="1970" :max="2050" />
</a-form-item>
</a-form>
</a-modal>
<a-modal <a-modal
v-model:visible="showEdit" v-model:visible="showEdit"
:title="form.id !== undefined ? '修改' : '添加'" :title="form.id !== undefined ? '修改' : '添加'"
@@ -16,6 +62,9 @@
: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-form-item label="年份" name="year">
<a-input-number v-model:value="form.year" :min="1970" :max="2050" />
</a-form-item>
<a-form-item label="最小值" name="minLeq"> <a-form-item label="最小值" name="minLeq">
<a-input-number @change="minLeqChange" :step=".1" :precision="1" v-model:value="form.minLeq" /> <a-input-number @change="minLeqChange" :step=".1" :precision="1" v-model:value="form.minLeq" />
</a-form-item> </a-form-item>
@@ -61,6 +110,19 @@
<template #toolbar> <template #toolbar>
<a-space> <a-space>
<a-button @click="openEdit" type="primary">新增</a-button> <a-button @click="openEdit" type="primary">新增</a-button>
<a-dropdown>
<template #overlay>
<a-menu @click="setCYear">
<a-menu-item v-for="item in yearOptions" :key="item.value">
{{ item.label }}
</a-menu-item>
</a-menu>
</template>
<a-button>
批量复制
<DownOutlined/>
</a-button>
</a-dropdown>
<a-popconfirm <a-popconfirm
:disabled="selectionList.length == 0" :disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`" :title="`确认删除${selectionList.length}条数据吗?`"
@@ -76,6 +138,7 @@
>删除 >删除
</a-button> </a-button>
</a-popconfirm> </a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</a-space> </a-space>
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
@@ -112,13 +175,17 @@ import {
saveLeqLevel, saveLeqLevel,
updateLeqLevel, updateLeqLevel,
removeLeqLevel, removeLeqLevel,
removeBatchLeqLevel removeBatchLeqLevel,
copyBatchLeqLevel,
getColumnOptions
} from "@/api/ecology/noise/zone-noise-leq-level"; } from "@/api/ecology/noise/zone-noise-leq-level";
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
// import moment from "moment"; // import moment from "moment";
export default { export default {
name: "ZoneNoiseLeqLevel", name: "ZoneNoiseLeqLevel",
components: {}, components: {DownOutlined},
data() { data() {
return { return {
data: [], data: [],
@@ -127,6 +194,11 @@ export default {
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{
title: "年份",
dataIndex: "year",
sorter: true,
},
{ {
title: "时段", title: "时段",
dataIndex: "timeSlot", dataIndex: "timeSlot",
@@ -175,6 +247,10 @@ export default {
selectionList: [], selectionList: [],
// 是否显示编辑弹窗 // 是否显示编辑弹窗
showEdit: false, showEdit: false,
showNYear:false,
cYear: undefined,
nYear:undefined,
yearOptions:[],
// 表单数据 // 表单数据
form: {}, form: {},
loading: false, loading: false,
@@ -189,6 +265,7 @@ export default {
}; };
}, },
mounted() { mounted() {
this.getOptions()
}, },
methods: { methods: {
minLeqChange(e){ minLeqChange(e){
@@ -231,6 +308,7 @@ export default {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions()
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -248,6 +326,7 @@ export default {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions()
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -292,6 +371,53 @@ export default {
}).finally(() => { }).finally(() => {
hide(); hide();
}) })
},
getOptions(){
getColumnOptions("year").then(res => {
console.log(res)
if (res.data.code == 0) {
this.yearOptions = res.data.data.map(item => {
return {
label: item,
value: item
}
})
}
})
},
setCYear(e){
this.cYear = e.key;
this.showNYear = true;
},
copyBatch(){
const hide = this.$message.loading('请求中..', 0);
copyBatchLeqLevel({cyear:Number(this.cYear),nyear:this.nYear}).then(res=>{
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
this.getOptions();
} else {
this.$message.error(res.data.msg);
}
this.showNYear = false;
}).catch(e => {
this.$message.error(e.message);
}).finally(() => {
hide();
})
},
exportData(){
const columns = this.columns.filter(item=>item.dataIndex);
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
} }
}, },

View File

@@ -1,6 +1,52 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card :bordered="false"> <a-card :bordered="false">
<a-form
:model="where"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="年份:">
<a-select v-model:value="where.year" allow-clear show-search>
<a-select-option
v-for="(item) in yearOptions"
:key="item.value"
>{{ item.label }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-space>
</a-col>
</a-row>
<a-row>
</a-row>
</a-form>
<a-modal
v-model:visible="showNYear"
:title="'批量复制'"
:confirm-loading="loading"
:body-style="{ paddingBottom: '8px' }"
@ok="copyBatch"
>
<a-form
ref="form"
:model="form"
:rules="rules"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-form-item label="新年份" name="nYear">
<a-input-number id="inputNumber" v-model:value="nYear" :min="1970" :max="2050"/>
</a-form-item>
</a-form>
</a-modal>
<a-modal <a-modal
v-model:visible="showEdit" v-model:visible="showEdit"
:title="form.zoneNoisePlaceId !== undefined ? '修改' : '添加'" :title="form.zoneNoisePlaceId !== undefined ? '修改' : '添加'"
@@ -16,48 +62,51 @@
: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-form-item label="年份" name="year">
<a-input-number v-model:value="form.year" :min="1970" :max="2050"/>
</a-form-item>
<a-form-item label="测点名称" name="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-form-item label="点位编码" name="placeCode">
<a-input v-model:value="form.placeCode" placeholder="请输入点位编码" allow-clear /> <a-input v-model:value="form.placeCode" placeholder="请输入点位编码" allow-clear/>
</a-form-item> </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="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>
<a-form-item label="监测仪器型号" name="monitorInstrumentModel"> <a-form-item label="监测仪器型号" name="monitorInstrumentModel">
<a-input v-model:value="form.monitorInstrumentModel" placeholder="请输入测监测仪器型号" allow-clear /> <a-input v-model:value="form.monitorInstrumentModel" placeholder="请输入测监测仪器型号" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="监测仪器编号" name="monitorInstrumentCode"> <a-form-item label="监测仪器编号" name="monitorInstrumentCode">
<a-input v-model:value="form.monitorInstrumentCode" placeholder="请输入监测仪器编号" allow-clear /> <a-input v-model:value="form.monitorInstrumentCode" placeholder="请输入监测仪器编号" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="监测前校准值" name="beforeMonitorValue"> <a-form-item label="监测前校准值" name="beforeMonitorValue">
<a-input v-model:value="form.beforeMonitorValue" placeholder="请输入监测前校准值" allow-clear /> <a-input v-model:value="form.beforeMonitorValue" placeholder="请输入监测前校准值" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="监测后校准值" name="afterMonitorValue"> <a-form-item label="监测后校准值" name="afterMonitorValue">
<a-input v-model:value="form.afterMonitorValue" placeholder="请输入监测后校准值" allow-clear /> <a-input v-model:value="form.afterMonitorValue" placeholder="请输入监测后校准值" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="声校准器测量声压值" name="soundPressureValue"> <a-form-item label="声校准器测量声压值" name="soundPressureValue">
<a-input v-model:value="form.soundPressureValue" placeholder="请输入声校准器测量声压值" allow-clear /> <a-input v-model:value="form.soundPressureValue" placeholder="请输入声校准器测量声压值" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="声校准仪器型号" name="soundInstrumentModel"> <a-form-item label="声校准仪器型号" name="soundInstrumentModel">
<a-input v-model:value="form.soundInstrumentModel" placeholder="请输入声校准仪器型号" allow-clear /> <a-input v-model:value="form.soundInstrumentModel" placeholder="请输入声校准仪器型号" allow-clear/>
</a-form-item> </a-form-item>
<a-form-item label="声校准仪器编号" name="soundInstrumentCode"> <a-form-item label="声校准仪器编号" name="soundInstrumentCode">
<a-input v-model:value="form.soundInstrumentCode" placeholder="请输入声校准仪器编号" allow-clear /> <a-input v-model:value="form.soundInstrumentCode" placeholder="请输入声校准仪器编号" allow-clear/>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
@@ -74,6 +123,19 @@
<template #toolbar> <template #toolbar>
<a-space> <a-space>
<a-button @click="openEdit" type="primary">新增</a-button> <a-button @click="openEdit" type="primary">新增</a-button>
<a-dropdown>
<template #overlay>
<a-menu @click="setCYear">
<a-menu-item v-for="item in yearOptions" :key="item.value">
{{ item.label }}
</a-menu-item>
</a-menu>
</template>
<a-button>
批量复制
<DownOutlined/>
</a-button>
</a-dropdown>
<a-popconfirm <a-popconfirm
:disabled="selectionList.length == 0" :disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`" :title="`确认删除${selectionList.length}条数据吗?`"
@@ -89,6 +151,7 @@
>删除 >删除
</a-button> </a-button>
</a-popconfirm> </a-popconfirm>
<a-button @click="exportData" type="primary">导出</a-button>
</a-space> </a-space>
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
@@ -98,7 +161,8 @@
type="primary" type="primary"
shape="round" shape="round"
size="small" size="small"
>修改</a-button >修改
</a-button
> >
<a-popconfirm <a-popconfirm
:title="`确认删除这条数据吗?`" :title="`确认删除这条数据吗?`"
@@ -107,7 +171,8 @@
@confirm="remove(record)" @confirm="remove(record)"
> >
<a-button type="primary" danger shape="round" size="small" <a-button type="primary" danger shape="round" size="small"
>删除</a-button >删除
</a-button
> >
</a-popconfirm> </a-popconfirm>
</a-space> </a-space>
@@ -125,12 +190,16 @@ import {
savePlace, savePlace,
updatePlace, updatePlace,
removePlace, removePlace,
removeBatchPlace removeBatchPlace,
copyBatchPlace,
getColumnOptions
} from "@/api/ecology/noise/zone-noise-place"; } from "@/api/ecology/noise/zone-noise-place";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
// import moment from "moment"; // import moment from "moment";
export default { export default {
name: "ZoneNoisePlace", name: "ZoneNoisePlace",
components: {}, components: {DownOutlined},
data() { data() {
return { return {
data: [], data: [],
@@ -139,6 +208,11 @@ export default {
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{
title: "年份",
dataIndex: "year",
sorter: true,
},
{ {
title: "测点名称", title: "测点名称",
dataIndex: "placeName", dataIndex: "placeName",
@@ -213,22 +287,28 @@ export default {
// 表格搜索条件 // 表格搜索条件
where: {}, where: {},
yearOptions: [],
// 表格选中数据 // 表格选中数据
selectionList: [], selectionList: [],
// 是否显示编辑弹窗 // 是否显示编辑弹窗
showEdit: false, showEdit: false,
showNYear: false,
cYear: undefined,
nYear: undefined,
// 表单数据 // 表单数据
form: {}, form: {},
loading: false, loading: false,
rules: { rules: {
placeName:[{required: true,message: '请输入测点名称'}], year: [{required: true, message: '请输入年份'}],
placeCode:[{required: true,message: '请输入点位编码'}], placeName: [{required: true, message: '请输入测点名称'}],
placeLng: [{required: true,message: '请输入测点经度',},], placeCode: [{required: true, message: '请输入点位编码'}],
placeLat: [{required: true,message: '请输入测点度',},], placeLng: [{required: true, message: '请输入测点度',},],
placeLat: [{required: true, message: '请输入测点纬度',},],
}, },
}; };
}, },
mounted() { mounted() {
this.getOptions();
}, },
methods: { methods: {
/* 刷新表格 */ /* 刷新表格 */
@@ -238,6 +318,19 @@ export default {
where: this.where, where: this.where,
}); });
}, },
getOptions() {
getColumnOptions("year").then(res => {
console.log(res)
if (res.data.code == 0) {
this.yearOptions = res.data.data.map(item => {
return {
label: item,
value: item
}
})
}
})
},
/* 重置搜索 */ /* 重置搜索 */
reset() { reset() {
this.where = {}; this.where = {};
@@ -263,6 +356,8 @@ export default {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions();
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -280,6 +375,8 @@ export default {
this.showEdit = false; this.showEdit = false;
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
this.getOptions();
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@@ -324,9 +421,44 @@ export default {
}).finally(() => { }).finally(() => {
hide(); hide();
}) })
},
setCYear(e) {
this.cYear = e.key;
this.showNYear = true;
},
copyBatch() {
const hide = this.$message.loading('请求中..', 0);
copyBatchPlace({cyear: Number(this.cYear), nyear: this.nYear}).then(res => {
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
this.getOptions();
} else {
this.$message.error(res.data.msg);
}
this.showNYear = false;
}).catch(e => {
this.$message.error(e.message);
}).finally(() => {
hide();
})
},
exportData() {
const columns = this.columns.filter(item => item.dataIndex);
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
} }
},
}
}; };
</script> </script>

View File

@@ -1,193 +1,211 @@
<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 label="区域等级">
<a-button type="primary" @click="reload">查询</a-button> <a-select v-model:value="where.regionLevel" allowClear showSearch>
<!-- <a-button @click="reset">重置</a-button> --> <a-select-option
<a-button @click="exportFile">导出Excel</a-button> v-for="item in regionLevelOptions"
</a-space> :key="item.value"
</a-form-item> >{{ item.label }}
</a-col> </a-select-option
</a-row> >
</a-form> </a-select>
<!-- 表格 --> </a-form-item>
<ele-pro-table </a-col>
v-model:selection="selectionList" <a-col :lg="6" :md="12" :sm="24" :xs="24">
ref="table" <a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }">
:row-key="(record) => record.source + record.timeSlot" <a-space>
:datasource="url" <a-button type="primary" @click="reload">查询</a-button>
:columns="columns" <!-- <a-button @click="reset">重置</a-button> -->
:where="where" <a-button @click="exportFile">导出Excel</a-button>
:needPage="false" </a-space>
:initLoad="false" </a-form-item>
:scroll="{ x: 'max-content' }" </a-col>
@done="(d) => (data = d.data)" </a-row>
> </a-form>
</ele-pro-table> <!-- 表格 -->
</a-card> <ele-pro-table
</div> v-model:selection="selectionList"
<!-- 编辑弹窗 --> ref="table"
:row-key="(record) => record.source + record.timeSlot"
:datasource="url"
:columns="columns"
:where="where"
:needPage="false"
:initLoad="false"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template> </template>
<script> <script>
// import _ from "lodash"; // import _ from "lodash";
import XLSX from "xlsx"; import XLSX from "xlsx";
import { statisticSourceUrl, getColumnOptions } from "@/api/ecology/noise/zone-sound"; import {statisticSourceUrl, 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: statisticSourceUrl, url: statisticSourceUrl,
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: {regionLevel :"市级"},
yearOptions: [], regionLevelOptions:[
// 表格选中数据 {label: "市级",value: "市级"},
selectionList: [], {label: "县级",value: "县级"}
}; ],
}, yearOptions: [],
mounted() { // 表格选中数据
this.loadOptionData(); selectionList: [],
}, };
methods: { },
/**获取下来框数据 */ mounted() {
loadOptionData() { this.loadOptionData();
getColumnOptions("monitor_year").then((res) => { },
this.yearOptions = res.data.data.map((item) => { methods: {
return { /**获取下来框数据 */
label: item, loadOptionData() {
value: item, getColumnOptions("monitor_year").then((res) => {
}; this.yearOptions = res.data.data.map((item) => {
}); return {
label: item,
value: item,
};
});
this.where.year = this.yearOptions[0].value; this.where.year = this.yearOptions[0].value;
this.reload();
});
},
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.reload();
},
exportFile() {
const columns = [
{
title: "噪声源分类",
dataIndex: "source",
},
{
title: "测点数",
dataIndex: "count",
},
{
title: "声源占比%",
dataIndex: "rate",
},
{
title: "时段",
dataIndex: "timeSlot",
},
{ this.reload();
title: "Leq", });
dataIndex: "leq",
}, },
{ /* 刷新表格 */
title: "L10", reload() {
dataIndex: "l10", this.$refs.table.reload({
where: this.where,
});
}, },
{ /* 重置搜索 */
title: "L50", reset() {
dataIndex: "l50", this.reload();
}, },
{ exportFile() {
title: "L90", const columns = [
dataIndex: "l90", {
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());
}, },
];
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>