From 2117661802b2902a9de272d061ee7e7ebb02debc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?yinjinlu-pc=5C=E5=B0=B9=E9=87=91=E8=B7=AF?= <411641505@qq.com> Date: Mon, 25 Nov 2024 16:50:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=8C=89=E9=92=AE=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/printerLabel/index.vue | 33 ++++++++++++++++--------- src/views/print/printerconfig/index.vue | 11 +++------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/components/printerLabel/index.vue b/src/components/printerLabel/index.vue index f28103d..232e6ed 100644 --- a/src/components/printerLabel/index.vue +++ b/src/components/printerLabel/index.vue @@ -2,7 +2,7 @@ {{labelText}} @@ -22,22 +22,31 @@ export default { labelText: { type: String, default: '打印' - } + }, + printerCode: null }, methods:{ handlePrint(){ - //先检查是否有配置默认的打印机 - const key = 'defaultPrinter'; - let printerJson = localStorage.getItem(key); - - debugger; - if(printerJson !=null){ - const printer = JSON.parse(printerJson); - const param = { businessId: this.businessId, businessCode: this.businessCode, businessType: this.businessType, printerCode: printer.printerCode }; - printBarcodeLabel(param); + + var theCode; + if(this.printerCode ==null){ + //是否有配置默认的打印机 + const key = 'defaultPrinter'; + let printerJson = localStorage.getItem(key); + if(printerJson !=null){ + const printer = JSON.parse(printerJson); + theCode = printer.printerCode; + }else{ + this.$modal.msgError("请在打印管理-打印机配置功能中指定默认打印机!"); + } }else{ - this.$modal.msgError("请在打印管理-打印机配置功能中指定默认打印机!"); + theCode = this.printerCode; } + + const param = { businessId: this.businessId, businessCode: this.businessCode, businessType: this.businessType, printerCode: theCode }; + printBarcodeLabel(param).then(response => { + this.$modal.msgSuccess("打印成功"); + }); } } } diff --git a/src/views/print/printerconfig/index.vue b/src/views/print/printerconfig/index.vue index c3c9842..a858cbf 100644 --- a/src/views/print/printerconfig/index.vue +++ b/src/views/print/printerconfig/index.vue @@ -97,13 +97,7 @@ @click="handleDefault(scope.row)" v-hasPermi="['print:printerconfig:list']" >设置为默认 - 设置为默认 + @@ -265,10 +259,11 @@