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

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

parent b6a0591c
......@@ -50,6 +50,7 @@ import html2canvas from 'html2canvas';
import { jsPDF } from "jspdf";
import {uploadFile} from '@/api/infra/file'
import FileSaver from 'file-saver'
import {getOrder, getOrderDetail} from "@/api/ecw/order";
window.html2canvas = html2canvas
export default {
name: "makeLadingBill",
......@@ -175,7 +176,13 @@ export default {
showLoaingTemplate() {
this.visible = true;
},
// 先获取订单信息,pdf用 订单号+唛头命名
createPdf(){
getOrder(this.currRow.orderId).then(res => {
this.afterCreatePdf(res.data)
})
},
afterCreatePdf(orderData){
let loading = this.$loading()
html2canvas(document.querySelector("#html2canvas-container"), {dpi:144, useCORS: true}).then(canvas => {
const doc = new jsPDF('p','pt','a4',true);
......@@ -194,13 +201,13 @@ export default {
/* doc.save("a4.pdf");
return Promise.reject() */
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('path', `admin/shipment/${this.selfNo}/pdf/${file}`) // 最前面不能有/,否则返回的url会有两个/
/* let blob = new Blob([doc.output('arraybuffer')], {type: "application/pdf"})
FileSaver.saveAs(blob, file);
FileSaver.saveAs(blob, file);
return */
return uploadFile(form)
}).then(res => {
......
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