|
@@ -161,7 +161,7 @@ export default {
|
|
|
// this.getQuerys(option, null);
|
|
|
this.listname =
|
|
|
"拉货明细统计" + data.dateTime[0] + "--" + data.dateTime[1];
|
|
|
- this.listHeader = ["序号", "日期", "航班号", "运单号"];
|
|
|
+ this.listHeader = ["序号", "日期", "航班号", "运单号", '重量'];
|
|
|
},
|
|
|
//获取表格数据
|
|
|
async getQuery(data, dat) {
|
|
@@ -195,6 +195,7 @@ export default {
|
|
|
// }
|
|
|
// }
|
|
|
this.listall.alllist = this.tableList.length;
|
|
|
+ this.listall.allwei = 0
|
|
|
for (let i = 0; i < this.tableList.length; i++) {
|
|
|
this.listall.allwei += this.tableList[i].weight;
|
|
|
}
|
|
@@ -241,9 +242,16 @@ export default {
|
|
|
* 源数据导入到excel的数据每一条重新拼成一个数组,数组里的每个元素就是filterVal里的每个字段
|
|
|
*/
|
|
|
const data = this.tableListcop.map((item, index) => {
|
|
|
- return [item.indexs, item.flightDate, item.flightNO, item.stockCode];
|
|
|
+ return [item.indexs, item.flightDate, item.flightNO, item.stockCode, item.weight];
|
|
|
});
|
|
|
- data[data.length - 1].indexs = "总计";
|
|
|
+ const originalSummaryRow = Array.from(
|
|
|
+ { length: this.listHeader.length },
|
|
|
+ (_, i) => i === 0 ? '合计' : i < this.listHeader.length - 1 ? '' : 0
|
|
|
+ )
|
|
|
+ const summaryRow = data.reduce((prev, curr) => {
|
|
|
+ return prev.map((v, i) => i < this.listHeader.length - 1 ? v : v + (curr[i] ?? 0))
|
|
|
+ }, originalSummaryRow)
|
|
|
+ data.push(summaryRow)
|
|
|
// 调用我们封装好的方法进行导出Excel
|
|
|
excel.export_json_to_excel({
|
|
|
// 导出的头部
|