Explorar o código

打印重复问题

Zhouzhendong %!s(int64=4) %!d(string=hai) anos
pai
achega
1f4bd3bd7a
Modificáronse 1 ficheiros con 10 adicións e 10 borrados
  1. 10 10
      resources/views/store/deliveryAppointment/list.blade.php

+ 10 - 10
resources/views/store/deliveryAppointment/list.blade.php

@@ -196,8 +196,8 @@
                 index:"",
                 selectDate:{},
                 periods:@json(\App\DeliveryAppointment::PERIOD),
-                printInfo:{},
                 infoShow:false,
+                printInfo:{},
                 today:"",
             },
             mounted(){
@@ -249,7 +249,6 @@
             },
             methods: {
                 exePrint(){
-                    this.infoShow = true;
                     if (!this.printInfo.signer){
                         window.tempTip.setIndex(1099);
                         window.tempTip.show("请填写签收人");
@@ -257,19 +256,20 @@
                     }
                     $("#printModal").modal('hide');
                     let iframe=document.getElementById("print-iframe");
+                    this.infoShow=true;
                     if(!iframe){
-                        let el = document.getElementById("printContent");
                         iframe = document.createElement('IFRAME');
                         iframe.setAttribute("id", "print-iframe");
                         iframe.setAttribute('style', 'position:absolute;width:0;height:0;left:-500px;top:-500px;');
                         document.body.appendChild(iframe);
-                        let doc = iframe.contentWindow.document;
-                        doc.write('<LINK rel="stylesheet" type="text/css" href="{{ asset(mix("css/app.css")) }}">');
-                        doc.write('<div>' + el.innerHTML + '</div>');
-                        doc.close();
-                        iframe.contentWindow.focus();
-                    }
-                    this.infoShow = false;
+                    }else iframe.contentWindow.document.getElementById("iframe-content").remove();
+                    let doc = iframe.contentWindow.document;
+                    let el = document.getElementById("printContent");
+                    doc.write('<LINK rel="stylesheet" type="text/css" href="{{ asset(mix("css/app.css")) }}">');
+                    doc.write('<div id="iframe-content">' + el.innerHTML + '</div>');
+                    doc.close();
+                    iframe.contentWindow.focus();
+                    this.infoShow=false;
                     setTimeout(function () {
                         iframe.contentWindow.print();
                         if (navigator.userAgent.indexOf("MSIE") > 0){