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