CRF表中,在报告页面,查看附件文件时,失败

main
wangxiaoshuang 2025-06-30 16:01:11 +08:00
parent c34906dc26
commit 509e5b04df
1 changed files with 50 additions and 12 deletions

View File

@ -200,12 +200,12 @@
</el-dialog>
<!-- 预览文件 -->
<el-dialog v-if="previewVisible" :visible.sync="previewVisible" :title="$t('common:button:preview')"
:fullscreen="true" append-to-body custom-class="base-dialog-wrapper">
<div class="base-modal-body" style="border: 2px solid #ccc; padding: 10px">
<PreviewFile v-if="previewVisible" :file-path="currentPath" :file-type="currentType" />
</div>
</el-dialog>
<viewer ref="picture_perview_customizeReportPage" style="margin: 0 10px"
v-if="currentType && ['png', 'jpg', 'jpeg'].includes(currentType.toLowerCase())"
:images="[`${OSSclientConfig.basePath}${currentPath}`]" :options="viewerOptions">
<img v-show="false" :src="`${OSSclientConfig.basePath}${currentPath}`" alt="Image" />
</viewer>
</div>
</template>
<script>
@ -214,12 +214,10 @@ import { setSkipReadingCache } from '@/api/reading'
import { getAutoCutNextTask } from '@/api/user'
import const_ from '@/const/sign-code'
import SignForm from '@/views/trials/components/newSignForm'
import PreviewFile from '@/components/PreviewFile/index'
import { getToken } from '@/utils/auth'
import store from '@/store'
export default {
name: 'CustomizeReportPage',
components: { SignForm, PreviewFile },
components: { SignForm },
data() {
return {
trialId: '',
@ -244,9 +242,23 @@ export default {
questionForm: {},
questionId: null,
taskInfo: null,
previewVisible: false,
currentPath: '',
currentType: ''
currentType: '',
viewerOptions: {
toolbar: {
zoomIn: true,
zoomOut: true,
reset: true,
prev: false,
next: false,
rotateLeft: true,
rotateRight: true,
flipHorizontal: true,
flipVertical: true,
}
}
}
},
watch: {
@ -726,7 +738,33 @@ export default {
this.currentPath = path
const arr = path.split('.')
this.currentType = arr[arr.length - 1]
this.previewVisible = true
// this.previewVisible = true
if (['.ppt',
'.pptx',
'.doc',
'.docx',
'.xls',
'.xlsx'].includes(`.${this.currentType.toLowerCase()}`)) {
this.$onlyOffice({
path: path,
type: this.currentType,
title: '预览'
})
}
if (['.jpg',
'.jpeg',
'.png'].includes(`.${this.currentType.toLowerCase()}`)) {
this.$nextTick(() => {
this.$refs['picture_perview_customizeReportPage'].$viewer.show()
})
}
if (['.pdf'].includes(`.${this.currentType.toLowerCase()}`)) {
this.$preview({
path: path,
type: 'pdf',
title: '预览'
})
}
}
}
}