单据打印功能代码提交

prod
郑明梁 2 years ago
parent bed9fd03a1
commit 24d07e068e

@ -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
});
}

@ -127,7 +127,7 @@
<el-button
type="text"
size="small"
@click.native.stop="printDialog(scope.row)"
@click.native.stop="printOrder(scope.row)"
>打印
</el-button
>
@ -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) => {
//pdfurl
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 = {

@ -128,7 +128,7 @@
<el-button
type="text"
size="small"
@click.native.stop="printDialog(scope.row.id)"
@click.native.stop="printOrder(scope.row)"
>打印
</el-button
>
@ -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) => {
//pdfurl
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,

Loading…
Cancel
Save