Browse Source

修复打印

dev-xx
qb 5 months ago
parent
commit
8280e45b2c
  1. 75
      src/components/ArteryPrintTemplate/ArteryPrintTemplate.vue
  2. 57
      src/components/TripartiteTransferPrintTemplate/TripartiteTransferPrintTemplate.vue
  3. 2
      src/utils/print.js

75
src/components/ArteryPrintTemplate/ArteryPrintTemplate.vue

@ -132,11 +132,21 @@
<tr v-for="(value, index) in renderInfo.mainList" style="word-break: break-all">
<td style="border-bottom: 1px solid #000; border-left: 1px solid #000">{{ index + 1 }}</td>
<!-- 发货单位 -->
<td style="border-bottom: 1px solid #000; border-left: 1px solid #000" contenteditable>
<td
v-if="value.mergeColumnIndex"
style="border-bottom: 1px solid #000; border-left: 1px solid #000"
:rowspan="value.mergeColumnIndex"
contenteditable
>
{{ value.shipper || '' }}
</td>
<!-- 开单时间 -->
<td style="border-bottom: 1px solid #000; border-left: 1px solid #000" contenteditable>
<td
v-if="value.mergeColumnIndex"
style="border-bottom: 1px solid #000; border-left: 1px solid #000"
:rowspan="value.mergeColumnIndex"
contenteditable
>
{{ value.createTime || '' }}
</td>
<!-- 始发仓 -->
@ -148,19 +158,38 @@
{{ value.destinationWarehouseName || '' }}
</td>
<!-- 收货单位 -->
<td style="border-bottom: 1px solid #000; border-left: 1px solid #000" contenteditable>
<td
v-if="value.mergeColumnIndex"
style="border-bottom: 1px solid #000; border-left: 1px solid #000"
:rowspan="value.mergeColumnIndex"
contenteditable
>
{{ value.consignee }}
</td>
<!-- 收货人 -->
<td style="border-bottom: 1px solid #000; border-left: 1px solid #000" contenteditable>
<td
v-if="value.mergeColumnIndex"
style="border-bottom: 1px solid #000; border-left: 1px solid #000"
:rowspan="value.mergeColumnIndex"
contenteditable
>
{{ value.consigneeName }}
</td>
<!-- 收货电话 -->
<td style="border-bottom: 1px solid #000; border-left: 1px solid #000" contenteditable>
<td
v-if="value.mergeColumnIndex"
style="border-bottom: 1px solid #000; border-left: 1px solid #000"
:rowspan="value.mergeColumnIndex"
contenteditable
>
{{ value.consigneeMobile }}
</td>
<!-- 物流单号 -->
<td style="border-bottom: 1px solid #000; border-left: 1px solid #000">
<td
v-if="value.mergeColumnIndex"
style="border-bottom: 1px solid #000; border-left: 1px solid #000"
:rowspan="value.mergeColumnIndex"
>
{{ value.waybillNo }}
</td>
<!-- 合同号 -->
@ -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];

57
src/components/TripartiteTransferPrintTemplate/TripartiteTransferPrintTemplate.vue

@ -61,17 +61,29 @@
<tr v-for="(value, index) in renderInfo.mainList" style="word-break: break-all">
<td>{{ index + 1 }}</td>
<!-- 发货单位 -->
<td contenteditable>{{ value.shipper || '' }}</td>
<td v-if="value.mergeColumnIndex" :rowspan="value.mergeColumnIndex" contenteditable>
{{ value.shipper || '' }}
</td>
<!-- 开单时间 -->
<td contenteditable>{{ value.createTime || '' }}</td>
<td v-if="value.mergeColumnIndex" :rowspan="value.mergeColumnIndex" contenteditable>
{{ value.createTime || '' }}
</td>
<!-- 收货单位 -->
<td contenteditable>{{ value.consignee }}</td>
<td v-if="value.mergeColumnIndex" :rowspan="value.mergeColumnIndex" contenteditable>
{{ value.consignee }}
</td>
<!-- 收货人 -->
<td contenteditable>{{ value.consigneeName }}</td>
<td v-if="value.mergeColumnIndex" :rowspan="value.mergeColumnIndex" contenteditable>
{{ value.consigneeName }}
</td>
<!-- 收货电话 -->
<td contenteditable>{{ value.consigneeMobile }}</td>
<td v-if="value.mergeColumnIndex" :rowspan="value.mergeColumnIndex" contenteditable>
{{ value.consigneeMobile }}
</td>
<!-- 物流单号 -->
<td>{{ value.waybillNo }}</td>
<td v-if="value.mergeColumnIndex" :rowspan="value.mergeColumnIndex">
{{ value.waybillNo }}
</td>
<!-- 合同号 -->
<td>{{ value.orderCode }}</td>
<!-- 计划件数 -->
@ -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];

2
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);

Loading…
Cancel
Save