|
@@ -10,8 +10,8 @@
|
|
|
:multiple="multiple"
|
|
:multiple="multiple"
|
|
|
:limit="limit"
|
|
:limit="limit"
|
|
|
:disabled="disabled"
|
|
:disabled="disabled"
|
|
|
- :readonly="fileReadonly"
|
|
|
|
|
- :download="fileDownload"
|
|
|
|
|
|
|
+ :readonly="readonly"
|
|
|
|
|
+ :download="download"
|
|
|
:operation_status="operation_status"
|
|
:operation_status="operation_status"
|
|
|
:preview="preview"
|
|
:preview="preview"
|
|
|
:upload-type="uploadType"
|
|
:upload-type="uploadType"
|
|
@@ -44,13 +44,6 @@
|
|
|
<div v-if="showFile" class="divShow">
|
|
<div v-if="showFile" class="divShow">
|
|
|
<fView :option-file="optionFile" @updateFile="updateFile" />
|
|
<fView :option-file="optionFile" @updateFile="updateFile" />
|
|
|
</div>
|
|
</div>
|
|
|
- <div v-if="fileTrainingDialog">
|
|
|
|
|
- <fileTraining
|
|
|
|
|
- :visible="fileTrainingDialog"
|
|
|
|
|
- :option-file="optionFile"
|
|
|
|
|
- @close="closeFileTrainingDialog"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
@@ -63,7 +56,6 @@ import FilePreview from '@/business/platform/file/file-preview'
|
|
|
import { supportFileTypes } from '@/components/ibps-file-viewer/constants'
|
|
import { supportFileTypes } from '@/components/ibps-file-viewer/constants'
|
|
|
import { TRANSFER_DATA } from '@/constant'
|
|
import { TRANSFER_DATA } from '@/constant'
|
|
|
import fView from './editFile/fView.vue'
|
|
import fView from './editFile/fView.vue'
|
|
|
-import fileTraining from './fileTraining/index.vue'
|
|
|
|
|
import { SYSTEM_URL, BASE_API } from '@/api/baseUrl'
|
|
import { SYSTEM_URL, BASE_API } from '@/api/baseUrl'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -71,8 +63,7 @@ export default {
|
|
|
IbpsFileAttachmentSelector,
|
|
IbpsFileAttachmentSelector,
|
|
|
IbpsUploaderSelectorDialog,
|
|
IbpsUploaderSelectorDialog,
|
|
|
FilePreview,
|
|
FilePreview,
|
|
|
- fView,
|
|
|
|
|
- fileTraining
|
|
|
|
|
|
|
+ fView
|
|
|
},
|
|
},
|
|
|
inject: {
|
|
inject: {
|
|
|
elForm: {
|
|
elForm: {
|
|
@@ -169,12 +160,6 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
data () {
|
|
data () {
|
|
|
- let fileReadonly = true
|
|
|
|
|
- let fileDownload = false
|
|
|
|
|
- if (this.operation_status !== 'fileTraining') {
|
|
|
|
|
- fileReadonly = this.readonly
|
|
|
|
|
- fileDownload = this.download
|
|
|
|
|
- }
|
|
|
|
|
return {
|
|
return {
|
|
|
selectorVisible: false,
|
|
selectorVisible: false,
|
|
|
selectorValue: this.multiple ? [] : {},
|
|
selectorValue: this.multiple ? [] : {},
|
|
@@ -188,10 +173,7 @@ export default {
|
|
|
showFile: false,
|
|
showFile: false,
|
|
|
file: '',
|
|
file: '',
|
|
|
optionFile: {},
|
|
optionFile: {},
|
|
|
- optionFileView: {},
|
|
|
|
|
- fileReadonly,
|
|
|
|
|
- fileDownload,
|
|
|
|
|
- fileTrainingDialog: false
|
|
|
|
|
|
|
+ optionFileView: {}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -530,46 +512,28 @@ export default {
|
|
|
* 处理预览
|
|
* 处理预览
|
|
|
*/
|
|
*/
|
|
|
handlePreview (index) {
|
|
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.getPreview(index)
|
|
|
- this.fileTrainingDialog = true
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.closeAll()
|
|
|
|
|
+ this.$message.warning('暂不支持该文件类型预览')
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 处理预览
|
|
* 处理预览
|
|
|
*/
|
|
*/
|
|
|
getPreview (index) {
|
|
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!`)
|
|
this.$message.error(`上传图片的大小不能超过 ${this.size}M!`)
|
|
|
}
|
|
}
|
|
|
return isLimitSize && isType
|
|
return isLimitSize && isType
|
|
|
- },
|
|
|
|
|
- closeFileTrainingDialog (v) {
|
|
|
|
|
- this.fileTrainingDialog = false
|
|
|
|
|
- this.$emit('change-data', 'fanKuiXinXi', JSON.stringify([v]))
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|