fix 81642

This commit is contained in:
danshihao
2024-02-02 11:11:43 +08:00
parent 35883ff1e1
commit 79d440b082
@@ -10,8 +10,10 @@
<div class="content">
<!-- 左侧文件预览 -->
<div class="content-left">
<iframe v-if="iframeSrc" :src="iframeSrc" width="100%" frameborder="0"></iframe>
<iframe @load="loadIframe" v-if="iframeSrc" :src="iframeSrc" width="100%" frameborder="0"></iframe>
<a-empty class="empty-file" v-else :description="$t('noFileAvailableForPreview')"></a-empty>
<!-- iframe加载时显示 -->
<a-spin v-if="iframeSrc && loading" class="iframe-loading"/>
</div>
<!-- 右侧表单区域 -->
<div class="content-right">
@@ -73,6 +75,7 @@ export default {
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
loading: false, // iframe的加载状态
// 父表的当前行数据
data: {},
// 当前表的当前行数据
@@ -107,6 +110,10 @@ export default {
}
},
methods: {
// iframe加载完成
loadIframe () {
this.loading = false
},
add (data) {
this.type = 'add'
this.data = Object.assign({}, data)
@@ -163,9 +170,11 @@ export default {
// word文件仍使用KKFile进行预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
this.iframeSrc = url
this.loading = true
}
},
close () {
this.loading = false
this.visible = false
this.model = {}
this.index = -1
@@ -209,11 +218,18 @@ export default {
height: 100%;
display: flex;
.content-left {
position: relative;
width: 60%;
height: 100%;
iframe {
height: calc(100% - 20px) !important;
}
.iframe-loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
.content-right {
width: 40%;