城市部分导出调整

This commit is contained in:
庞东林
2021-12-10 17:05:37 +08:00
parent 326817bc02
commit c95c693570
3 changed files with 28 additions and 8 deletions

View File

@@ -200,6 +200,7 @@ export default {
const td = columns.map((item) => d[item.dataIndex]); const td = columns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });
arr.push([`饮用水源水质监测累积月份统计样品数:${this.count}`]);
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());
}, },

View File

@@ -143,20 +143,38 @@ export default {
}; };
this.reload(); this.reload();
}, },
exportFile() { exportFile() {
const columns = [ const columns = [...this.columns];
...this.columns,
];
const arr = []; const arr = [];
const th = columns.map((item) => item.title); let th1 = []
arr.push(th); let th2 = []
this.data.forEach((d) => { const sColumns = []
const td = columns.map((item) => d[item.dataIndex]); columns.forEach(item=>{
th1.push(item.title)
if(Array.isArray(item.children) && item.children.length>0){
item.children.forEach(single=>{
th1.push('')
th2.push(single.title)
sColumns.push({dataIndex:single.dataIndex})
})
}else{
th2.push('')
sColumns.push({dataIndex:item.dataIndex})
}
})
arr.push(th1)
arr.push(th2)
this.datasource.forEach((d) => {
const td = sColumns.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

@@ -200,6 +200,7 @@ export default {
const td = columns.map((item) => d[item.dataIndex]); const td = columns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });
arr.push([`饮用水源水质监测累积月份统计样品数:${this.count}`]);
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());
}, },