|
|
@ -32,7 +32,15 @@ |
|
|
|
<el-button type="primary">上传图片<i class="el-icon-upload el-icon--right"></i></el-button> |
|
|
|
</el-upload> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="上传附件" label-width="118px" :class="{ 'form-item': source === 'visiual' }" |
|
|
|
> |
|
|
|
<el-upload :headers="$getElUploadHeaders()" class="avatar-uploader" :action="uploadUlr" |
|
|
|
accept=".doc,.pdf,.xls,.docx,.xlsx" |
|
|
|
:data="{ customerId: customerId }" :show-file-list="true" :on-success="handleDocSuccess" |
|
|
|
:on-remove="handleDocRemove" :before-upload="beforeDocUpload"> |
|
|
|
<el-button type="primary" >上传附件<i class="el-icon-upload el-icon--right"></i></el-button> |
|
|
|
</el-upload> |
|
|
|
</el-form-item> |
|
|
|
<el-divider></el-divider> |
|
|
|
<div class="flex"> |
|
|
|
<div class="item"> |
|
|
@ -158,7 +166,8 @@ export default { |
|
|
|
}, |
|
|
|
selectList: [{ label: '属实', value: 1 }, { label: '不属实', value: 0 }], |
|
|
|
imgList: [], |
|
|
|
audioList: [] |
|
|
|
audioList: [], |
|
|
|
docList:[] |
|
|
|
}; |
|
|
|
}, |
|
|
|
components: {}, |
|
|
@ -198,38 +207,10 @@ export default { |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
beforeImgUpload(file) { |
|
|
|
const isLt1M = file.size / 1024 / 1024 < 10; |
|
|
|
|
|
|
|
if (!isLt1M) { |
|
|
|
this.$message.error("上传文件大小不能超过 10MB!"); |
|
|
|
} |
|
|
|
return isLt1M; |
|
|
|
}, |
|
|
|
handleImgSuccess(res, file, fileList) { |
|
|
|
console.log("res.data.url", file); |
|
|
|
if (res.code === 0 && res.msg === "success") { |
|
|
|
console.log("res.data.url", res.data.url); |
|
|
|
this.imgList.push({ |
|
|
|
attachmentFormat: file.name.split(".").pop(), |
|
|
|
attachmentName: file.name, |
|
|
|
size: file.size, |
|
|
|
attachmentType: file.raw.type, |
|
|
|
attachmentUrl: res.data.url, |
|
|
|
}); |
|
|
|
console.log(this.imgList); |
|
|
|
} else { |
|
|
|
this.$message.error(res.msg); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
handleImgRemove(file) { |
|
|
|
let index = this.imgList.findIndex( |
|
|
|
(item) => item.url == file.response.data.url |
|
|
|
); |
|
|
|
this.imgList.splice(index, 1); |
|
|
|
console.log(this.imgList); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
beforeAudioUpload(file) { |
|
|
|
const isLt1M = file.size / 1024 / 1024 < 10; |
|
|
|
if (!isLt1M) { |
|
|
@ -269,7 +250,22 @@ export default { |
|
|
|
} |
|
|
|
return isLt1M; |
|
|
|
}, |
|
|
|
|
|
|
|
handleImgSuccess(res, file, fileList) { |
|
|
|
console.log("res.data.url", file); |
|
|
|
if (res.code === 0 && res.msg === "success") { |
|
|
|
console.log("res.data.url", res.data.url); |
|
|
|
this.imgList.push({ |
|
|
|
attachmentFormat: file.name.split(".").pop(), |
|
|
|
attachmentName: file.name, |
|
|
|
size: file.size, |
|
|
|
attachmentType: file.raw.type, |
|
|
|
attachmentUrl: res.data.url, |
|
|
|
}); |
|
|
|
console.log(this.imgList); |
|
|
|
} else { |
|
|
|
this.$message.error(res.msg); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
handleImgRemove(file) { |
|
|
|
let index = this.formData.files.findIndex( |
|
|
@ -278,6 +274,39 @@ export default { |
|
|
|
this.formData.files.splice(index, 1); |
|
|
|
console.log(this.formData.files); |
|
|
|
}, |
|
|
|
|
|
|
|
beforeDocUpload(file) { |
|
|
|
const isLt1M = file.size / 1024 / 1024 < 10; |
|
|
|
|
|
|
|
if (!isLt1M) { |
|
|
|
this.$message.error("上传文件大小不能超过 10MB!"); |
|
|
|
} |
|
|
|
return isLt1M; |
|
|
|
}, |
|
|
|
handleDocSuccess(res, file, fileList) { |
|
|
|
console.log("res.data.url", file); |
|
|
|
if (res.code === 0 && res.msg === "success") { |
|
|
|
console.log("res.data.url", res.data.url); |
|
|
|
this.docList.push({ |
|
|
|
attachmentFormat: file.name.split(".").pop(), |
|
|
|
attachmentName: file.name, |
|
|
|
size: file.size, |
|
|
|
attachmentType: file.raw.type, |
|
|
|
attachmentUrl: res.data.url, |
|
|
|
}); |
|
|
|
console.log(this.docList); |
|
|
|
} else { |
|
|
|
this.$message.error(res.msg); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
handleDocRemove(file) { |
|
|
|
let index = this.formData.files.findIndex( |
|
|
|
(item) => item.url == file.response.data.url |
|
|
|
); |
|
|
|
this.formData.files.splice(index, 1); |
|
|
|
console.log(this.formData.files); |
|
|
|
}, |
|
|
|
// 开启加载动画 |
|
|
|
startLoading() { |
|
|
|
loading = Loading.service({ |
|
|
|