From 24d07e068eb35d489f170347391fca479d7bf6f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com>
Date: Wed, 1 Mar 2023 14:40:38 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E6=8D=AE=E6=89=93=E5=8D=B0=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/itextpdf/orderPrint.js | 22 ++++++++++++++
src/views/inout/IoAuditedOrder.vue | 37 +++++++++++++++++++++++-
src/views/inout/IoCheckSuccessOrder.vue | 38 ++++++++++++++++++++++++-
3 files changed, 95 insertions(+), 2 deletions(-)
create mode 100644 src/api/itextpdf/orderPrint.js
diff --git a/src/api/itextpdf/orderPrint.js b/src/api/itextpdf/orderPrint.js
new file mode 100644
index 00000000..c7b4ed60
--- /dev/null
+++ b/src/api/itextpdf/orderPrint.js
@@ -0,0 +1,22 @@
+
+import axios from "@/utils/request";
+
+
+//---------打印订单
+export function inspectionOrderPDFFromTemplateFile(query) {
+ return axios({
+ url: "/udiwms/pdf/template/inspection/order/file",
+ method: "post",
+ data: query,
+ });
+}
+
+export function orderPDFFromTemplateFile(query) {
+ return axios({
+ url: "/udiwms/pdf/template/order/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/IoAuditedOrder.vue b/src/views/inout/IoAuditedOrder.vue
index 9c35bee3..6a326eee 100644
--- a/src/views/inout/IoAuditedOrder.vue
+++ b/src/views/inout/IoAuditedOrder.vue
@@ -127,7 +127,7 @@
打印
@@ -340,6 +340,7 @@ import {selectSysParamByKey} from "@/api/param/systemParamConfig";
import {getResultDetailList} from "@/api/inout/orderDetailResult";
import {getCodeDetailList} from "@/api/inout/orderDetailCode";
import {getCodeList} from "@/api/inout/code";
+import {inspectionOrderPDFFromTemplateFile,orderPDFFromTemplateFile} from "@/api/itextpdf/orderPrint"
const formJson = {
@@ -686,6 +687,40 @@ export default {
},
editCodeDialog(row) {
+ },
+ printOrder(row) {
+ let tQuery = {
+ action: row.action,
+ moduleId: 1,
+ }
+ this.loading = true;
+ inspectionOrderPDFFromTemplateFile(tQuery).then((response) => {
+ if (response.code === 20000) {
+ tQuery = {
+ templateId: response.data,
+ orderIdFk: row.billNo,
+ action: row.action,
+ }
+ orderPDFFromTemplateFile(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。
+ }).catch(() => {
+ this.loading = false;
+ });
+ } else {
+ this.loading = false;
+ this.$message.error(response.message);
+ }
+ }).catch(() => {
+ this.loading = false;
+ });
},
onResultReset() {
this.resultQuery = {
diff --git a/src/views/inout/IoCheckSuccessOrder.vue b/src/views/inout/IoCheckSuccessOrder.vue
index f3d689d1..b68d7e03 100644
--- a/src/views/inout/IoCheckSuccessOrder.vue
+++ b/src/views/inout/IoCheckSuccessOrder.vue
@@ -128,7 +128,7 @@
打印
@@ -454,6 +454,8 @@ import {getBizDetailList} from "@/api/inout/orderDetailBiz";
import {getCodeDetailList} from "@/api/inout/orderDetailCode";
import {getCodeList} from "@/api/inout/code";
import AcceptOrder from "@/views/inout/DialogReviewOrder";
+import {inspectionOrderPDFFromTemplateFile,orderPDFFromTemplateFile} from "@/api/itextpdf/orderPrint"
+
const formJson = {
site_id: "",
@@ -623,6 +625,40 @@ export default {
this.filterQuery.action = null;
this.getBusType();
},
+ printOrder(row) {
+ let tQuery = {
+ action: row.action,
+ moduleId: 1,
+ }
+ this.loading = true;
+ inspectionOrderPDFFromTemplateFile(tQuery).then((response) => {
+ if (response.code === 20000) {
+ tQuery = {
+ templateId: response.data,
+ orderIdFk: row.billNo,
+ action: row.action,
+ }
+ orderPDFFromTemplateFile(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。
+ }).catch(() => {
+ this.loading = false;
+ });
+ } else {
+ this.loading = false;
+ this.$message.error(response.message);
+ }
+ }).catch(() => {
+ this.loading = false;
+ });
+ },
getBusType() {
let query = {
code: this.filterQuery.invCode,