城市部分导出调整
This commit is contained in:
@@ -200,6 +200,7 @@ export default {
|
||||
const td = columns.map((item) => d[item.dataIndex]);
|
||||
arr.push(td);
|
||||
});
|
||||
arr.push([`饮用水源水质监测累积月份统计样品数:${this.count}个`]);
|
||||
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
||||
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
|
||||
},
|
||||
|
||||
@@ -74,7 +74,7 @@ export default {
|
||||
columns:[
|
||||
{title:"城市名称",dataIndex:"city",},
|
||||
{title:"水源地名称",dataIndex:"place",},
|
||||
{title:"期数",dataIndex:"sourceWaterName",},
|
||||
{title:"期数",dataIndex:"sourceWaterName",},
|
||||
{title:"水源地性质",dataIndex:"waterSourceProperty",},
|
||||
{title:"断面水质",align: 'center',children: [
|
||||
{title: "本月", dataIndex: ""},
|
||||
@@ -143,20 +143,38 @@ export default {
|
||||
};
|
||||
this.reload();
|
||||
},
|
||||
|
||||
exportFile() {
|
||||
const columns = [
|
||||
...this.columns,
|
||||
];
|
||||
const columns = [...this.columns];
|
||||
const arr = [];
|
||||
const th = columns.map((item) => item.title);
|
||||
arr.push(th);
|
||||
this.data.forEach((d) => {
|
||||
const td = columns.map((item) => d[item.dataIndex]);
|
||||
let th1 = []
|
||||
let th2 = []
|
||||
const sColumns = []
|
||||
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);
|
||||
});
|
||||
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
||||
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
|
||||
},
|
||||
|
||||
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -200,6 +200,7 @@ export default {
|
||||
const td = columns.map((item) => d[item.dataIndex]);
|
||||
arr.push(td);
|
||||
});
|
||||
arr.push([`饮用水源水质监测累积月份统计样品数:${this.count}个`]);
|
||||
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
||||
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user