| | |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog v-model="previewVisible" :show-close="false" fullscreen> |
| | | <template #header="{ close, titleId, titleClass }"> |
| | | <el-dialog v-model="previewVisible" :show-close="true" fullscreen> |
| | | <!-- <template #header="{ close, titleId, titleClass }"> |
| | | <el-row justify="end"> |
| | | <el-button type="danger" @click="close" icon="CircleCloseFilled"> |
| | | 关闭 |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | @click="handelPrint(refWord)" |
| | | @click="handelPrint(pdfPreview)" |
| | | icon="PrintFilled" |
| | | > |
| | | 打印 |
| | | </el-button> |
| | | </el-row> |
| | | </template> |
| | | </template> --> |
| | | <div ref="refWord"></div> |
| | | <iframe ref="pdfPreview" width="100%" height="100vh" style="height: calc(100vh - 60px);"></iframe> |
| | | </el-dialog> |
| | | </template> |
| | | <script setup> |
| | |
| | | * 场景巡查单据自动下载 |
| | | */ |
| | | import { ref, watch } from 'vue'; |
| | | import { useRouter } from "vue-router"; |
| | | import { |
| | | exportDocx, |
| | | prepareDocxBlob, |
| | |
| | | |
| | | const emits = defineEmits(['update:modelValue']); |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const refWord = ref(null); |
| | | const pdfPreview = ref(null); |
| | | |
| | | const loading = ref(false); |
| | | const scrollbarRef = ref(); |
| | |
| | | const param = parseParam(item); |
| | | if (param) { |
| | | generatePdf(param, (blob, name) => { |
| | | blob.getBuffer((buffer) => { |
| | | previewDocx(buffer, refWord.value); |
| | | }); |
| | | previewVisible.value = true; |
| | | previewDocx(blob, refWord.value); |
| | | // blob.print() |
| | | // blob.getBlob((buffer) => { |
| | | // previewDocx(buffer, refWord.value); |
| | | // }); |
| | | |
| | | // const resolved = router.resolve({ |
| | | // path: '/fysp/scene/SceneInspectFile', |
| | | // query: { |
| | | // data: JSON.stringify(blob), |
| | | // } |
| | | // }); |
| | | // window.open(resolved.href, '_blank') |
| | | |
| | | |
| | | // console.log('pdf', blob); |
| | | |
| | | // blob.autoPrint(); |
| | | // // blob.save(name) |
| | | // // 生成PDF的Blob对象 |
| | | // var pdfBlob = blob.output('blob'); |
| | | |
| | | // setTimeout(() => { |
| | | // previewDocx(blob, refWord.value); |
| | | // // 在iframe中显示预览 |
| | | // pdfPreview.value.src = URL.createObjectURL(pdfBlob); |
| | | // }, 200); |
| | | }); |
| | | } |