zhangxiaomu před 1 rokem
rodič
revize
d60cfc5c2f
1 změnil soubory, kde provedl 21 přidání a 24 odebrání
  1. 21 24
      src/view/wx-print/index.vue

+ 21 - 24
src/view/wx-print/index.vue

@@ -113,15 +113,29 @@ export default {
           this.$set(header, 'table', detail)
 
           let printData = {...header}
-          let hiprintTemplate = new hiprint.PrintTemplate({
-            template: layout,
-          }).then(()=>{
 
-            console.log('data',header)
-            console.log('layout',layout)
-            console.log('hiprintTemplate',hiprintTemplate)
+          // let hiprintTemplate = new hiprint.PrintTemplate({
+          //   template: layout,
+          // })
+          console.log('data',header)
+          console.log('layout',layout)
+          // console.log('hiprintTemplate',hiprintTemplate)
+
+          // hiprintTemplate.toPdf(printData,'单据打印',{isDownload:false,type:'datauristring'}).then(dataURL=>{
+          //   this.blob=dataURL
+          //   let pdf = this.dataURLtoFile(dataURL, "pdf");
+          //   this.pdf=pdf
+          //   let formData = new FormData();
+          //   formData.append('file', pdf);
+          //   this.excute(this.$service.fileService, `upload?folder=pdf&uuid=${this.$route.query.uuid}`,formData).then(res => {
+          //     this.uploadRes=res
+          //     if (res.code === this.$config.SUCCESS_CODE) {
+          //       console.log('upload-res',res)
+          //     }
+          //   })
+          // })
             //Blob
-            hiprintTemplate.toPdf(printData,'单据打印',{isDownload:false,type:''}).then(blob=>{
+          new hiprint.PrintTemplate({ template: layout,}).toPdf(printData,'单据打印',{isDownload:false,type:''}).then(blob=>{
               console.log(1)
               // console.log('blob',blob)
               // let pdf =this.blobToFile(blob, 'blob.pdf')
@@ -139,23 +153,6 @@ export default {
             }).catch(err => {
               console.log('upload-err',err)
             })
-          })
-
-
-          // hiprintTemplate.toPdf(printData,'单据打印',{isDownload:false,type:'datauristring'}).then(dataURL=>{
-          //   this.blob=dataURL
-          //   let pdf = this.dataURLtoFile(dataURL, "pdf");
-          //   this.pdf=pdf
-          //   let formData = new FormData();
-          //   formData.append('file', pdf);
-          //   this.excute(this.$service.fileService, `upload?folder=pdf&uuid=${this.$route.query.uuid}`,formData).then(res => {
-          //     this.uploadRes=res
-          //     if (res.code === this.$config.SUCCESS_CODE) {
-          //       console.log('upload-res',res)
-          //     }
-          //   })
-          // })
-
 
         }else {
           console.log('W_006-err')