From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 02 八月 2022 11:42:43 +0800 Subject: [PATCH] Merge branch 'develop' --- src/views/printTemplate/print.js | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/views/printTemplate/print.js b/src/views/printTemplate/print.js index 81c5792..d6c75cb 100644 --- a/src/views/printTemplate/print.js +++ b/src/views/printTemplate/print.js @@ -36,6 +36,13 @@ element.fontSize = element.fontSize * sizeradio } else if (element.type === 'qrcode') { element.qrcodeWidth = element.qrcodeWidth * ratio + + if (element.qrcodeWidth > element.height) { + element.qrcodeWidth = element.height + } + if (element.qrcodeWidth > element.width) { + element.qrcodeWidth = element.width + } } else if (element.type === 'image') { element.imgWidth = element.imgWidth * ratio element.imgHeight = element.imgHeight * ratio @@ -70,9 +77,15 @@ context.translate(-_cx, -_cy) // 鎭㈠鍘熺偣 } - if (debug || selectId === element.uuid) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰� + if (selectId === element.uuid) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰� context.shadowBlur = 5 context.shadowColor = '#1890ff' + context.fillStyle = 'white' + context.fillRect(element.left, element.top, element.width || 1, element.height || 1) + context.shadowBlur = 0 + } else if (debug) { + context.shadowBlur = 3 + context.shadowColor = 'orange' context.fillStyle = 'white' context.fillRect(element.left, element.top, element.width || 1, element.height || 1) context.shadowBlur = 0 @@ -81,6 +94,7 @@ // 缁樺埗杈规 // context.rect(element.left + element.borderSize / 2, element.top + element.borderSize / 2, element.width - element.borderSize, element.height - element.borderSize) if (element.borderSize >= 1) { + context.beginPath() context.strokeStyle = element.borderColor context.lineWidth = element.borderSize context.rect(element.left, element.top, element.width, element.height) @@ -104,7 +118,7 @@ context.fillRect(element.left, element.top, element.width, element.height) } - if ((debug || selectId === element.uuid) && element.width > 3 * ratio && element.height > 3 * ratio) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰� + if (selectId === element.uuid && element.width > 3 * ratio && element.height > 3 * ratio) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰� context.strokeStyle = '#1890ff' context.beginPath() context.moveTo(element.left + element.width - 7, element.top + element.height - 2) @@ -131,6 +145,14 @@ context.fillStyle = element.fontColor let lines = element.value.split('\n') + + if (!element.value && element.field) { + if (element.field === 'other_field') { + lines = [element.cusfield || ''] + } else { + lines = [element.field] + } + } let _y = element.top + element.padding + element.fontSize + element.borderSize let _left = element.left + element.borderSize + element.padding let _right = element.left + element.width - element.padding - element.borderSize -- Gitblit v1.8.0