Browse Source

打印测试

lilei 3 years ago
parent
commit
526e922202
2 changed files with 7 additions and 6 deletions
  1. 3 3
      src/api/sales.js
  2. 4 3
      src/libs/JGPrint.js

+ 3 - 3
src/api/sales.js

@@ -138,9 +138,9 @@ export const salesDetailPrint = params => {
     method: 'get'
     method: 'get'
   }
   }
   // 喷墨打印
   // 喷墨打印
-  if (params.type == 'INK') {
-    data.responseType = 'blob'
-  }
+  // if (params.type == 'INK') {
+  //   data.responseType = 'blob'
+  // }
   return axios.request(data)
   return axios.request(data)
 }
 }
 // 销售 详情  导出
 // 销售 详情  导出

+ 4 - 3
src/libs/JGPrint.js

@@ -38,13 +38,14 @@ export const JGPrint = function (data, type, printerType) {
     }
     }
   } else {
   } else {
     // 喷墨打印
     // 喷墨打印
-    const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
-    document.getElementById('print').innerHTML = '<iframe id="printfsqd" name="printfsqd" src="' + url + '" hidden></iframe>'
+    // const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
+    // document.getElementById('print').innerHTML = '<iframe id="printfsqd" name="printfsqd" src="' + url + '" hidden></iframe>'
     if (type == 'preview') { //  预览
     if (type == 'preview') { //  预览
       // window.open(url)
       // window.open(url)
+      console.log(data.data)
       const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
       const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
-            LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data)
             LODOP.SET_PRINT_STYLEA(0, 'PDFScalMode', 1)
             LODOP.SET_PRINT_STYLEA(0, 'PDFScalMode', 1)
+            LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data.data)
             LODOP.SET_PRINT_PAGESIZE(3, 0, 0, '')
             LODOP.SET_PRINT_PAGESIZE(3, 0, 0, '')
     } else if (type == 'print') { //  打印
     } else if (type == 'print') { //  打印
       window.frames['printfsqd'].focus()
       window.frames['printfsqd'].focus()