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,