This commit is contained in:
wwb 2026-09-16 18:36:17 +08:00
parent 57bceb7a34
commit 04d5da2187
2 changed files with 330 additions and 364 deletions

View File

@ -348,14 +348,12 @@ const downpdf = async () => {
formData.value.details = ''
}
//初始化
//hiprint.init()
const hiprintTemplate = new hiprint.PrintTemplate({template: template1})
// printByHtml为预览打印
let printData = JSON.stringify(formData.value)
printData = JSON.parse(printData)
let hiprintTemplate = new hiprint.PrintTemplate({template: template1});
// 弹出浏览器打印窗口,并填充 字段名:name 的元素
// hiprintTemplate.print(hiprintTemplate);
//let html = hiprintTemplate.getHtml(printData);
//previewRef.value.showModal(html);
hiprintTemplate.toPdf(printData, '生产制单_' + formData.value.billno).then((res) => {
console.log('type:', 'pdfobjectnewwindow');
@ -397,21 +395,23 @@ const preview = async () => {
formData.value.details = ''
}
//初始化
//hiprint.init()
const hiprintTemplate = new hiprint.PrintTemplate({template: template1})
// printByHtml为预览打印
let printData = JSON.stringify(formData.value)
printData = JSON.parse(printData)
let hiprintTemplate = new hiprint.PrintTemplate({template: template1});
hiprintTemplate.print(printData);
/* hiprintTemplate.toPdf(printData, '打印预览', {isDownload: false, type: 'pdfobjectnewwindow'}).then((res) => {
console.log('type:', 'pdfobjectnewwindow');
console.log(res);
});*/
// 弹出浏览器打印窗口,并填充 字段名:name 的元素
// hiprintTemplate.print(hiprintTemplate);
//let html = hiprintTemplate.getHtml(printData);
//previewRef.value.showModal(html);
hiprintTemplate.toPdf(printData, '打印预览', {isDownload: false, type: 'pdfobjectnewwindow'}).then((res) => {
console.log('type:', 'pdfobjectnewwindow');
console.log(res);
});
}
</script>