Commit 33f791b9 authored by dragondean@qq.com's avatar dragondean@qq.com

修改提单制作的文件名规则

parent b6a0591c
...@@ -50,6 +50,7 @@ import html2canvas from 'html2canvas'; ...@@ -50,6 +50,7 @@ import html2canvas from 'html2canvas';
import { jsPDF } from "jspdf"; import { jsPDF } from "jspdf";
import {uploadFile} from '@/api/infra/file' import {uploadFile} from '@/api/infra/file'
import FileSaver from 'file-saver' import FileSaver from 'file-saver'
import {getOrder, getOrderDetail} from "@/api/ecw/order";
window.html2canvas = html2canvas window.html2canvas = html2canvas
export default { export default {
name: "makeLadingBill", name: "makeLadingBill",
...@@ -175,7 +176,13 @@ export default { ...@@ -175,7 +176,13 @@ export default {
showLoaingTemplate() { showLoaingTemplate() {
this.visible = true; this.visible = true;
}, },
// 先获取订单信息,pdf用 订单号+唛头命名
createPdf(){ createPdf(){
getOrder(this.currRow.orderId).then(res => {
this.afterCreatePdf(res.data)
})
},
afterCreatePdf(orderData){
let loading = this.$loading() let loading = this.$loading()
html2canvas(document.querySelector("#html2canvas-container"), {dpi:144, useCORS: true}).then(canvas => { html2canvas(document.querySelector("#html2canvas-container"), {dpi:144, useCORS: true}).then(canvas => {
const doc = new jsPDF('p','pt','a4',true); const doc = new jsPDF('p','pt','a4',true);
...@@ -194,7 +201,7 @@ export default { ...@@ -194,7 +201,7 @@ export default {
/* doc.save("a4.pdf"); /* doc.save("a4.pdf");
return Promise.reject() */ return Promise.reject() */
let form = new FormData() let form = new FormData()
let file = this.selfNo + '-' + this.currRow.tidanNo + '.pdf' let file = this.currRow.orderNo + '-' + orderData.marks + '.pdf' //this.selfNo + '-' + this.currRow.tidanNo + '.pdf'
form.append('file', new File([doc.output('arraybuffer')], file, {type: 'application/pdf'})) form.append('file', new File([doc.output('arraybuffer')], file, {type: 'application/pdf'}))
form.append('path', `admin/shipment/${this.selfNo}/pdf/${file}`) // 最前面不能有/,否则返回的url会有两个/ form.append('path', `admin/shipment/${this.selfNo}/pdf/${file}`) // 最前面不能有/,否则返回的url会有两个/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment