diff --git a/src/components/ArteryPrintTemplate/ArteryPrintTemplate.vue b/src/components/ArteryPrintTemplate/ArteryPrintTemplate.vue index fe1c5a41..3380f4ed 100644 --- a/src/components/ArteryPrintTemplate/ArteryPrintTemplate.vue +++ b/src/components/ArteryPrintTemplate/ArteryPrintTemplate.vue @@ -132,11 +132,21 @@ {{ index + 1 }} - + {{ value.shipper || '' }} - + {{ value.createTime || '' }} @@ -148,19 +158,38 @@ {{ value.destinationWarehouseName || '' }} - + {{ value.consignee }} - + {{ value.consigneeName }} - + {{ value.consigneeMobile }} - + {{ value.waybillNo }} @@ -262,13 +291,47 @@ renderInfo.value = waybillInfo; const isShowTotal = ref(false); renderInfo.value.endWarehouseNames = renderInfo.value.endWarehouseNames.split(','); + +// 合并起始索引 +let mergeStartIndex = 0; +// 比对值 +let comparisonValue = ''; +renderInfo.value.mainList[0].mergeColumnIndex = 1; + +const handleMerge = (startIndex: number, endIndex: number, data: {}) => { + for (let index = startIndex; index < endIndex; index++) { + const value = data[index]; + + if (index === startIndex) value.mergeColumnIndex = endIndex - startIndex; + else { + value.mergeColumnIndex = 0; + } + } +}; + for (let index = 0; index < renderInfo.value.mainList.length; index++) { const element = renderInfo.value.mainList[index]; + if (index === 0) comparisonValue = element.waybillNo; + totalNum.value += element.smallTotal || 0; totalUnLoadNum.value += element.unloadNum || 0; totalPlanNum.value += element.planNum || 0; + if (element.waybillNo !== comparisonValue) { + // if (index === 1) mergeStartIndex = 1; + comparisonValue = element.waybillNo; + handleMerge(mergeStartIndex, index, renderInfo.value.mainList); + mergeStartIndex = index; + + if (index === renderInfo.value.mainList.length - 1) { + handleMerge(mergeStartIndex, index + 1, renderInfo.value.mainList); + } + // 最后一位特殊处理 + } else if (index === renderInfo.value.mainList.length - 1) { + handleMerge(mergeStartIndex, index + 1, renderInfo.value.mainList); + } + if (element.goodsList && element.goodsList.length > 0) { for (let i = 0; i < element.goodsList.length; i++) { const item = element.goodsList[i]; diff --git a/src/components/TripartiteTransferPrintTemplate/TripartiteTransferPrintTemplate.vue b/src/components/TripartiteTransferPrintTemplate/TripartiteTransferPrintTemplate.vue index a42c7e42..0e51ce6e 100644 --- a/src/components/TripartiteTransferPrintTemplate/TripartiteTransferPrintTemplate.vue +++ b/src/components/TripartiteTransferPrintTemplate/TripartiteTransferPrintTemplate.vue @@ -61,17 +61,29 @@ {{ index + 1 }} - {{ value.shipper || '' }} + + {{ value.shipper || '' }} + - {{ value.createTime || '' }} + + {{ value.createTime || '' }} + - {{ value.consignee }} + + {{ value.consignee }} + - {{ value.consigneeName }} + + {{ value.consigneeName }} + - {{ value.consigneeMobile }} + + {{ value.consigneeMobile }} + - {{ value.waybillNo }} + + {{ value.waybillNo }} + {{ value.orderCode }} @@ -141,14 +153,47 @@ renderInfo.value = waybillInfo; /** 是否显示金额统计 */ const isShowTotal = ref(false); +// 合并起始索引 +let mergeStartIndex = 0; +// 比对值 +let comparisonValue = ''; +renderInfo.value.mainList[0].mergeColumnIndex = 1; + +const handleMerge = (startIndex: number, endIndex: number, data: {}) => { + for (let index = startIndex; index < endIndex; index++) { + const value = data[index]; + + if (index === startIndex) value.mergeColumnIndex = endIndex - startIndex; + else { + value.mergeColumnIndex = 0; + } + } +}; + renderInfo.value.endWarehouseNames = renderInfo.value.endWarehouseNames.split(','); for (let index = 0; index < renderInfo.value.mainList.length; index++) { const element = renderInfo.value.mainList[index]; + if (index === 0) comparisonValue = element.waybillNo; + totalNum.value += element.smallTotal || 0; totalUnLoadNum.value += element.unloadNum || 0; totalPlanNum.value += element.planNum || 0; + if (element.waybillNo !== comparisonValue) { + // if (index === 1) mergeStartIndex = 1; + comparisonValue = element.waybillNo; + handleMerge(mergeStartIndex, index, renderInfo.value.mainList); + mergeStartIndex = index; + + if (index === renderInfo.value.mainList.length - 1) { + handleMerge(mergeStartIndex, index + 1, renderInfo.value.mainList); + } + // 最后一位特殊处理 + } else if (index === renderInfo.value.mainList.length - 1) { + handleMerge(mergeStartIndex, index + 1, renderInfo.value.mainList); + } + if (element.goodsList && element.goodsList.length > 0) { for (let i = 0; i < element.goodsList.length; i++) { const item = element.goodsList[i]; diff --git a/src/utils/print.js b/src/utils/print.js index 72e5ee85..24077de9 100644 --- a/src/utils/print.js +++ b/src/utils/print.js @@ -25,7 +25,7 @@ const handleDeliveryPrint = (LODOP, templateData) => { // LODOP.SET_PRINT_STYLE('FontColor', '#000000'); // // 设置打印整宽且不变形 LODOP.SET_PRINT_MODE('PRINT_PAGE_PERCENT', '100%'); - LODOP.SET_PRINT_PAGESIZE(1, 2160, 1396, ''); + LODOP.SET_PRINT_PAGESIZE(1, 2160, 1396.5, ''); // // 设置打印后自动关闭 LODOP.SET_PRINT_MODE('AUTO_CLOSE_PREWINDOW', 1);