打印时,图片或pdf的显示
This commit is contained in:
parent
868b0c73ae
commit
6d229f92d2
@ -517,7 +517,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="true"
|
v-if="imagebase64_new && !imagebase64_new.toLowerCase().endsWith('.pdf')"
|
||||||
type="primary"
|
type="primary"
|
||||||
style="width: 90px"
|
style="width: 90px"
|
||||||
v-print="{ id: 'printMe_ecg' }"
|
v-print="{ id: 'printMe_ecg' }"
|
||||||
@ -529,7 +529,20 @@
|
|||||||
<el-divider style="margin-top: 8px; margin-bottom: 1px" />
|
<el-divider style="margin-top: 8px; margin-bottom: 1px" />
|
||||||
</div>
|
</div>
|
||||||
<div id="printMe_ecg">
|
<div id="printMe_ecg">
|
||||||
<el-image :src="imagebase64_new" style="width: 100%; height: 100%;" />
|
<div v-loading="!imagebase64_new" element-loading-text="加载中...">
|
||||||
|
<iframe
|
||||||
|
v-if="imagebase64_new && imagebase64_new.toLowerCase().endsWith('.pdf')"
|
||||||
|
:src="imagebase64_new"
|
||||||
|
style="width: 100%; height: calc(100vh - 150px); border: none;"
|
||||||
|
frameborder="0"
|
||||||
|
></iframe>
|
||||||
|
<el-image
|
||||||
|
v-else-if="imagebase64_new"
|
||||||
|
:src="imagebase64_new"
|
||||||
|
style="width: 100%; height: calc(100vh - 150px); object-fit: contain;"
|
||||||
|
fit="contain"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<div style="position: fixed; top: 0; left: 0; z-index: -1100">
|
<div style="position: fixed; top: 0; left: 0; z-index: -1100">
|
||||||
@ -954,7 +967,15 @@ function print() {
|
|||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
if (applyFormVO.value.pdfurl) {
|
if (applyFormVO.value.pdfurl) {
|
||||||
const fileUrl = applyFormVO.value.pdfurl.trim()
|
const fileUrl = applyFormVO.value.pdfurl.trim()
|
||||||
|
// 检查是否为PDF文件
|
||||||
|
const isPdf = fileUrl.toLowerCase().endsWith('.pdf')
|
||||||
|
if (isPdf) {
|
||||||
|
// 如果是PDF,使用iframe显示
|
||||||
imagebase64_new.value = fileUrl
|
imagebase64_new.value = fileUrl
|
||||||
|
} else {
|
||||||
|
// 如果是图片,使用el-image显示
|
||||||
|
imagebase64_new.value = fileUrl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 100)
|
}, 100)
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user