Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

guq 7 years ago
parent
commit
501d8a04a4
1 changed files with 16 additions and 4 deletions
  1. 16 4
      frontend/saas-web/app/view/core/report/ReportPanelController.js

+ 16 - 4
frontend/saas-web/app/view/core/report/ReportPanelController.js

@@ -45,9 +45,21 @@ Ext.define('saas.view.core.report.ReportPanelController', {
         });
     },
     printHtml: function(html){
-        var d = window.open("", "print");
-        d.document.write(html);
-        d.document.close();
-        d.print();
+        var iframe=document.getElementById("saas-print-iframe");
+        if(!iframe){
+            iframe = document.createElement('IFRAME');
+            var doc = null;
+            iframe.setAttribute("id", "saas-print-iframe");
+            iframe.setAttribute('style', 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;');
+            document.body.appendChild(iframe);
+            doc = iframe.contentWindow.document;
+            doc.write(html);
+            doc.close();
+            iframe.contentWindow.focus();
+        }
+        iframe.contentWindow.print();
+        if (navigator.userAgent.indexOf("MSIE") > 0){
+            document.body.removeChild(iframe);
+        }
     },
 });