Ver código fonte

fix: 打印增加异常判断

zh 2 anos atrás
pai
commit
03b4222730

+ 13 - 14
src/mixin/print.js

@@ -102,19 +102,17 @@ export default {
         panelData = panel2
         this.dataLength = 4
       }
-  
-        // eslint-disable-next-line no-undef
-        hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'))
-        this.hiprintTemplate = new hiprint.PrintTemplate({
-          template: panelData,
-          settingContainer: '#PrintElementOptionSetting',
-          paginationContainer: '.hiprint-printPagination'
-        })
-        // this.hiprintTemplate.design('#hiprint-printTemplate')
-        // 获取当前放大比例, 当zoom时传true 才会有
-        // this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
-  
-     
+
+      // eslint-disable-next-line no-undef
+      hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'))
+      this.hiprintTemplate = new hiprint.PrintTemplate({
+        template: panelData,
+        settingContainer: '#PrintElementOptionSetting',
+        paginationContainer: '.hiprint-printPagination'
+      })
+      // this.hiprintTemplate.design('#hiprint-printTemplate')
+      // 获取当前放大比例, 当zoom时传true 才会有
+      // this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
     },
     /**
      * 获取需要打印数据详情
@@ -247,12 +245,13 @@ export default {
         funcType(requestParams)
         // 清空当前克隆数据,避免重复添加次数
         this.clonelData = []
+        return Promise.resolve()
       } catch (error) {
         // console.error('添加打印次数失败')
         this.clonelData = []
         this.$errorMsg('添加打印次数失败' + JSON.stringify(requestParams))
+        return Promise.reject()
       }
-      return Promise.resolve()
     },
     /**
      * 设置纸张大小

+ 2 - 0
src/views/supply/apply/components/design/preview.vue

@@ -103,6 +103,8 @@ export default {
               }
             )
 
+          }).catch(err=>{
+            this.$errorMsg('刷新重试打印')
           })
         } else {
           throw new Error('加载失败,刷新重试')

+ 2 - 0
src/views/supply/deliver/components/design/preview.vue

@@ -101,6 +101,8 @@ export default {
                 }
               }
             )
+          }).catch(err=>{
+            this.$errorMsg('刷新重试打印')
           })
         } else {
           throw new Error('加载失败,刷新重试')

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

@@ -103,6 +103,8 @@ export default {
               }
             )
 
+          }).catch(err=>{
+            this.$errorMsg('刷新重试打印')
           })
         } else {
           throw new Error('加载失败,刷新重试')