ymy 1 жил өмнө
parent
commit
9cdbebbf3b

+ 15 - 0
src/benyun/components/byBill/byBill.vue

@@ -223,8 +223,23 @@
 				console.error('数据转换报错!');
 			}
 			this.load = true;
+			const that:any=this;
 			print(param).then((res:any)=>{
 				this.load = false;
+				if(res.type === 'application/json'){
+					const reader:any = new FileReader();
+					reader.onload = function (){
+						const d:any = JSON.parse(reader.result);
+						if(d && d.msg){
+							that.$message({
+								message:d.msg,
+								type:'error'
+							})
+						}
+					}
+					reader.readAsText(res);
+					return
+				}
 				const blob = new Blob([res],{
         type: "application/pdf;chartset=UTF-8"
       })

+ 2 - 2
src/components/byLog/byLog.vue

@@ -58,12 +58,12 @@ export default class ByLog extends VueViews {
     if(!this.requestConfig || !this.requestConfig.url){
       return
     }
-    if(!this.parentValue || !this.parentValue.id){
+    if(!this.parentValue || !this.parentValue.orderNumber){
       return
     }
     let parame = (this as any).$lodash.cloneDeep(this.requestConfig);
     parame.params={
-      docId:this.parentValue.id,
+      docId:this.parentValue.orderNumber,
       pageNo:this.page.pageNo,
       pageSize:this.page.pageSize
     }

+ 15 - 1
src/views/print/printTemplate/index.vue

@@ -229,6 +229,7 @@ export default class PrintTemplate extends Vue {
       return
     }
     this.load=true;
+    const that:any = this;
     preview({
       templateEngine:data.templateEngine,
       templateHtml:data.templateHtml,
@@ -236,7 +237,20 @@ export default class PrintTemplate extends Vue {
       outType:'PDF'
     }).then((res:any) => {
       this.load=false;
-
+      if(res.type === 'application/json'){
+        const reader:any = new FileReader();
+        reader.onload = function (){
+          const d:any = JSON.parse(reader.result);
+          if(d && d.msg){
+            that.$message({
+              message:d.msg,
+              type:'error'
+            })
+          }
+        }
+        reader.readAsText(res);
+        return
+      }
       const blob = new Blob([res],{
         type: "application/pdf;chartset=UTF-8"
       })