|
@@ -10,8 +10,8 @@
|
|
|
:multiple="multiple"
|
|
:multiple="multiple"
|
|
|
:limit="limit"
|
|
:limit="limit"
|
|
|
:disabled="disabled"
|
|
:disabled="disabled"
|
|
|
- :readonly="readonly"
|
|
|
|
|
- :download="download"
|
|
|
|
|
|
|
+ :readonly="fileReadonly"
|
|
|
|
|
+ :download="fileDownload"
|
|
|
:operation_status="operation_status"
|
|
:operation_status="operation_status"
|
|
|
:preview="preview"
|
|
:preview="preview"
|
|
|
:upload-type="uploadType"
|
|
:upload-type="uploadType"
|
|
@@ -44,6 +44,13 @@
|
|
|
<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>
|
|
@@ -56,6 +63,7 @@ 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 {
|
|
@@ -63,7 +71,8 @@ export default {
|
|
|
IbpsFileAttachmentSelector,
|
|
IbpsFileAttachmentSelector,
|
|
|
IbpsUploaderSelectorDialog,
|
|
IbpsUploaderSelectorDialog,
|
|
|
FilePreview,
|
|
FilePreview,
|
|
|
- fView
|
|
|
|
|
|
|
+ fView,
|
|
|
|
|
+ fileTraining
|
|
|
},
|
|
},
|
|
|
inject: {
|
|
inject: {
|
|
|
elForm: {
|
|
elForm: {
|
|
@@ -160,6 +169,12 @@ 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 ? [] : {},
|
|
@@ -173,7 +188,10 @@ export default {
|
|
|
showFile: false,
|
|
showFile: false,
|
|
|
file: '',
|
|
file: '',
|
|
|
optionFile: {},
|
|
optionFile: {},
|
|
|
- optionFileView: {}
|
|
|
|
|
|
|
+ optionFileView: {},
|
|
|
|
|
+ fileReadonly,
|
|
|
|
|
+ fileDownload,
|
|
|
|
|
+ fileTrainingDialog: false
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -512,28 +530,46 @@ export default {
|
|
|
* 处理预览
|
|
* 处理预览
|
|
|
*/
|
|
*/
|
|
|
handlePreview (index) {
|
|
handlePreview (index) {
|
|
|
- this.attachment = this.multiple ? this.selectorValue[index] : this.selectorValue
|
|
|
|
|
- if (supportFileTypes.includes(this.attachment.ext)) {
|
|
|
|
|
- this.getPreview(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 {
|
|
} else {
|
|
|
- this.$message.closeAll()
|
|
|
|
|
- this.$message.warning('暂不支持该文件类型预览')
|
|
|
|
|
|
|
+ // 打开培训文件用的弹框
|
|
|
|
|
+ this.getPreview(index)
|
|
|
|
|
+ this.fileTrainingDialog = true
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 处理预览
|
|
* 处理预览
|
|
|
*/
|
|
*/
|
|
|
getPreview (index) {
|
|
getPreview (index) {
|
|
|
- // 1、获取文件数据 及下载流接口
|
|
|
|
|
|
|
+ if (this.operation_status !== 'fileTraining') {
|
|
|
|
|
+ // 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
|
|
|
|
|
- this.filePreviewVisible = true
|
|
|
|
|
|
|
+ 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
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 确定
|
|
* 确定
|
|
@@ -609,6 +645,10 @@ 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]))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|