diff --git a/src/api/model/cm.js b/src/api/model/cm.js
index 55e3d55c..cf9940e3 100644
--- a/src/api/model/cm.js
+++ b/src/api/model/cm.js
@@ -95,7 +95,7 @@ export default {
}
},
sendToCoder:{
- name: "下发到打码器",
+ name: "下发到喷码",
req: async function(id, data){
return await http.post(
`${config.API_URL}/cm/labeltemplate/${id}/send_to_coder/`,
diff --git a/src/layout/components/userbar.vue b/src/layout/components/userbar.vue
index 36040479..20d61451 100644
--- a/src/layout/components/userbar.vue
+++ b/src/layout/components/userbar.vue
@@ -5,6 +5,11 @@
+
+
+
+
+
@@ -104,6 +109,22 @@
保存
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 保存
+
+
-
-
- {{ scope.row.coder_ip }}:{{ scope.row.coder_port }}
-
-
@@ -47,15 +42,6 @@
:key="item.id">
-
-
-
-
-
-
-
-
-
@@ -71,9 +57,6 @@
id:"",
name: "",
commands: "",
- coder_ip: "",
- coder_port: 3100,
- coder_field: "1",
};
export default {
name: 'labeltemplate',
@@ -132,7 +115,6 @@
let arr = [];
arr = that.addForm.commands.split("\n");
that.addForm.commands = arr;
- if (!that.addForm.coder_ip) that.addForm.coder_ip = null;
if(this.type==='add'){
this.$API.cm.labeltemplate.create.req(that.addForm).then(res=>{
this.isSaveing = false;
@@ -156,9 +138,6 @@
this.addForm.id=row.id;
this.addForm.name=row.name;
this.addForm.commands=row.commands.join("\n");
- this.addForm.coder_ip=row.coder_ip;
- this.addForm.coder_port=row.coder_port;
- this.addForm.coder_field=row.coder_field || "1";
this.limitedVisible = true;
},
diff --git a/src/views/wpm_bx/wprList.vue b/src/views/wpm_bx/wprList.vue
index de0e49a8..237b7e90 100644
--- a/src/views/wpm_bx/wprList.vue
+++ b/src/views/wpm_bx/wprList.vue
@@ -343,10 +343,17 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
that.$message.warning("请先设置打印机");
}
},
- //喷码: 通过名为'喷码模板'的标签模板向打码器下发产品编号
+ //喷码: 通过名为'喷码模板'的标签模板向喷码机下发产品编号
sendToCoder(row){
let that = this;
if (that.coderLoadingIds[row.id]) return;
+ let coder_ip = localStorage.getItem('coder_ip') || '';
+ let coder_port = localStorage.getItem('coder_port') || '';
+ let coder_field = localStorage.getItem('coder_field') || '';
+ if (!coder_ip) {
+ that.$message.error('请先在右上角"喷码设置"配置喷码IP');
+ return;
+ }
that.coderLoadingIds = { ...that.coderLoadingIds, [row.id]: true };
let templateName = '喷码模板';
let tdata = {
@@ -368,12 +375,10 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
release();
return;
}
- if (!template.coder_ip) {
- that.$message.error(`模板 ${templateName} 未配置打码器IP`);
- release();
- return;
- }
- that.$API.cm.labeltemplate.sendToCoder.req(template.id, {tdata}).then(() => {
+ let body = {tdata, coder_ip};
+ if (coder_port) body.coder_port = Number(coder_port);
+ if (coder_field) body.coder_field = coder_field;
+ that.$API.cm.labeltemplate.sendToCoder.req(template.id, body).then(() => {
that.$message.success("喷码下发成功");
}).finally(release);
}).catch(release);