|
|
@@ -1,5 +1,9 @@
|
|
|
<template>
|
|
|
-
|
|
|
+ <div>
|
|
|
+ <div> 打印数据返回 => {{printDataRes}}</div>
|
|
|
+ <div> 模板数据返回 => {{printLayoutRes}}</div>
|
|
|
+ <div> 上传PDF返回 => {{uploadRes}}</div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
@@ -16,6 +20,9 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
templateList: [],
|
|
|
+ printDataRes:undefined,
|
|
|
+ printLayoutRes:undefined,
|
|
|
+ uploadRes:undefined,
|
|
|
// docs:{
|
|
|
// // 销售订单
|
|
|
// 'order':{'docName':this.$config.docCode.order},
|
|
|
@@ -88,7 +95,9 @@ export default {
|
|
|
Promise.all([data,layout])
|
|
|
.then((results) => {
|
|
|
console.log('data',data)
|
|
|
+ this.printDataRes=data
|
|
|
console.log('layout',layout)
|
|
|
+ this.printLayoutRes=layout
|
|
|
|
|
|
// 在这里执行接下来的操作
|
|
|
if(results?.[0]?.code === this.$config.SUCCESS_CODE){
|
|
|
@@ -102,7 +111,6 @@ export default {
|
|
|
let hiprintTemplate = new hiprint.PrintTemplate({
|
|
|
template: layout,
|
|
|
})
|
|
|
- //todo
|
|
|
// hiprintTemplate.toPdf(printData,'单据打印',{isDownload:false,type:'datauristring'}).then(dataURL=>{
|
|
|
// let pdf = this.dataURLtoFile(dataURL, "pdf");
|
|
|
// let formData = new FormData();
|
|
|
@@ -122,6 +130,7 @@ export default {
|
|
|
this.excute(this.$service.fileService, `upload?folder=pdf&uuid=${this.$route.query.uuid}`,formData).then(res => {
|
|
|
if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
console.log('upload-res',res)
|
|
|
+ this.printLayoutRes=res
|
|
|
}
|
|
|
})
|
|
|
})
|