From af9ae0806cdce3935d8c5ec9f4e4f085587353b6 Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期四, 30 十一月 2023 11:18:03 +0800 Subject: [PATCH] edit:修改出入库明细单打印,canvas的裁切宽度 --- src/views/overview/previewExcel.vue | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/views/overview/previewExcel.vue b/src/views/overview/previewExcel.vue index 07acb3b..ab9ff1e 100644 --- a/src/views/overview/previewExcel.vue +++ b/src/views/overview/previewExcel.vue @@ -20,19 +20,15 @@ data() { return { excel: '',//excel鏂囨。鍦板潃 - cutWidth:200, + cutAfterWidth:this.$route.params.cutAfterWidth,//瑁佸壀鍚庤鍑忓幓鐨勫 }; }, computed: { }, created() { + console.log(this.$route.params.baseOperationType,"鐪嬬湅") if(this.$route.params.baseOperationType!=undefined){ this.excel=this.$route.params.url - if(this.this.$route.params.baseOperationType===1){ - this.cutWidth=200 - }else if(this.this.$route.params.baseOperationType===2){ - this.cutWidth=315 - } } }, mounted() { @@ -52,14 +48,14 @@ const canvas = await html2canvas(elementToCrop); const croppedCanvas = document.createElement("canvas"); const croppedContext = croppedCanvas.getContext("2d"); - croppedCanvas.width = canvas.width - this.cutWidth; // 鍘绘帀宸﹀彸鍚�100px + croppedCanvas.width = canvas.width ; //瑁佸壀鍓� croppedCanvas.height = canvas.height - 100; // 鍘绘帀涓婁笅鍚�100px // 鍦ㄦ柊鐨凜anvas涓婄粯鍒惰鍓悗鐨勫浘鍍� croppedContext.drawImage( canvas, 50, // 寮�濮嬭鍓殑宸︿晶浣嶇疆 20, // 寮�濮嬭鍓殑涓婁晶浣嶇疆 - croppedCanvas.width, // 瑁佸壀鍚庣殑瀹藉害 + croppedCanvas.width-this.cutAfterWidth, // 瑁佸壀鍚庣殑瀹藉害 croppedCanvas.height-300, // 瑁佸壀鍚庣殑楂樺害 0, // 鏂癈anvas涓粯鍒剁殑宸︿晶浣嶇疆 0, // 鏂癈anvas涓粯鍒剁殑涓婁晶浣嶇疆 -- Gitblit v1.8.0