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

@@ -9,13 +9,31 @@
: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-form-item label="时间范围:">
<a-range-picker v-model:value="time"/>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="区域等级:"> <a-form-item label="区域等级:">
<a-select v-model:value="where.regionLevel" allowClear showSearch> <a-select v-model:value="where.regionLevel" allowClear showSearch>
<a-select-option <a-select-option
v-for="(item) in regionLevelOptions" v-for="(item) in regionLevelOptions"
:key="item.value" :key="item.value"
>{{ item.label }}</a-select-option >{{ item.label }}
</a-select-option
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="监测点:">
<a-select v-model:value="where.place" allowClear showSearch>
<a-select-option
v-for="(item) in placeOptions"
:key="item.value"
>{{ item.label }}
</a-select-option
> >
</a-select> </a-select>
</a-form-item> </a-form-item>
@@ -146,7 +164,14 @@ export default {
sorter: true, sorter: true,
} }
], ],
regionLevelOptions: [], regionLevelOptions: [
{label: "市区", value: "city"},
{label: "城区", value: "area"},
{label: "县区", value: "county"},
{label: "站点", value: "place"},
],
placeOptions:[],
time:[],
// 表格搜索条件 // 表格搜索条件
where: { where: {
checked: 1, checked: 1,
@@ -161,8 +186,8 @@ export default {
methods: { methods: {
/**获取下来框数据 */ /**获取下来框数据 */
loadOptionData() { loadOptionData() {
getColumnOptions("region_level").then((res) => { getColumnOptions("place").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => { this.placeOptions = res.data.data.map((item) => {
return { return {
label: item, label: item,
value: item, value: item,

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,7 +376,55 @@ 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

@@ -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,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>
@@ -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,14 +287,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: '请输入年份'}],
placeName: [{required: true, message: '请输入测点名称'}], placeName: [{required: true, message: '请输入测点名称'}],
placeCode: [{required: true, message: '请输入点位编码'}], placeCode: [{required: true, message: '请输入点位编码'}],
placeLng: [{required: true, message: '请输入测点经度',},], placeLng: [{required: true, message: '请输入测点经度',},],
@@ -229,6 +308,7 @@ export default {
}; };
}, },
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

@@ -14,7 +14,20 @@
<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-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="区域等级">
<a-select v-model:value="where.regionLevel" allowClear showSearch>
<a-select-option
v-for="item in regionLevelOptions"
:key="item.value"
>{{ item.label }}
</a-select-option
> >
</a-select> </a-select>
</a-form-item> </a-form-item>
@@ -107,7 +120,11 @@ export default {
}, },
], ],
// 表格搜索条件 // 表格搜索条件
where: {}, where: {regionLevel :"市级"},
regionLevelOptions:[
{label: "市级",value: "市级"},
{label: "县级",value: "县级"}
],
yearOptions: [], yearOptions: [],
// 表格选中数据 // 表格选中数据
selectionList: [], selectionList: [],
@@ -128,6 +145,7 @@ export default {
}); });
this.where.year = this.yearOptions[0].value; this.where.year = this.yearOptions[0].value;
this.reload(); this.reload();
}); });
}, },