fix: 修复文件上传失败的BUG

This commit is contained in:
zyd
2022-08-28 21:01:40 +08:00
parent 8499983b6d
commit 54383da570
+33 -21
View File
@@ -366,27 +366,39 @@ export default {
obj.name = file.response.data.oldFileName obj.name = file.response.data.oldFileName
obj.response.data = file.response.data obj.response.data = file.response.data
this.showFileList.push(obj) this.showFileList.push(obj)
// this.value += res.data.id + ',' let attrIds=""
this.$emit('input', this.value ? (this.value + ','+ res.data.id + ',').replaceAll(",,",',') : (this.value+ res.data.id + ',').replaceAll(',,',',')) if(this.value != null && this.value !== ''){
this.$emit('success') let attrArray= this.value.split(',')
this.$message({ // 方法二:filter方法 [推荐写法]
message: '文件上传成功', let attrIdsArray = attrArray.filter((s) => {
type: 'success' return s && s.trim(); // 注:IE9(不包含IE9)以下的版本没有trim()方法
}) });
switch (this.config.attrField) { attrIdsArray.push(res.data.id);
case 'recordsAttr': console.log(attrIdsArray)
this.$emit('recordsAttrTime', res.data.uploadTime) attrIds = attrIdsArray.join(',')+","
break }else{
case 'signAttr': attrIds =res.data.id+","
this.$emit('signAttrTime', res.data.uploadTime) }
break this.$emit('input', attrIds)
case 'otherAttr': this.$emit('success')
this.$emit('otherAttrTime', res.data.uploadTime) this.$message({
break message: '文件上传成功',
} type: 'success'
// 国内外标准法规返回文件上传成功状态 })
this.$emit('fileSuccess', true) switch (this.config.attrField) {
// this.importModalshowflagtemp = false case 'recordsAttr':
this.$emit('recordsAttrTime', res.data.uploadTime)
break
case 'signAttr':
this.$emit('signAttrTime', res.data.uploadTime)
break
case 'otherAttr':
this.$emit('otherAttrTime', res.data.uploadTime)
break
}
// 国内外标准法规返回文件上传成功状态
this.$emit('fileSuccess', true)
// this.importModalshowflagtemp = false
} else { } else {
this.$message({ this.$message({
message: res.message, message: res.message,