diff --git a/src/api/labelSetting/label_setting.js b/src/api/labelSetting/label_setting.js
index ad8780f..de32150 100644
--- a/src/api/labelSetting/label_setting.js
+++ b/src/api/labelSetting/label_setting.js
@@ -5,3 +5,9 @@ export const getLabelSettingList = data => createAPI('/label/setting/getLabelSet
// 删除标签的信息
export const deleteLabelSetting = data => createAPI('/label/setting/deleteLabelSetting','post',data)
+
+// 添加标签的信息
+export const saveZplElements = data => createAPI('/label/setting/saveZplElements','post',data)
+
+// 修改标签的信息
+export const getZplElements = data => createAPI('/label/setting/getZplElements','post',data)
diff --git a/src/utils/zplUtil.js b/src/utils/zplUtil.js
index 3deb558..a6b09e1 100644
--- a/src/utils/zplUtil.js
+++ b/src/utils/zplUtil.js
@@ -1,5 +1,6 @@
-export function generateZPL(elements) {
+export function generateZPL(elements,zplHOrP) {
const zpl = ['^XA'];
+ zpl.push(zplHOrP)
elements.forEach(el => {
const x = Math.round(el.x);
const y = Math.round(el.y * 1.5); // 画布到 ZPL 像素转换
@@ -10,6 +11,17 @@ export function generateZPL(elements) {
zpl.push(el.newline
? `^FO${x},${y}^FB${el.lineWidth},${el.lineRows},0^CFJ,${el.fontSize}^FD${el.data}^FS`
: `^FO${x},${y}^FD${el.data}^FS`);
+ if (el.bold) {
+ zpl.push(el.newline
+ ? `^FO${x+1},${y}^FB${el.lineWidth},${el.lineRows},0^CFJ,${el.fontSize}^FD${el.data}^FS`
+ : `^FO${x+1},${y}^FD${el.data}^FS`);
+ zpl.push(el.newline
+ ? `^FO${x},${y+1}^FB${el.lineWidth},${el.lineRows},0^CFJ,${el.fontSize}^FD${el.data}^FS`
+ : `^FO${x},${y+1}^FD${el.data}^FS`);
+ zpl.push(el.newline
+ ? `^FO${x+1},${y+1}^FB${el.lineWidth},${el.lineRows},0^CFJ,${el.fontSize}^FD${el.data}^FS`
+ : `^FO${x+1},${y+1}^FD${el.data}^FS`);
+ }
break;
case 'barcode':
diff --git a/src/utils/zplUtil2.js b/src/utils/zplUtil2.js
new file mode 100644
index 0000000..09b0dc4
--- /dev/null
+++ b/src/utils/zplUtil2.js
@@ -0,0 +1,59 @@
+export function generateZPL(elements,zplHOrP) {
+ const zpl = ['^XA'];
+ //zpl.push('^POI');
+ zpl.push(zplHOrP)
+ elements.forEach(el => {
+ const x = Math.round(el.y * 1.3);
+ const y = Math.round((750-el.x) * 1.5); // 你之前的转换比例保持不变
+
+ switch (el.type) {
+ case 'text':
+ zpl.push(`^CI28^LH0,^JUS^CWJ,E:SIMSUN.FNT^CFJ,${el.fontSize},${el.fontSize}`);
+ zpl.push(el.newline
+ ? `^FO${x},${y}^FB${el.lineWidth},${el.lineRows},0^CFJ,${el.fontSize}^FD${el.data}^FS`
+ : `^FO${x},${y}^FD${el.data}^FS`);
+ if (el.bold) {
+ zpl.push(el.newline
+ ? `^FO${x+1},${y}^FB${el.lineWidth},${el.lineRows},0^CFJ,${el.fontSize}^FD${el.data}^FS`
+ : `^FO${x+1},${y}^FD${el.data}^FS`);
+ zpl.push(el.newline
+ ? `^FO${x},${y+1}^FB${el.lineWidth},${el.lineRows},0^CFJ,${el.fontSize}^FD${el.data}^FS`
+ : `^FO${x},${y+1}^FD${el.data}^FS`);
+ zpl.push(el.newline
+ ? `^FO${x+1},${y+1}^FB${el.lineWidth},${el.lineRows},0^CFJ,${el.fontSize}^FD${el.data}^FS`
+ : `^FO${x+1},${y+1}^FD${el.data}^FS`);
+ }
+ break;
+
+ case 'barcode':
+ zpl.push(`^FO${x},${y}^BY${el.width}^BCB,${el.height},Y,N,N^FD${el.data}^FS`);
+ break;
+
+ case 'qrcode':
+ zpl.push(`^FO${x},${y}^BQB,2,${el.height},^FDLA,${el.data}^FS`);
+ break;
+
+ case 'onecode':
+ zpl.push(`^FO${x},${y}^BY${el.width}^BCB,${el.height},^FD${el.data}^FS`);
+ break;
+
+ case 'pic':
+ if (el.data) {
+ zpl.push(`^FO${x},${y}^GFA,${el.data}`);
+ }
+ break;
+
+ case 'hLine':
+ const y1 = Math.round(1200-el.x)-el.width;
+ zpl.push(`^FO${x},${y1}^FWR^GB${el.height},${el.width},3,B^FS`);
+ break;
+ case 'vLine':
+ zpl.push(`^FO${x},${y}^FWR^GB${el.height},${el.width},3,B^FS`);
+ break;
+
+
+ }
+ });
+ zpl.push('^XZ');
+ return zpl.join('\n');
+}
diff --git a/src/views/modules/labelSetting/com_add_update_customer_label.vue b/src/views/modules/labelSetting/com_add_update_customer_label.vue
index c612edd..1bbcc83 100644
--- a/src/views/modules/labelSetting/com_add_update_customer_label.vue
+++ b/src/views/modules/labelSetting/com_add_update_customer_label.vue
@@ -180,7 +180,7 @@ export default {
//重置人员信息
this.pageData.username = this.userId;
//判断是否启用多语言
- this.getMultiLanguageList();
+ //this.getMultiLanguageList();
//重置标题
this.titleCon = this.labels.titleCon;
},
diff --git a/src/views/modules/labelSetting/com_add_update_default_label.vue b/src/views/modules/labelSetting/com_add_update_default_label.vue
index 15d9209..63a3138 100644
--- a/src/views/modules/labelSetting/com_add_update_default_label.vue
+++ b/src/views/modules/labelSetting/com_add_update_default_label.vue
@@ -156,7 +156,7 @@ export default {
//重置是否需要检验
this.pageData.checkFlag = 'Y';
//判断是否启用多语言
- this.getMultiLanguageList();
+ //this.getMultiLanguageList();
//重置标题
this.titleCon = this.labels.titleCon;
},
diff --git a/src/views/modules/labelSetting/com_add_update_label.vue b/src/views/modules/labelSetting/com_add_update_label.vue
index e02a757..ce42815 100644
--- a/src/views/modules/labelSetting/com_add_update_label.vue
+++ b/src/views/modules/labelSetting/com_add_update_label.vue
@@ -7,36 +7,40 @@
{{ generatedZPL }}