Procházet zdrojové kódy

区分报告PDF预览与其他PDF预览

cfort před 2 roky
rodič
revize
8313e17801

+ 9 - 1
src/business/platform/file/attachment/selector.vue

@@ -57,7 +57,7 @@
     import { TRANSFER_DATA } from '@/constant'
     import { TRANSFER_DATA } from '@/constant'
     import fView from './editFile/fView.vue'
     import fView from './editFile/fView.vue'
     import { SYSTEM_URL, BASE_API } from '@/api/baseUrl'
     import { SYSTEM_URL, BASE_API } from '@/api/baseUrl'
-
+    const specialField = ['报告文件', '报告文档', '已盖章报告']
     export default {
     export default {
         components: {
         components: {
             IbpsFileAttachmentSelector,
             IbpsFileAttachmentSelector,
@@ -195,6 +195,13 @@
                     lineHeight: `${height}px`,
                     lineHeight: `${height}px`,
                     display: 'inline'
                     display: 'inline'
                 }
                 }
+            },
+            pdfPreviewType() {
+                const t = specialField.some(i => this.elFormItem.label && this.elFormItem.label.includes(i))
+                if (this.elFormItem.label && t) {
+                    return 'PDFH5'
+                }
+                return 'ONLYOFFICE'
             }
             }
         },
         },
         watch: {
         watch: {
@@ -522,6 +529,7 @@
                 this.optionFileView.fileType = this.attachment.ext // 类型
                 this.optionFileView.fileType = this.attachment.ext // 类型
                 this.optionFileView.data = this.attachment // 记录编制的位置,需要替换。
                 this.optionFileView.data = this.attachment // 记录编制的位置,需要替换。
                 this.optionFileView.data.index = index
                 this.optionFileView.data.index = index
+                this.optionFileView.previewType = this.pdfPreviewType
                 this.filePreviewVisible = true
                 this.filePreviewVisible = true
             },
             },
             /**
             /**

+ 4 - 2
src/components/ibps-file-viewer/index.vue

@@ -125,7 +125,8 @@
                 return PopupManager.getZIndex()
                 return PopupManager.getZIndex()
             },
             },
             loadViewer() {
             loadViewer() {
-                var flag = true;
+                console.log(this.optionFile.previewType)
+                var flag = true
                 if (/Mobi|Android|iPhone|iPad/i.test(navigator.userAgent)) {
                 if (/Mobi|Android|iPhone|iPad/i.test(navigator.userAgent)) {
                     flag = false
                     flag = false
                 }
                 }
@@ -134,7 +135,8 @@
                     this.zIndex = this.fixZIndex()
                     this.zIndex = this.fixZIndex()
                     this.fileUrl = this.url
                     this.fileUrl = this.url
                     this.fileType = 'image'
                     this.fileType = 'image'
-                } else if(flag && pdfType.includes(this.fileExt)){
+                } else if(flag && pdfType.includes(this.fileExt) && this.optionFile.previewType === 'PDFH5'){
+                    // 仅特定字段的PDF文件用PDFh5预览,其余PDF文件使用onlyoffice预览
                     this.fileType = 'pdf'
                     this.fileType = 'pdf'
                     this.$nextTick(() => {
                     this.$nextTick(() => {
                         this.$refs.viewer.load(this.url)
                         this.$refs.viewer.load(this.url)