|
|
|
@ -46,14 +46,14 @@
|
|
|
|
|
:accept="uploadOption.accept"
|
|
|
|
|
:on-preview="handlePreview"
|
|
|
|
|
:on-remove="handleRemove"
|
|
|
|
|
:before-remove="beforeRemove"
|
|
|
|
|
:before-upload="beforeUpload"
|
|
|
|
|
:on-success="handleSuccess"
|
|
|
|
|
multiple
|
|
|
|
|
:on-exceed="handleExceed"
|
|
|
|
|
:file-list="fileList"
|
|
|
|
|
>
|
|
|
|
|
<el-button size="small" type="primary" icon="el-icon-upload2">选择文件</el-button>
|
|
|
|
|
<div slot="tip" class="el-upload__tip">支持扩展名:docx、bmp、jpg、png,单个文档小于5mb</div>
|
|
|
|
|
<div slot="tip" class="el-upload__tip">支持扩展名:docx、doc,单个文档小于5mb</div>
|
|
|
|
|
</el-upload>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
@ -65,6 +65,7 @@
|
|
|
|
|
import { baseURL } from '@/config/net.config'
|
|
|
|
|
import { saveEvidence, updateEvidence } from '@/api/caseDetails'
|
|
|
|
|
import { getAccessToken } from '@/utils/accessToken'
|
|
|
|
|
import { commonDownloadFile } from '@/api/config/uploadApi'
|
|
|
|
|
export default {
|
|
|
|
|
name: 'EditEvidence',
|
|
|
|
|
data() {
|
|
|
|
@ -91,7 +92,7 @@ export default {
|
|
|
|
|
// 上传配置
|
|
|
|
|
uploadOption: {
|
|
|
|
|
action: `${baseURL}/minio/uploadFile`,
|
|
|
|
|
accept: '.docx,.bmp,.jpg,.png'
|
|
|
|
|
accept: '.docx,.doc'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
isEdit: false
|
|
|
|
@ -126,6 +127,20 @@ export default {
|
|
|
|
|
this.$refs.form.resetFields()
|
|
|
|
|
this.$refs.form.clearValidate()
|
|
|
|
|
},
|
|
|
|
|
// 文件列表
|
|
|
|
|
beforeUpload(file) {
|
|
|
|
|
const isLt5M = file.size / 1024 / 1024 < 5
|
|
|
|
|
const filename = file.name
|
|
|
|
|
const postfix = filename.substring(filename.lastIndexOf('.'))
|
|
|
|
|
if (!['.doc', '.docx'].includes(postfix)) {
|
|
|
|
|
this.$message.error('上传图片只能是 doc,docx 格式!')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (!isLt5M) {
|
|
|
|
|
this.$baseMessage.error('上传文件大小不能超过 5MB!')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 确定
|
|
|
|
|
handleSubmit() {
|
|
|
|
|
this.$refs.form.validate(valid => {
|
|
|
|
@ -162,14 +177,22 @@ export default {
|
|
|
|
|
this.evidenceForm.fileIdList = list
|
|
|
|
|
},
|
|
|
|
|
handlePreview(file) {
|
|
|
|
|
console.log(file)
|
|
|
|
|
for (const item of this.fileList) {
|
|
|
|
|
if (item.name === file.name) {
|
|
|
|
|
if (!item.fileId) return
|
|
|
|
|
this.downloadFile(`${baseURL}${commonDownloadFile}${item.fileId}`, item.name)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
downloadFile(url, fileName) {
|
|
|
|
|
const link = document.createElement('a')
|
|
|
|
|
link.href = url
|
|
|
|
|
link.download = fileName
|
|
|
|
|
link.click()
|
|
|
|
|
},
|
|
|
|
|
handleExceed(files, fileList) {
|
|
|
|
|
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
|
|
|
|
|
},
|
|
|
|
|
beforeRemove(file, fileList) {
|
|
|
|
|
return this.$confirm(`确定移除 ${file.name}?`)
|
|
|
|
|
},
|
|
|
|
|
handleSuccess(response) {
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
this.evidenceForm.fileIdList.push(response.data)
|
|
|
|
|