Просмотр исходного кода

del:去除文件培训多余逻辑

liujiayin 2 лет назад
Родитель
Сommit
b9dbdef929

+ 0 - 112
src/business/platform/file/attachment/fileTraining/index.vue

@@ -1,112 +0,0 @@
-<!--
- * @Descripttion: 表单/数据模板脚本:
- * @version: 1.0
- * @Author: Liu_jiaYin
- * @Date: 2024-03-01 13:47:32
- * @LastEditors: Do not edit
- * @LastEditTime: 2024-03-01 17:35:29
--->
-<template>
-    <el-dialog
-        :visible.sync="dialogVisible"
-        :title="title"
-        fullscreen
-        append-to-body
-        custom-class="ibps-file-preview-dialog"
-        @close="closeDialog"
-    >
-        <fView :option-file="optionFile" :operation_status="operation_status" @hadLoadedFile="hadLoadedFile" />
-    </el-dialog>
-</template>
-<script>
-/**
-     * 文件预览
-     * 1、'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'  类型支持
-     * 2、图片支持缩放
-     * 3、音频,语音支持
-     * ==================
-     * 下一版本支持
-     * 1、pdf支持缩放
-     * 2、音频,语音多格式支持
-     * 3、压缩包支持
-     */
-import fView from '@/business/platform/file/attachment/editFile/fView.vue'
-export default {
-    name: 'file-training',
-    components: {
-        fView
-    },
-    props: {
-        visible: {
-            type: Boolean,
-            default: false
-        },
-        optionFile: {
-            type: Object,
-            default: () => {}
-        }
-    },
-    data () {
-        return {
-            dialogVisible: false,
-            operation_status: 'fileTraining',
-            title: '',
-            browseTime: 0, // 浏览时长初始值为 0
-            clearTimeSet: null
-        }
-    },
-    watch: {
-        optionFile: {
-            handler: function (val, oldVal) {
-                this.dialogVisible = this.visible
-                this.title = `《${val.title}》文件培训`
-            },
-            immediate: true
-        },
-        browseTime: {
-            handler: function (val, oldVal) {
-                this.title = `《${this.optionFile.title}》文件培训,查阅时长:${val}秒`
-            },
-            immediate: true
-        }
-    },
-    beforeDestroy () {
-        this.fileType = ''
-        this.option = {}
-    },
-    methods: {
-        closeDialog () {
-            this.beforeunloadHandler()
-            this.$emit('close', { fielData: this.optionFile, time: this.browseTime })
-        },
-        hadLoadedFile (v) {
-            this.setBrowseTime()
-        },
-        setBrowseTime () {
-            // 设置定时器
-            this.clearTimeSet = setInterval(() => {
-                this.browseTime++
-            }, 1000)
-        },
-        beforeunloadHandler (e) {
-            // 针对关闭窗口或者浏览器的
-            if (this.clearTimeSet != null) {
-                clearInterval(this.clearTimeSet)
-            }
-        }
-    }
-}
-</script>
-<style lang="scss">
-    .ibps-file-preview-dialog {
-      width: 80%;
-      z-index:99999;
-        .el-dialog__body {
-            padding: 0;
-
-        }
-        .file-type-txt {
-            height: calc(88vh) !important;
-        }
-    }
-</style>

+ 18 - 58
src/business/platform/file/attachment/selector.vue

@@ -10,8 +10,8 @@
             :multiple="multiple"
             :limit="limit"
             :disabled="disabled"
-            :readonly="fileReadonly"
-            :download="fileDownload"
+            :readonly="readonly"
+            :download="download"
             :operation_status="operation_status"
             :preview="preview"
             :upload-type="uploadType"
@@ -44,13 +44,6 @@
         <div v-if="showFile" class="divShow">
             <fView :option-file="optionFile" @updateFile="updateFile" />
         </div>
-        <div v-if="fileTrainingDialog">
-            <fileTraining
-                :visible="fileTrainingDialog"
-                :option-file="optionFile"
-                @close="closeFileTrainingDialog"
-            />
-        </div>
     </div>
 </template>
 <script>
@@ -63,7 +56,6 @@ import FilePreview from '@/business/platform/file/file-preview'
 import { supportFileTypes } from '@/components/ibps-file-viewer/constants'
 import { TRANSFER_DATA } from '@/constant'
 import fView from './editFile/fView.vue'
-import fileTraining from './fileTraining/index.vue'
 import { SYSTEM_URL, BASE_API } from '@/api/baseUrl'
 
 export default {
@@ -71,8 +63,7 @@ export default {
         IbpsFileAttachmentSelector,
         IbpsUploaderSelectorDialog,
         FilePreview,
-        fView,
-        fileTraining
+        fView
     },
     inject: {
         elForm: {
@@ -169,12 +160,6 @@ export default {
         }
     },
     data () {
-        let fileReadonly = true
-        let fileDownload = false
-        if (this.operation_status !== 'fileTraining') {
-            fileReadonly = this.readonly
-            fileDownload = this.download
-        }
         return {
             selectorVisible: false,
             selectorValue: this.multiple ? [] : {},
@@ -188,10 +173,7 @@ export default {
             showFile: false,
             file: '',
             optionFile: {},
-            optionFileView: {},
-            fileReadonly,
-            fileDownload,
-            fileTrainingDialog: false
+            optionFileView: {}
         }
     },
     computed: {
@@ -530,46 +512,28 @@ export default {
              * 处理预览
              */
         handlePreview (index) {
-            const data = this.selectorValue[index]
-            if (this.operation_status !== 'fileTraining') {
-                this.attachment = this.multiple ? this.selectorValue[index] : this.selectorValue
-                if (supportFileTypes.includes(this.attachment.ext)) {
-                    this.getPreview(index)
-                    this.filePreviewVisible = true
-                } else {
-                    this.$message.closeAll()
-                    this.$message.warning('暂不支持该文件类型预览')
-                }
-            } else {
-                // 打开培训文件用的弹框
+            this.attachment = this.multiple ? this.selectorValue[index] : this.selectorValue
+            if (supportFileTypes.includes(this.attachment.ext)) {
                 this.getPreview(index)
-                this.fileTrainingDialog = true
+            } else {
+                this.$message.closeAll()
+                this.$message.warning('暂不支持该文件类型预览')
             }
         },
         /**
              * 处理预览
              */
         getPreview (index) {
-            if (this.operation_status !== 'fileTraining') {
-                // 1、获取文件数据 及下载流接口
+            // 1、获取文件数据 及下载流接口
             // 下载地址
-                this.optionFileView.url = BASE_API() + SYSTEM_URL() + '/file/download?attachmentId=' + this.attachment.id
-                // 回调接口url
-                this.optionFileView.editUrl = BASE_API() + SYSTEM_URL() + '/file/editCallback?fileName=' + this.attachment.fileName + '&fileType=' + this.attachment.ext
-                this.optionFileView.title = this.attachment.fileName // 文件名称
-                this.optionFileView.fileType = this.attachment.ext // 类型
-                this.optionFileView.data = this.attachment // 记录编制的位置,需要替换。
-                this.optionFileView.data.index = index
-            } else {
-                const data = this.selectorValue[index]
-                // 1、获取文件数据 及下载流接口
-                this.optionFile.url = BASE_API() + SYSTEM_URL() + '/file/download?attachmentId=' + data.id
-                this.optionFile.editUrl = BASE_API() + SYSTEM_URL() + '/file/editCallback?fileName=' + data.fileName + '&fileType=' + data.ext + '&type="fileTraining"&id=' + data.id
-                this.optionFile.title = data.fileName // 文件名称
-                this.optionFile.fileType = data.ext // 类型
-                this.optionFile.data = data // 记录编制的位置,需要替换。
-                this.optionFile.data.index = index
-            }
+            this.optionFileView.url = BASE_API() + SYSTEM_URL() + '/file/download?attachmentId=' + this.attachment.id
+            // 回调接口url
+            this.optionFileView.editUrl = BASE_API() + SYSTEM_URL() + '/file/editCallback?fileName=' + this.attachment.fileName + '&fileType=' + this.attachment.ext
+            this.optionFileView.title = this.attachment.fileName // 文件名称
+            this.optionFileView.fileType = this.attachment.ext // 类型
+            this.optionFileView.data = this.attachment // 记录编制的位置,需要替换。
+            this.optionFileView.data.index = index
+            this.filePreviewVisible = true
         },
         /**
              *  确定
@@ -645,10 +609,6 @@ export default {
                 this.$message.error(`上传图片的大小不能超过 ${this.size}M!`)
             }
             return isLimitSize && isType
-        },
-        closeFileTrainingDialog (v) {
-            this.fileTrainingDialog = false
-            this.$emit('change-data', 'fanKuiXinXi', JSON.stringify([v]))
         }
     }
 }