增加下载pdf按钮
This commit is contained in:
parent
7550592b8a
commit
0af809a013
|
|
@ -94,6 +94,7 @@
|
|||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="downpdf" type="primary" v-if="formData.id" :disabled="formLoading">下 载</el-button>
|
||||
<el-button @click="preview" type="primary" :disabled="formLoading">预 览</el-button>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
|
|
@ -228,6 +229,36 @@ const resetForm = () => {
|
|||
}
|
||||
|
||||
|
||||
const downpdf = async () => {
|
||||
const id = formData.value.id;
|
||||
if (id) {
|
||||
formData.value = await ProduceOrderApi.getProduceOrder(id)
|
||||
}
|
||||
//日期转换
|
||||
formData.value.contractDateStr = formatDate(formData.value.contractDate,'YYYY-MM-DD')
|
||||
formData.value.reportDateStr = formatDate(formData.value.reportDate,'YYYY-MM-DD')
|
||||
formData.value.reportTimeStr = formatDate(formData.value.reportDate,'HH:mm:ss')
|
||||
formData.value.produceDateStr = formatDate(formData.value.produceDate,'YYYY-MM-DD')
|
||||
formData.value.inspectionDateStr = formatDate(formData.value.inspectionDate,'YYYY-MM-DD')
|
||||
formData.value.deliverydateStr = formatDate(formData.value.deliverydate,'YYYY-MM-DD')
|
||||
//formData.value.saleContractNo = formData.value.orderNo
|
||||
|
||||
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');
|
||||
console.log(res);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
const preview = async () => {
|
||||
const id = formData.value.id;
|
||||
if (id) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue