From ce259180a1a76db6a7e89d651dc3eb1f49932202 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 10 十月 2026 19:48:50 +0800
Subject: [PATCH] 修改装箱清单打印样式
---
pages/wareHouse/nuclearScale/nuclearscalerecord.vue | 346 +++++++--------------------------------------------------
1 files changed, 44 insertions(+), 302 deletions(-)
diff --git a/pages/wareHouse/nuclearScale/nuclearscalerecord.vue b/pages/wareHouse/nuclearScale/nuclearscalerecord.vue
index cfd4a57..ed66e15 100644
--- a/pages/wareHouse/nuclearScale/nuclearscalerecord.vue
+++ b/pages/wareHouse/nuclearScale/nuclearscalerecord.vue
@@ -188,11 +188,6 @@
DataMatrix: 33,
AZTEC: 34,
};
-// 绾挎潯绫诲瀷
-const LineType = {
- Solid: 1, // 瀹炵嚎
- Dotted: 2, // 铏氱嚎锛堥粯璁よ櫄瀹�1:1鐩搁棿锛�
-};
// 鎹㈣鏂瑰紡
const LineModeType = {
Justified: 1, // 瀹介珮鍥哄畾锛屽唴瀹硅嚜閫傚簲锛堝瓧鍙�/瀛楅棿璺�/琛岄棿璺濇寜姣斾緥缂╂斁锛�
@@ -480,19 +475,21 @@
}
const ht = item.contractNo;
- const lj = item.partNo;
- const ljms = item.ccontrProModel;
const fh = item.newNetWeight;
- const scdt = item.productionDate;
const scph = item.batchNo;
- const shdw = item.customerName;
- const fhdw = "姹熶笢鍚堥噾鎶�鏈湁闄愬叕鍙�";
- // 鍒濆鍖栫敾鏉�
+ // ===== 鏍囩绾告帓鐗堝弬鏁帮紙鍗曚綅锛歮m锛夛細40*70 鏍囩绾� =====
+ const LABEL_W = 40; // 鏍囩瀹藉害
+ const LABEL_H = 70; // 鏍囩闀垮害锛堣蛋绾告柟鍚戯級
+ const MARGIN = 1; // 鍥涘懆鐣欑櫧锛岄槻姝㈡墦鍗版埅鏂�
+ const QR_SIZE = LABEL_W - MARGIN * 2; // 浜岀淮鐮侀摵婊� 40mm 瀹斤紙38mm锛�
+ const TEXT_FONT_SIZE = 3; // 瀛楁瀛楀彿
+
+ // 鍒濆鍖栫敾鏉匡細瀹� 40銆侀暱 70锛屼笉鍋氭棆杞紙x 涓虹焊瀹芥柟鍚戯紝y 涓鸿蛋绾告柟鍚戯級
jcapi.initDrawingBoard({
- width: 70,
- height: 49,
- rotate: 90,
+ width: LABEL_W,
+ height: LABEL_H,
+ rotate: 0,
});
// 缁樺埗浜岀淮鐮�
@@ -508,290 +505,46 @@
};
jcapi.drawLabelQrCode({
- x: 43.5,
- y: 2,
- width: 24,
- height: 24,
+ x: MARGIN,
+ y: MARGIN,
+ width: QR_SIZE,
+ height: QR_SIZE,
value: qrContent,
rotate: 0,
codeType: QrCodeType.QrCode,
});
- // 缁樺埗妯嚎
- this.getDrawLabelLine(1, 1, 67, 0.5, 0, LineType.Solid);
- this.getDrawLabelLine(1, 6, 42, 0.3, 0, LineType.Solid);
- this.getDrawLabelLine(1, 11, 42, 0.3, 0, LineType.Solid);
- this.getDrawLabelLine(1, 16, 42, 0.3, 0, LineType.Solid);
- this.getDrawLabelLine(1, 23, 42, 0.3, 0, LineType.Solid);
- this.getDrawLabelLine(1, 27.5, 67, 0.3, 0, LineType.Solid);
- this.getDrawLabelLine(1, 32, 67, 0.3, 0, LineType.Solid);
- this.getDrawLabelLine(1, 37, 67, 0.3, 0, LineType.Solid);
- this.getDrawLabelLine(1, 42, 67, 0.3, 0, LineType.Solid);
- this.getDrawLabelLine(1, 47, 67, 0.5, 0, LineType.Solid);
+ // 鍏ㄩ儴妗嗙嚎宸插幓鎺夛紱浜岀淮鐮佷笅鏂瑰墿浣欑┖闂存í鍚戝睍绀轰笁涓瓧娈�
+ const textTop = MARGIN + QR_SIZE + MARGIN;
+ const lineHeight = (LABEL_H - MARGIN - textTop) / 3;
+ const fields = [
+ { label: "鍚堝悓鍙�", value: ht },
+ { label: "鍙戣揣/瑁呯鏁�", value: fh },
+ { label: "鐢熶骇鎵瑰彿", value: scph },
+ ];
- //缁樺埗绔栫嚎
- this.getDrawLabelLine(1, 1, 0.5, 46, 0, LineType.Solid); // 绔栫嚎1
- this.getDrawLabelLine(43, 1, 0.3, 26, 0, LineType.Solid); // 绔栫嚎2
- this.getDrawLabelLine(68, 1, 0.5, 46, 0, LineType.Solid); // 绔栫嚎3
+ fields.forEach((field, index) => {
+ const value =
+ field.value === null || field.value === undefined
+ ? ""
+ : String(field.value);
+ this.getDrawLabelText(
+ MARGIN,
+ textTop + index * lineHeight,
+ LABEL_W - MARGIN * 2,
+ lineHeight,
+ `${field.label}: ${value}`,
+ TEXT_FONT_SIZE,
+ 0,
+ LineModeType.AutoHeight,
+ 0,
+ 0,
+ 0,
+ 1,
+ 1
+ );
+ });
- // 缁樺埗鏂囨湰
- this.getDrawLabelText(
- 3,
- 2.5,
- 40,
- 8,
- "涓ぉ绉戞妧瑁呯娓呭崟",
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 1,
- 1,
- 1
- );
- this.getDrawLabelText(
- 2,
- 7,
- 25,
- 8,
- "鍚堝悓鍙�:",
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 1,
- 1
- );
- this.getDrawLabelText(
- 2,
- 12,
- 25,
- 8,
- "闆朵欢鍙�:",
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 1,
- 1
- );
- this.getDrawLabelText(
- 2,
- 17,
- 25,
- 8,
- "闆朵欢鎻忚堪:",
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 1,
- 1
- );
- this.getDrawLabelText(
- 2,
- 23.5,
- 25,
- 8,
- "鍙戣揣/瑁呯鏁�:",
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 1,
- 1
- );
- this.getDrawLabelText(
- 2,
- 28.5,
- 25,
- 8,
- "鐢熶骇鏃ユ湡:",
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 1,
- 1
- );
- this.getDrawLabelText(
- 2,
- 32.5,
- 25,
- 8,
- "鐢熶骇鎵瑰彿:",
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 1,
- 1
- );
- this.getDrawLabelText(
- 2,
- 37.5,
- 25,
- 8,
- "鍙戣揣鍗曚綅:",
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 1,
- 1
- );
- this.getDrawLabelText(
- 2,
- 42.5,
- 25,
- 8,
- "鏀惰揣鍗曚綅:",
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 1,
- 1
- );
-
- // 濉厖鍙傛暟鍊�
- this.getDrawLabelText(
- 11,
- 7,
- 30,
- 8,
- ht,
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 0,
- 1
- );
- this.getDrawLabelText(
- 11,
- 12,
- 32,
- 8,
- lj,
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 0,
- 1
- );
- this.getDrawLabelText(
- 14,
- 17,
- 30,
- 8,
- ljms,
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 0,
- 1
- );
- this.getDrawLabelText(
- 17,
- 23.5,
- 27,
- 8,
- fh,
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 0,
- 1
- );
- this.getDrawLabelText(
- 14,
- 28.5,
- 55,
- 8,
- scdt,
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 0,
- 1
- );
- this.getDrawLabelText(
- 14,
- 32.7,
- 55,
- 8,
- scph,
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 0,
- 1
- );
- this.getDrawLabelText(
- 14,
- 37.5,
- 55,
- 8,
- fhdw,
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 0,
- 1
- );
- this.getDrawLabelText(
- 14,
- 42.5,
- 55,
- 8,
- shdw,
- 2.5,
- 0,
- LineModeType.AutoHeight,
- 0,
- 0,
- 0,
- 0,
- 1
- );
// 鐢熸垚鎵撳嵃鏁版嵁
let imageJsonObj = jcapi.generateLabelJson();
@@ -890,17 +643,6 @@
}
},
- // 缁樺埗妯嚎
- getDrawLabelLine(x, y, width, height, rotate, lineType) {
- jcapi.drawLabelLine({
- x: x,
- y: y,
- width: width,
- height: height,
- rotate: rotate,
- lineType: lineType,
- });
- },
// 濉啿鏂囧瓧鏍囬
getDrawLabelText(
x,
--
Gitblit v1.9.3