zhouhao 2 gadi atpakaļ
vecāks
revīzija
2a13076518

+ 26 - 23
src/views/supply/deliver/components/design/preview.vue

@@ -75,35 +75,38 @@ export default {
       }, 500)
     },
     print() {
-      this.hiprintTemplate.print(
-        this.printData,
-        {},
-        {
-          callback: async() => {
-            try {
-              if (typeof this.$parent.addPrint === 'function') {
-                this.$parent.addPrint('addPrints').then(() => {
+
+      try {
+        if (typeof this.$parent.addPrint === 'function') {
+          this.$parent.addPrint('addPrints').then(() => {
+            this.hiprintTemplate.print(
+              this.printData,
+              {},
+              {
+                callback: async() => {
+                  this.hiprintTemplate = {}
+                  this.$parent.tableSelection = []
+                  // setTimeout(() => {
+                  //   console.error('更新发货汇总列表')
+                  //   // this.$successMsg('更新成功')
+                  // }, 1000)
                   setTimeout(() => {
                     console.error('更新发货汇总列表')
                     this.$parent.getList()
                   }, 1000)
-                })
-              } else {
-                throw new Error('加载失败,刷新重试')
+                }
               }
-            } catch (e) {
-              this.$errorMsg(e)
-              // '调用打印次数接口失败'
-            }
-            this.hiprintTemplate = {}
-            this.$parent.tableSelection = []
-            // setTimeout(() => {
-            //   console.error('更新发货汇总列表')
-            //   // this.$successMsg('更新成功')
-            // }, 1000)
-          }
+            )
+
+          })
+        } else {
+          throw new Error('加载失败,刷新重试')
         }
-      )
+      } catch (e) {
+        this.$errorMsg(e)
+        // '调用打印次数接口失败'
+      }
+
       setTimeout(() => {
         this.hideModal()
       }, 2000)

+ 21 - 21
src/views/supply/pickup/components/design/preview.vue

@@ -68,33 +68,33 @@ export default {
       }, 500)
     },
     print() {
-      this.hiprintTemplate.print(
-        this.printData,
-        {},
-        {
-          callback: async() => {
-            try {
-              if (typeof this.$parent.addPrint === 'function') {
-                this.$parent.addPrint('getDtailPrintDis').then(() => {
+      try {
+        if (typeof this.$parent.addPrint === 'function') {
+          this.$parent.addPrint('getDtailPrintDis').then(() => {
+            this.hiprintTemplate.print(
+              this.printData,
+              {},
+              {
+                callback: async() => {
+                  this.hiprintTemplate = {}
+                  this.$parent.tableSelection = []
+
                   setTimeout(() => {
                     console.error('更新发货汇总列表')
                     this.$parent.getList()
-
                   }, 2000)
-                })
-              } else {
-                throw new Error('加载失败,刷新重试')
+                }
               }
-            } catch (e) {
-              this.$errorMsg(e)
-              // '调用打印次数接口失败'
-            }
-            this.hiprintTemplate = {}
-            this.$parent.tableSelection = []
-
-          }
+            )
+
+          })
+        } else {
+          throw new Error('加载失败,刷新重试')
         }
-      )
+      } catch (e) {
+        this.$errorMsg(e)
+        // '调用打印次数接口失败'
+      }
       setTimeout(() => {
         this.hideModal()
       }, 2000)