Commit 2d4d6113 authored by dragondean@qq.com's avatar dragondean@qq.com

提单和条款模板

parent 470036ca
...@@ -174,7 +174,7 @@ export default { ...@@ -174,7 +174,7 @@ export default {
}, },
createPdf(){ createPdf(){
let loading = this.$loading() let loading = this.$loading()
html2canvas(document.querySelector("#html2canvas-container"), {dpi:144}).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);
const imgWidth = canvas.width const imgWidth = canvas.width
...@@ -187,7 +187,8 @@ export default { ...@@ -187,7 +187,8 @@ export default {
} }
const _left = (595.28-_w)/2; const _left = (595.28-_w)/2;
doc.addImage(canvas, 'PNG', _left, 0, _w,_h, '', 'FAST'); doc.addImage(canvas, 'PNG', _left, 0, _w,_h, '', 'FAST');
// doc.save("a4.pdf"); doc.save("a4.pdf");
return Promise.reject()
let form = new FormData() let form = new FormData()
form.append('file', new File([doc.output('arraybuffer')], Date.now() + '.pdf', {type: 'application/pdf'})) form.append('file', new File([doc.output('arraybuffer')], Date.now() + '.pdf', {type: 'application/pdf'}))
return uploadFile(form) return uploadFile(form)
...@@ -253,6 +254,7 @@ export default { ...@@ -253,6 +254,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep #html2canvas-container{ ::v-deep #html2canvas-container{
padding: 3rem;
p{ p{
margin: 0; margin: 0;
} }
......
...@@ -364,6 +364,8 @@ ...@@ -364,6 +364,8 @@
</el-card> </el-card>
<el-form-item :label="$t('条款')" prop="contentZh"> <el-form-item :label="$t('条款')" prop="contentZh">
<el-link type="primary" @click.native="setAgreementTpl('agreementSea')">海运模板</el-link> |
<el-link type="primary" @click.native="setAgreementTpl('agreementAir')">空运模板</el-link>
<ueditor v-model="ladingform.contentZh" :min-height="192" style="width:960px"/> <ueditor v-model="ladingform.contentZh" :min-height="192" style="width:960px"/>
</el-form-item> </el-form-item>
...@@ -649,6 +651,9 @@ export default { ...@@ -649,6 +651,9 @@ export default {
setTpl(type){ setTpl(type){
this.ladingform.titleZh = tpl[type] this.ladingform.titleZh = tpl[type]
}, },
setAgreementTpl(type){
this.ladingform.contentZh = tpl[type]
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
......
This diff is collapsed.
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