From 7ed39bb24afae4b8d73b2d3b13fe6eaf266dd33e Mon Sep 17 00:00:00 2001 From: shijing Date: Tue, 29 Oct 2024 14:24:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=A0=87=E7=AD=BE=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/template/printmaterial.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/views/template/printmaterial.vue b/src/views/template/printmaterial.vue index 24426209..24c60183 100644 --- a/src/views/template/printmaterial.vue +++ b/src/views/template/printmaterial.vue @@ -105,13 +105,16 @@ export default { let obj = {}; obj.printer_commands = str; obj.printer_name = that.printer_name; - if(that.$INTERVAL == null){ - that.$INTERVAL = setInterval(() => { + let printerInterval = that.$TOOL.data.get('printerInterval'); + if(printerInterval==null){ + let intervalID = setInterval(() => { that.printLabel(obj) }, 2000); that.visible = false; + that.$TOOL.data.set('printerInterval',intervalID ); + }else{ - that.$message.warning("请等待当前打印任务完成") + that.$message.warning("请等待当前打印任务完成"); } }) }, @@ -123,8 +126,9 @@ export default { that.$API.wpm.prints.req(obj).then((response) => { that.count_printed ++ if (that.count_printed >= that.print_count){ - clearInterval(that.$INTERVAL); - that.$INTERVAL = null; + let printerInterval = that.$TOOL.data.get('printerInterval'); + clearInterval(printerInterval); + that.$TOOL.data.set('printerInterval',null); } }); }