From 9a93c2b1d872f5348f6fcd1e279db3e25f0495e4 Mon Sep 17 00:00:00 2001 From: linfso Date: Fri, 6 Sep 2024 15:53:09 +0800 Subject: [PATCH] md --- .../panel/SiteWaitOpenBillPanel.vue | 4 +- .../emisSettleSubBill/SubBillMonthSumList.vue | 116 +++++++++++++++++- .../emis/emisWaybill/centerWaybillList.vue | 43 +++---- 3 files changed, 134 insertions(+), 29 deletions(-) diff --git a/src/views/emis/emisSettleBill/panel/SiteWaitOpenBillPanel.vue b/src/views/emis/emisSettleBill/panel/SiteWaitOpenBillPanel.vue index f8668c8f..39352e55 100644 --- a/src/views/emis/emisSettleBill/panel/SiteWaitOpenBillPanel.vue +++ b/src/views/emis/emisSettleBill/panel/SiteWaitOpenBillPanel.vue @@ -150,7 +150,7 @@ - + @@ -208,7 +208,7 @@ - + diff --git a/src/views/emis/emisSettleSubBill/SubBillMonthSumList.vue b/src/views/emis/emisSettleSubBill/SubBillMonthSumList.vue index 4e39e5bc..29e5826f 100644 --- a/src/views/emis/emisSettleSubBill/SubBillMonthSumList.vue +++ b/src/views/emis/emisSettleSubBill/SubBillMonthSumList.vue @@ -31,6 +31,13 @@ + + + + + + + @@ -63,6 +70,9 @@ @selection-change="handleSelectionChange" @row-dblclick="handleSumDblClick" + show-summary + :summary-method="getSummaries" + > @@ -200,7 +210,7 @@ export default { currentTraceBillItem:null, currentTraceBillCode:null, - // 时间搜索 + // 时间搜索 // 弹出展示层 id:null, titleView:"", @@ -456,7 +466,6 @@ export default { }, - // 获取当前月的最后一天 getMonthLast(date) { var currentMonth = date.getMonth() @@ -500,6 +509,109 @@ export default { this.openForm = false; }, + + // + // + // + // + // + // + // + + + //指定列求和 + getSummaries(param) { + const { columns, data } = param; + const sums = []; + columns.forEach((column, index) => { + if (index === 0) { + sums[index] = '合计'; + return; + } + + + if ( + column.property === 'totalNum' + ) { + const values = data.map(item => Number(item.waybillDetail.billWeight)); + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr); + if (!isNaN(value)) { + return prev + curr; + } else { + return prev; + } + }, 0); + sums[index] = sums[index].toFixed(2); //保留2位小数 + } + + else if ( + column.property === 'waybillDetail.volumeWeight' + + ) { + const values = data.map(item => Number(item.waybillDetail.volumeWeight)); + + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr); + if (!isNaN(value)) { + return prev + curr; + } else { + return prev; + } + }, 0); + sums[index] = sums[index].toFixed(2); //保留2位小数 + } + else if ( + column.property === 'waybillDetail.freight' + + ) { + const values = data.map(item => Number(item.waybillDetail.freight)); + + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr); + if (!isNaN(value)) { + return prev + curr; + } else { + return prev; + } + }, 0); + sums[index] = sums[index].toFixed(2); //保留2位小数 + } + + else if ( + column.property === 'waybillDetail.totalVolume' + ) { + const values = data.map(item => Number(item.waybillDetail.totalVolume)); + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr); + if (!isNaN(value)) { + return prev + curr; + } else { + return prev; + } + }, 0); + sums[index] = sums[index].toFixed(5); //保留2位小数 + } + else if( + column.property === 'waybillDetail.parcelQty' + ){ + const values = data.map(item => Number(item.waybillDetail.parcelQty)); + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr); + if (!isNaN(value)) { + return prev + curr; + } else { + return prev; + } + }, 0); + sums[index]; + } + }); + // console.log(sums); + return sums + }, + + /** 导出按钮操作 */ handleExport() { const loadingInstance = this.$loading({ diff --git a/src/views/emis/emisWaybill/centerWaybillList.vue b/src/views/emis/emisWaybill/centerWaybillList.vue index 71ab3a0e..c72d3e01 100644 --- a/src/views/emis/emisWaybill/centerWaybillList.vue +++ b/src/views/emis/emisWaybill/centerWaybillList.vue @@ -891,31 +891,24 @@ export default { this.openTraceInfo=true; }, initQueryParams(){ - // this.queryOrderType="1"; - // this.queryOrderDateType="1"; - - if(this.queryParams.billCode){ - if(this.queryOrderType != "1"){ - this.queryParams.orderSn=formatSearchStr(this.queryParams.billCode); - this.queryParams.billCode=null; - }else{ - // 处理子单号 - let qBillCode=formatSearchStr(this.queryParams.billCode); - let billArr = qBillCode.split(","); - let newBillCodeStr=""; - billArr.forEach(item=>{ - if(item.startsWith("T")){ - let mainBillCode=item.substr(0,14); - newBillCodeStr=newBillCodeStr+mainBillCode+","; - }else{ - newBillCodeStr=newBillCodeStr+item+","; - } - }); - this.queryParams.billCode=newBillCodeStr; - - } - } this.queryParams=this.addDateRange(this.queryParams, this.dateRange,"sendDate"); + let qParam=null; + if(this.queryParams.billCode){ + qParam={ + pageNum:this.queryParams.pageNum, + pageSize:this.queryParams.pageSize, + billCode:this.queryParams.billCode, + } + }else{ + + if(this.$store.getters.ownerSiteCode!='88888'&&(this.queryParams.salesmen==null||this.queryParams.salesmen=='')&&(this.queryParams.custNo==null||this.queryParams.salesmen=='') ){ + this.queryParams.sendSiteCode=this.$store.getters.ownerSiteCode; + } + + qParam=this.queryParams + } + + return qParam; }, /** 查询运单列表列表 */ getList() { @@ -950,7 +943,7 @@ export default { }, // 多选框选中数据 handleSelectionChange(selection) { - if(selection!=null){ + if(selection!=null&&selection.length>0){ this.billCode=selection[0].billCode; } this.selectionList=selection;