Browse Source

bug 修复

lilei 3 years ago
parent
commit
1ea8804f42
1 changed files with 12 additions and 11 deletions
  1. 12 11
      src/libs/JGPrint.js

+ 12 - 11
src/libs/JGPrint.js

@@ -184,9 +184,9 @@ export const newHdPrint = function (printerType, type, url, params, fileName, ca
     params.type = printerType
     params.type = printerType
   }
   }
   // 阵式预览和喷墨预览一样
   // 阵式预览和喷墨预览一样
-  if (type == 'preview' && printerType == 'NEEDLE') {
-    params.type = 'INK'
-  }
+  // if (type == 'preview' && printerType == 'NEEDLE') {
+  //   params.type = 'INK'
+  // }
   url(params).then(res => {
   url(params).then(res => {
     if (res.type == 'application/json') {
     if (res.type == 'application/json') {
       var reader = new FileReader()
       var reader = new FileReader()
@@ -215,7 +215,7 @@ export const newJGPrint = function (data, type, printerType) {
     return
     return
   }
   }
   // 针式打印
   // 针式打印
-  if (printerType == 'NEEDLE' && type=="print") {
+  if (printerType == 'NEEDLE') {
     const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
     const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
     if (!LODOP) {
     if (!LODOP) {
       confirm({
       confirm({
@@ -230,19 +230,20 @@ export const newJGPrint = function (data, type, printerType) {
       })
       })
       return
       return
     }
     }
-    const dlen = data.data.length
-    if(dlen){
-      LODOP.SET_SHOW_MODE("HIDE_PBUTTIN_PREVIEW",1);//隐藏打印按钮
-      // LODOP.SET_SHOW_MODE("HIDE_SBUTTIN_PREVIEW",1);//隐藏设置按钮
-      LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) //  隐藏底图上有模拟走纸板的条纹线
-      LODOP.SET_PRINT_STYLEA(0,"PDFScalMode",1);
-      // 开始打印
+    
+    if (type == 'preview') { //  预览
+      LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data.data[0])
+      LODOP.SET_PRINT_PAGESIZE(3,2090,0,"");
+      LODOP.PREVIEW()
+    } else if (type == 'print') { //  打印
+      const dlen = data.data.length
       for(let i=0;i<dlen;i++){
       for(let i=0;i<dlen;i++){
         LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data.data[i])
         LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', data.data[i])
         LODOP.SET_PRINT_PAGESIZE(3, 2090, 0, '')
         LODOP.SET_PRINT_PAGESIZE(3, 2090, 0, '')
         LODOP.PRINT()
         LODOP.PRINT()
       }
       }
     }
     }
+    
   } else {
   } else {
     // 喷墨打印
     // 喷墨打印
     const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
     const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))