展示优化

This commit is contained in:
LHD_HY 2025-11-28 17:53:53 +08:00
parent 32aecd8b1d
commit 892a6c5543
3 changed files with 16 additions and 7 deletions

View File

@ -38,7 +38,7 @@
@app-ready="handleAppReady" @error="handleError" @initialized="handleInitialized" :force-save="true" @app-ready="handleAppReady" @error="handleError" @initialized="handleInitialized" :force-save="true"
:save-timeout="15000" /> :save-timeout="15000" />
</el-dialog> --> </el-dialog> -->
<ViewFile v-if="dialogVisible" :file="fileData" @closeDialog="handleCloseDialog" /> <ViewFile v-if="dialogVisible" :file="fileData" @closeDialog="handleCloseDialog" :without-modal="withoutModal" />
</div> </div>
</div> </div>
</template> </template>
@ -106,6 +106,10 @@ export default {
imageHeight: { imageHeight: {
type: [Number, String], type: [Number, String],
default: 400 default: 400
},
withoutModal: {
type: Boolean,
default: false
} }
}, },
computed: { computed: {
@ -138,7 +142,7 @@ export default {
// //
handleFileClick() { handleFileClick() {
console.log(this.file); console.log(this.file);
this.fileData = this.file this.fileData = this.file
this.dialogVisible = true this.dialogVisible = true
}, },
@ -279,4 +283,4 @@ export default {
} }
</style> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<el-dialog :visible.sync="dialogVisible" width="50%" class="preview-dialog" title="文件预览" @close="handleClose"> <el-dialog :visible.sync="dialogVisible" width="50%" class="preview-dialog" title="文件预览" @close="handleClose" :modal="!withoutModal">
<OnlyOfficeViewer :document-url="documentUrl" :document-title="documentTitle" :document-key="documentKey" <OnlyOfficeViewer :document-url="documentUrl" :document-title="documentTitle" :document-key="documentKey"
:mode="mode" :type="type" @document-ready="handleDocumentReady" @app-ready="handleAppReady" :mode="mode" :type="type" @document-ready="handleDocumentReady" @app-ready="handleAppReady"
@error="handleError" @initialized="handleInitialized" :force-save="true" :save-timeout="15000" /> @error="handleError" @initialized="handleInitialized" :force-save="true" :save-timeout="15000" />
@ -13,7 +13,11 @@ export default {
file: { file: {
type: Object, type: Object,
default: () => null default: () => null
} },
withoutModal: {
type: Boolean,
default: false //
}
}, },
components: { components: {
OnlyOfficeViewer OnlyOfficeViewer
@ -21,7 +25,7 @@ export default {
data() { data() {
return { return {
dialogVisible: true, dialogVisible: true,
documentUrl: this.file.filePath, documentUrl: this.file.filePath,
documentTitle: this.file.fileName, documentTitle: this.file.fileName,
documentKey: (this.file?.sourceId || this.file?.id || '') + '', documentKey: (this.file?.sourceId || this.file?.id || '') + '',
mode: 'view', mode: 'view',
@ -65,4 +69,4 @@ export default {
.preview-dialog ::v-deep .onlyoffice-container { .preview-dialog ::v-deep .onlyoffice-container {
height: 100%; height: 100%;
} }
</style> </style>

View File

@ -17,6 +17,7 @@
:label="''" :label="''"
:file="form.fileList[0]" :file="form.fileList[0]"
:image-url="form.url" :image-url="form.url"
without-modal="true"
/> />
<span v-if="form.fileList.length === 0" class="no-file-tip">无附件</span> <span v-if="form.fileList.length === 0" class="no-file-tip">无附件</span>
</template> </template>