功能区导出

This commit is contained in:
weicw
2022-01-28 06:53:14 +08:00
parent 6673a659ab
commit c930b4d181

View File

@@ -74,7 +74,8 @@
<a-space> <a-space>
<a-button type="primary" @click="reload">查询</a-button> <a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置</a-button> <a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置</a-button>
<a-button @click="exportFile" style="background: #2FA524FF; border-color: #2FA524FF;color: #FFFFFF">导出Excel</a-button> <a-button @click="exportCityFile" style="background: #2FA524FF; border-color: #2FA524FF;color: #FFFFFF">市级模板导出</a-button>
<a-button @click="exportCountyFile" style="background: #2FA524FF; border-color: #2FA524FF;color: #FFFFFF">县级模板导出</a-button>
</a-space> </a-space>
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -379,7 +380,150 @@ export default {
}; };
this.reload(); this.reload();
}, },
exportFile() { exportCityFile() {
const columns = [
{
title: "监测日期及时间",
dataIndex: "monitorTime",
},
{
title: "点位名称",
dataIndex: "place",
sorter: true,
},
{
title: "点位编码",
dataIndex: "placeCode",
sorter: true,
},
{
title: "功能区类别",
dataIndex: "functionType",
sorter: true,
},
{
title: "Leq dB(A)",
dataIndex: "indexLeq",
},
{
title: "SD",
dataIndex: "indexSd",
},
{
title: "L10 dB(A)",
dataIndex: "indexL10",
},
{
title: "L50 dB(A)",
dataIndex: "indexL50",
},
{
title: "L90 dB(A)",
dataIndex: "indexL90",
},
{
title: "Lmax dB(A)",
dataIndex: "indexLmax",
},
{
title: "Lmin dB(A)",
dataIndex: "indexLmin",
},
{
title: "测点经度",
dataIndex: "placeLng",
sorter: true,
},
{
title: "测点纬度",
dataIndex: "placeLat",
sorter: true,
},
{
title: "测点高度",
dataIndex: "placeHeight",
sorter: true,
},
{
title: "测点参照物",
dataIndex: "refObj",
sorter: true,
},
{
title: "功能区代码",
dataIndex: "functionCode",
sorter: true,
},
// {
// title: "监测站名",
// dataIndex: "station",
// sorter: true,
// },
{
title: "监测仪器型号",
dataIndex: "monitorInstrumentModel",
sorter: true,
},
{
title: "监测仪器编号",
dataIndex: "monitorInstrumentCode",
sorter: true,
},
{
title: "监测前校准值",
dataIndex: "beforeMonitorValue",
sorter: true,
},
{
title: "声校准器测量声压值",
dataIndex: "soundPressureValue",
sorter: true,
},
{
title: "声校准仪器型号",
dataIndex: "soundInstrumentModel",
sorter: true,
},
{
title: "声校准仪器编号",
dataIndex: "soundInstrumentCode",
sorter: true,
},
{
title: "区域等级",
dataIndex: "regionLevel",
sorter: true,
},
];
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
listAllFunctionNoise(this.where).then(res=>{
if(res.data.code == 0){
res.data.data.forEach((d) => {
const td = columns.map((item) => {
let val = d[item.dataIndex];
if(["indexLeq","indexL10","indexL50","indexL90","indexLmax","indexLmin","indexSd"].includes(item.dataIndex)){
val = Number(val).toFixed(1);
}else if(item.dataIndex == "monitorTime"){
return moment(val).format("YYYY-MM-DD HH:mm")
}
return val;
});
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
}
})
},
exportCountyFile() {
const columns = [ const columns = [
{ {
title: "行政区划代码", title: "行政区划代码",
@@ -518,11 +662,11 @@ export default {
dataIndex: "soundInstrumentCode", dataIndex: "soundInstrumentCode",
sorter: true, sorter: true,
}, },
{ // {
title: "区域等级", // title: "区域等级",
dataIndex: "regionLevel", // dataIndex: "regionLevel",
sorter: true, // sorter: true,
}, // },
{ {
title: "备注", title: "备注",
dataIndex: "remark", dataIndex: "remark",