[update] 修改企标稽查内容预览pdf和word,其他提示;浏览记录修改字段名

This commit is contained in:
lideqin
2023-09-28 10:52:21 +08:00
parent 163eb1091f
commit 13dcbb4aaa
2 changed files with 26 additions and 5 deletions
@@ -11,7 +11,8 @@
<div class="content"> <div class="content">
<!-- 左侧文件预览 --> <!-- 左侧文件预览 -->
<div class="content-left"> <div class="content-left">
<iframe :src="iframeSrc" width="100%" frameborder="0"></iframe> <iframe v-if="iframeSrc" :src="iframeSrc" width="100%" frameborder="0"></iframe>
<a-empty class="empty-file" v-else description="当前文件类型暂不支持预览"></a-empty>
</div> </div>
<!-- 右侧表单区域 --> <!-- 右侧表单区域 -->
<div class="content-right"> <div class="content-right">
@@ -39,6 +40,10 @@
import pick from 'lodash.pick' import pick from 'lodash.pick'
import { getFileInfo } from '@/api/api' import { getFileInfo } from '@/api/api'
import { previewPdf } from '@/utils/previewPdf' import { previewPdf } from '@/utils/previewPdf'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
const Base64 = require('js-base64').Base64
export default { export default {
name: 'CheckContentModal', name: 'CheckContentModal',
@@ -108,14 +113,23 @@ export default {
}) })
}, },
handlePreview (file) { handlePreview (file) {
// pdf预览 const fileSuffix = file.fileName ? file.fileName.split('.')[file.fileName.split('.').length - 1].toLowerCase() : ''
const url = previewPdf(file.id) if (fileSuffix === 'pdf') {
this.iframeSrc = url // pdf预览
const url = previewPdf(file.id)
this.iframeSrc = url
} else if (fileSuffix === 'docx') {
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/download/${file.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
// word文件仍使用KKFile进行预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
this.iframeSrc = url
}
}, },
close () { close () {
this.visible = false this.visible = false
this.model = {} this.model = {}
this.index = undefined this.index = undefined
this.iframeSrc = ''
}, },
handleCancel () { handleCancel () {
this.close() this.close()
@@ -157,4 +171,11 @@ export default {
} }
} }
.empty-file {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
}
</style> </style>
@@ -56,7 +56,7 @@ export default {
title: this.$t('personalCenter.browsingHistory.standardNo'), title: this.$t('personalCenter.browsingHistory.standardNo'),
align: 'center', align: 'center',
width: 180, width: 180,
dataIndex: 'standardNum', dataIndex: 'standardNumber',
scopedSlots: { customRender: 'toDetail' } scopedSlots: { customRender: 'toDetail' }
}, },
{ {