Explorar o código

wx打印 - template展示api返回值

zhangxiaomu hai 1 ano
pai
achega
9e9ce32913
Modificáronse 1 ficheiros con 7 adicións e 6 borrados
  1. 7 6
      src/view/wx-print/index.vue

+ 7 - 6
src/view/wx-print/index.vue

@@ -68,6 +68,7 @@ export default {
   created() {
   },
   mounted() {
+    let self = this
     console.log('this.$route.query',this.$route.query)
     if (!this.$route.query.layout_id) {
       this.$Message.warning('请先选择一个模板再打印')
@@ -136,20 +137,20 @@ export default {
           setTimeout(function () {
             //Blob
             hiprintTemplate.toPdf(printData,'单据打印',{isDownload:false,type:''}).then(blob=>{
-              this.blob=blob
+              self.blob=blob
               // let pdf =this.blobToFile(blob, 'blob.pdf')
               let pdf = new File([blob], 'blob.pdf', { type: blob.type })
-              this.pdf=pdf
+              self.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) {
+              self.excute(self.$service.fileService, `upload?folder=pdf&uuid=${self.$route.query.uuid}`,formData).then(res => {
+                self.uploadRes=res
+                if (res.code === self.$config.SUCCESS_CODE) {
                   console.log('upload-res',res)
                 }
               })
             }).catch(err => {
-              this.err=err
+              self.err=err
             })
           }, 1000)