From e238d7d2c3044e2680a8b4d53383f0e10d13c055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Tue, 23 May 2023 17:18:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B5=84=E8=B4=A8=E7=BB=B4?= =?UTF-8?q?=E6=8A=A4bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/itextpdf/orderPrint.js | 21 +++++++++++++ src/views/inout/IoSupSearchOrder.vue | 44 +++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/src/api/itextpdf/orderPrint.js b/src/api/itextpdf/orderPrint.js index c7b4ed6..7c120be 100644 --- a/src/api/itextpdf/orderPrint.js +++ b/src/api/itextpdf/orderPrint.js @@ -20,3 +20,24 @@ export function orderPDFFromTemplateFile(query) { responseType: 'arraybuffer', //一定要设置响应类型,否则页面会是空白pdf }); } + +//---------报表打印订单 +export function inspectionOrderPDFFromStatemenTemplateFile(query) { + return axios({ + url: "/udiwms/pdf/template/inspection/order/code/file", + method: "post", + data: query, + }); +} + +export function orderPDFFromStatemenTemplateFile(query) { + return axios({ + url: "/udiwms/pdf/template/text/inspection/order/code/file", + method: "post", + data: query, + headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}, + responseType: 'arraybuffer', //一定要设置响应类型,否则页面会是空白pdf + }); +} + + diff --git a/src/views/inout/IoSupSearchOrder.vue b/src/views/inout/IoSupSearchOrder.vue index 44b7236..6ba009a 100644 --- a/src/views/inout/IoSupSearchOrder.vue +++ b/src/views/inout/IoSupSearchOrder.vue @@ -175,6 +175,13 @@ >打印 + 报表打印 + { + if (response.code === 20000) { + orderPDFFromStatemenTemplateFile(tQuery).then((response) => { + //将pdf文件转换为url。 + const binaryData = []; + binaryData.push(response); + //获取blob链接。 + let url = window.URL.createObjectURL( + new Blob(binaryData, {type: "application/pdf"}) + ); + this.loading = false; + window.open(url);//打开新标签页,预览pdf。 + this.getOrderQRCodeTextList(); + }).catch(() => { + this.loading = false; + }); + } else { + this.loading = false; + this.$message.error(response.message); + } + }).catch(() => { + this.loading = false; + }); + }, + onResultReset() { this.resultQuery = { orderId: null,