城市部分导出调整
This commit is contained in:
@@ -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());
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export default {
|
|||||||
columns:[
|
columns:[
|
||||||
{title:"城市名称",dataIndex:"city",},
|
{title:"城市名称",dataIndex:"city",},
|
||||||
{title:"水源地名称",dataIndex:"place",},
|
{title:"水源地名称",dataIndex:"place",},
|
||||||
{title:"期数",dataIndex:"sourceWaterName",},
|
{title:"期数",dataIndex:"sourceWaterName",},
|
||||||
{title:"水源地性质",dataIndex:"waterSourceProperty",},
|
{title:"水源地性质",dataIndex:"waterSourceProperty",},
|
||||||
{title:"断面水质",align: 'center',children: [
|
{title:"断面水质",align: 'center',children: [
|
||||||
{title: "本月", dataIndex: ""},
|
{title: "本月", dataIndex: ""},
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -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());
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user