From d90b19ea82c76d620cf51ae51e184ffb5c2b5aba Mon Sep 17 00:00:00 2001 From: wuteng <419274783@qq.com> Date: Tue, 18 Nov 2025 16:36:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5=E6=88=90?= =?UTF-8?q?=E6=9C=AC=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../emisTmsCostFee/BatchImportCostFee.vue | 55 ++++++++++++++++--- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/src/views/emis/emisTmsCostFee/BatchImportCostFee.vue b/src/views/emis/emisTmsCostFee/BatchImportCostFee.vue index 7bd5bc85..215d1643 100644 --- a/src/views/emis/emisTmsCostFee/BatchImportCostFee.vue +++ b/src/views/emis/emisTmsCostFee/BatchImportCostFee.vue @@ -45,7 +45,8 @@ @queryTable="getList" @selection-change="handleSelectionChange" @sort-change="handleSortChange" - + show-summary + :summary-method="getSummaries" > @@ -446,7 +447,8 @@ export default { // 判断批次是否存在 获取批次信息 let carNo=orderData['运输单号']; let etd=orderData['成本时间']; - let resBatch=await listBySupplerAndCarNo(supplierCode,carNo,etd); + // let resBatch=await listBySupplerAndCarNo(supplierCode,carNo,etd); + let resBatch=await listBySupplerAndCarNo(supplierCode,carNo); if(resBatch&&resBatch.code==200){ if(resBatch.rows&&resBatch.rows.length==0){ orderData.uploadStatus=-1; @@ -458,8 +460,13 @@ export default { } else{ let batchItem=resBatch.rows[0]; - this.$set(orderData,"batchItem",batchItem) ; - this.$set(orderData,"batchNo",batchItem.batchNo) ; + if(etd && batchItem.etd!==etd){ + orderData.uploadStatus=-1; + orderData.errorInfo='成本时间不一致'; + }else{ + this.$set(orderData,"batchItem",batchItem) ; + this.$set(orderData,"batchNo",batchItem.batchNo) ; + } } }else{ orderData.uploadStatus=-1; @@ -591,8 +598,8 @@ export default { }else{ - orderItem.uploadStatus=-1; - orderItem.errorInfo='批次不存在'; + // orderItem.uploadStatus=-1; + // orderItem.errorInfo='批次不存在'; continue; } @@ -673,8 +680,40 @@ export default { getIndex($index) { return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1 }, - - } + //指定列求和 + getSummaries(param) { + const { columns, data } = param; + const sums = []; + columns.forEach((column, index) => { + if (index === 0) { + sums[index] = '合计'; + return; + } else if (column.property === 'uploadStatus') { + //计数 + sums[index] = data.length+ ' 条'; + } else if ( column.property === 'errorInfo') { + sums[index] = ''; + } else { + const values = data.map(item => Number(item[column.property])); + if (!values.every(value => isNaN(value))) { + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr); + if (!isNaN(value)) { + return prev + curr; + } else { + return prev; + } + }, 0); + //保留2位小数 + sums[index] = sums[index].toFixed(2); + } else { + sums[index] = ''; + } + } + }); + return sums; + } + } };