Commit e29d9c36 authored by 我在何方's avatar 我在何方
parents 326d0325 0b9e8a6a
......@@ -191,7 +191,7 @@ export function zipDownload(params) {
url: "/shipment/make-bill-of-lading/zipDownload",
responseType: "blob",
method: "get",
timeout: 30000,
timeout: 120000,
params,
});
}
......@@ -326,3 +326,12 @@ export function updateAbnormalOrder(data) {
data,
});
}
// 更新提单URL
export function updateUrl(data) {
return request({
url: "/shipment/make-bill-of-lading/updateUrl",
method: "put",
data,
});
}
\ No newline at end of file
......@@ -49,6 +49,8 @@ import { getToken } from "@/utils/auth";
import html2canvas from 'html2canvas';
import { jsPDF } from "jspdf";
import {uploadFile} from '@/api/infra/file'
import FileSaver from 'file-saver'
window.html2canvas = html2canvas
export default {
name: "makeLadingBill",
components: {
......@@ -193,7 +195,11 @@ export default {
let form = new FormData()
let file = this.selfNo + '-' + this.currRow.tidanNo + '.pdf'
form.append('file', new File([doc.output('arraybuffer')], file, {type: 'application/pdf'}))
form.append('path', file)
form.append('path', `admin/shipment/${this.selfNo}/pdf/${file}`) // 最前面不能有/,否则返回的url会有两个/
/* let blob = new Blob([doc.output('arraybuffer')], {type: "application/pdf"})
FileSaver.saveAs(blob, file);
return */
return uploadFile(form)
}).then(res => {
return this.submit(res.data)
......
<template>
<el-row>
<div v-html="contentHtml" class="contentHtml"></div>
<div v-html="contentHtml" id="html2canvas-container" class="contentHtml"></div>
<el-row v-if="currRow.status === 2 && type === 'previewBill'" style="text-align: center;">
<el-button type="primary" @click="download">{{$t('下载')}}</el-button>
<el-button type="primary" @click="print">{{$t('打印')}}</el-button>
<el-button type="primary" @click="createPdf">{{$t('刷新提单文件')}}</el-button>
</el-row>
</el-row>
</template>
......@@ -12,6 +13,9 @@
import lodop from "@/utils/lodop";
import * as _BOX from "@/api/ecw/box";
import FileSaver from "file-saver";
import html2canvas from 'html2canvas';
import { jsPDF } from "jspdf";
import {uploadFile} from '@/api/infra/file'
export default {
name: "previewBill",
......@@ -24,10 +28,42 @@ export default {
download() {
_BOX["downloadBillService"]({ id: this.currRow.id }).then((res) => {
if (res.data && res.data.imgUrl) {
FileSaver.saveAs(res.data.imgUrl, res.data.imgUrl.split('/').pop());
FileSaver.saveAs(res.data.imgUrl + '?' + Math.random(), res.data.imgUrl.split('/').pop());
}
});
},
createPdf(){
let loading = this.$loading()
const doc = new jsPDF('p','pt','a4',true);
html2canvas(document.querySelector("#html2canvas-container"), {dpi:144, useCORS: true}).then(canvas => {
const imgWidth = canvas.width
const imgHeight = canvas.height
let _w = 595.28;
let _h = 595.28/imgWidth*imgHeight;
if(_h>841.89){
_h = 841.89;
_w = _h/imgHeight*imgWidth
}
const _left = (595.28-_w)/2;
doc.addImage(canvas, 'PNG', _left, 0, _w,_h, '', 'FAST');
return _BOX["downloadBillService"]({ id: this.currRow.id })
}).then(res => {
let form = new FormData()
let pathname = (new URL(res.data.imgUrl)).pathname
let fileName = pathname.substring(pathname.lastIndexOf('/')).substring(1)
let selfNo = fileName.split('-')[0]
form.append('file', new File([doc.output('arraybuffer')], fileName, {type: 'application/pdf'}))
form.append('path', `admin/shipment/${selfNo}/pdf/${fileName}`) // 最前面不能有/,否则返回的url会有两个/
return uploadFile(form)
}).then(res => {
_BOX['updateUrl']({id: this.currRow.id, imgUrl: res.data})
}).finally(res => {
loading.close()
})
},
print() {
lodop()
.then((LODOP) => {
......
......@@ -108,7 +108,8 @@ export default {
loadData(){
printTag(this.orderId).then(res => {
this.$set(this, 'tags', res.data)
this.form.end = res.data.length
this.form.start = res.data[0].num
this.form.end = res.data[res.data.length-1].num
})
},
closeDialog(){
......@@ -117,7 +118,7 @@ export default {
this.$emit('close');
},
showPreview(){
if(this.form.end > this.tags.length){
if(this.form.end > this.tags[this.tags.length-1].num){
return this.$message.error(this.$t('结束标签不对'))
}
this.$refs["form"].validate(valid => {
......
......@@ -42,6 +42,7 @@
</el-table-column>
<el-table-column :label="$t('品牌')">
<template slot-scope="{row}">
<template v-if="row.brandName">{{row.brandName}}</template>
<dict-tag :type="DICT_TYPE.ECW_IS_BRAND" :value="row.brandType" />
</template>
</el-table-column>
......
......@@ -186,10 +186,10 @@
<template slot-scope="{row}">
<template v-if="row.charging ==1">
<template v-if="!row.seaFreight">{{ $t('未报价') }}</template>
<template v-if="!row.oneSeaFreight">{{ $t('未报价') }}</template>
<el-link type="primary" @click="showFeeDetail(row, 'clearance')" v-else>{{$t('全包价')}} {{row.oneSeaFreight}} {{currencyMap[row.seaFreightCurrency]}} / {{unitMap[row.seaFreightVolume]}}</el-link>
</template>
<template v-else-if="!row.seaFreight && !row.clearanceFreight">{{ $t('未报价') }}</template>
<template v-else-if="!row.oneSeaFreight && !row.oneClearanceFreight">{{ $t('未报价') }}</template>
<template v-else>
<el-link type="primary" @click="showFeeDetail(row, 'freight')">
{{$t('运费')}}{{row.oneSeaFreight}} {{currencyMap[row.seaFreightCurrency]}} / {{unitMap[row.seaFreightVolume]}}
......
......@@ -292,8 +292,10 @@
</template>
<!-- 入仓修改 -->
<template v-if="
(
include(scope.row.inWarehouseState, [202, 207, 202, 209, 210, 202, 211, 212, 202, 213, 214, 215, 216, 204, 205]) &&
scope.row.status != 11 && exclude(scope.row.shipmentState, [314,315,317,318])
)
">
<el-dropdown-item @click.native="$router.push('/order/warehousing-update?id=' + scope.row.orderId)" v-hasPermi="['ecw:order:update']" :disabled2="scope.row.parentOrderId">{{$t('入仓修改')}}</el-dropdown-item>
</template>
......
......@@ -382,7 +382,8 @@ export default {
"orderId": this.order.orderId,
urls: this.form.urls,
sumVolume: this.form.sumVolume,
sumWeight: this.form.sumWeight
sumWeight: this.form.sumWeight,
isAppend: this.isAdd
}
// 标签箱号
......@@ -472,9 +473,9 @@ export default {
return this.orderItemList.find(item => item.orderItemId == orderItemId)
}
},
// isAdd() {
// return this.$route.path === "/order/warehousing-add"
// },
isAdd() {
return this.$route.path === "/order/warehousing-add"
},
isEdit() {
return this.$route.path === "/order/warehousing-update"
},
......
......@@ -244,7 +244,7 @@
<el-dialog :title="$t('查看价格日志')" :visible="showLogsDialog" :before-close="closeLogsDialog" width="1000px">
<el-table :data="logs">
<el-table-column :label="$t('序号')" type="index"></el-table-column>
<el-table-column :label="$t('修改人')" prop="creatorName"></el-table-column>
<el-table-column :label="$t('修改人')" prop="creatorName" width="200px"></el-table-column>
<el-table-column :label="$t('修改时间')">
<template slot-scope="{row}">{{row.createTime|parseTime}}</template>
</el-table-column>
......@@ -309,6 +309,8 @@
</div>
</template>
</template>
<div v-if="row.detail.validateStartDate || row.detail.validateStartDate">有效期:{{ row.detail.validateStartDate|parseTime }}-{{ row.detail.validateEndDate|parseTime }}</div>
</template>
</el-table-column>
......
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