|
|
@@ -114,12 +114,12 @@ export default {
|
|
|
|
|
|
let printData = {...header}
|
|
|
|
|
|
- // let hiprintTemplate = new hiprint.PrintTemplate({
|
|
|
- // template: layout,
|
|
|
- // })
|
|
|
+ let hiprintTemplate = new hiprint.PrintTemplate({
|
|
|
+ template: layout,
|
|
|
+ })
|
|
|
console.log('data',header)
|
|
|
console.log('layout',layout)
|
|
|
- // console.log('hiprintTemplate',hiprintTemplate)
|
|
|
+ console.log('hiprintTemplate',hiprintTemplate)
|
|
|
|
|
|
// hiprintTemplate.toPdf(printData,'单据打印',{isDownload:false,type:'datauristring'}).then(dataURL=>{
|
|
|
// this.blob=dataURL
|
|
|
@@ -135,25 +135,25 @@ export default {
|
|
|
// })
|
|
|
// })
|
|
|
//Blob
|
|
|
- new hiprint.PrintTemplate({ template: layout,}).toPdf(printData,'单据打印',{isDownload:false,type:''}).then(blob=>{
|
|
|
- console.log(1)
|
|
|
- // console.log('blob',blob)
|
|
|
- // let pdf =this.blobToFile(blob, 'blob.pdf')
|
|
|
- let pdf = new File([blob], 'blob.pdf', { type: blob.type })
|
|
|
- // console.log('pdf',pdf)
|
|
|
- let formData = new FormData();
|
|
|
- formData.append('file', pdf);
|
|
|
- console.log('formData',formData)
|
|
|
- this.excute(this.$service.fileService, `upload?folder=pdf&uuid=${this.$route.query.uuid}`,formData).then(res => {
|
|
|
- console.log('upload-res',res)
|
|
|
- if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- console.log('upload-success',res)
|
|
|
- }
|
|
|
- })
|
|
|
- }).catch(err => {
|
|
|
- console.log('upload-err',err)
|
|
|
- })
|
|
|
-
|
|
|
+ // hiprintTemplate.toPdf(printData,'单据打印',{isDownload:false,type:''}).then(blob=>{
|
|
|
+ // console.log(1)
|
|
|
+ // // console.log('blob',blob)
|
|
|
+ // // let pdf =this.blobToFile(blob, 'blob.pdf')
|
|
|
+ // let pdf = new File([blob], 'blob.pdf', { type: blob.type })
|
|
|
+ // // console.log('pdf',pdf)
|
|
|
+ // let formData = new FormData();
|
|
|
+ // formData.append('file', pdf);
|
|
|
+ // console.log('formData',formData)
|
|
|
+ // this.excute(this.$service.fileService, `upload?folder=pdf&uuid=${this.$route.query.uuid}`,formData).then(res => {
|
|
|
+ // console.log('upload-res',res)
|
|
|
+ // if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
+ // console.log('upload-success',res)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }).catch(err => {
|
|
|
+ // console.log('upload-err',err)
|
|
|
+ // })
|
|
|
+ hiprintTemplate.toPdf(this.printData, '打印预览pdf');
|
|
|
}else {
|
|
|
console.log('W_006-err')
|
|
|
this.$Message.warning(this.$t('W_006'))
|