bug修改

This commit is contained in:
caoyang
2022-03-08 19:02:25 +08:00
parent 5835dad49a
commit 9b613993e8
5 changed files with 93 additions and 75 deletions
+7 -3
View File
@@ -271,9 +271,8 @@
},
methods: {
sumber() {
console.log('vilidate',this.formInline)
// console.log('vilidate',this.formInline)
this.$refs.ruleForm1.validate(valid => {
console.log('va',valid)
if (valid) {
let url = ''
if (this.formInline.id) {
@@ -310,7 +309,12 @@
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
console.log('form',this.formInline)
// console.log('form',this.formInline)
}else{
this.formInline[this.uploadName]=''
this.formInline = { ...this.formInline }
// console.log('form',this.formInline)
}
},
handleInput(value) {
+68 -65
View File
@@ -7,7 +7,7 @@
class="ant-upload-list"
name="file"
:file-list="myfileList"
:multiple="true"
:multiple="false"
:action = 'uploadAction'
:headers="headers"
:before-upload="beforeUpload"
@@ -47,19 +47,23 @@
// console.log(this.thisFileType,this.thisFileSize,this.thisFileUploadUrl);
},
methods:{
beforeUpload(file) {
// console.log(file)
// let thisFileType = this.thisFileType.replace(/\s+/g, "");
if(file.type==this.accept){
this.fileTypeSatus = true;
this.$message.destroy()
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
this.errorMessage = file.name + "文件大小超出100MB限制, 请压缩或降低文件质量!";
beforeUpload(file,fileList) {
if(this.myfileList&&this.myfileList.length>=1){
this.$message.warning('只能上传一个文件')
return false
}else{
// let thisFileType = this.thisFileType.replace(/\s+/g, "");
if(file.type==this.accept){
this.fileTypeSatus = true;
this.$message.destroy()
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
this.errorMessage = file.name + "文件大小超出100MB限制, 请压缩或降低文件质量!";
}
}
},
remove(){
this.fileTypeSatus = true;
// console.log('rrr',this.myfileList)
},
handleChange(info) {
// console.log('info',info)
@@ -71,38 +75,18 @@
info.fileList.splice(index,1)
}
})
if (this.fileTypeSatus) {
if (file.size > 100000000) {
this.$message.error(this.errorMessage)
return
}else {
if (status === 'error') {
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.error(`${info.file.name} 文件上传失败。`);
} else if (status === 'removed') {
this.myfileList = info.fileList;
this.fileList = []
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
} else {
this.fileList.push(res)
}
})
this.$emit('uploadSuccess', this.fileList)
if(this.myfileList.length > 0){
if (this.fileTypeSatus) {
if (file.size > 100000000) {
this.$message.error(this.errorMessage)
return
}else {
if (status === 'error') {
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.success(`${info.file.name} 删除成功。`);
}
} else if (status === 'done') {
this.fileList = []
this.myfileList = info.fileList;
// console.log('file3333',info.fileList)
if (info.fileList.length > 20) {
info.fileList.splice(20)
// this.myfileList = info.fileList;
this.$message.error(`${info.file.name} 文件上传失败。`);
} else if (status === 'removed') {
this.myfileList = info.fileList;
this.fileList = []
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
@@ -110,36 +94,55 @@
this.fileList.push(res)
}
})
// console.log('file1111',this.fileList)
// console.log('remove',this.fileList)
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.error('最多只能上传二十个');
return
}
// console.log('my222',this.myfileList)
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
// console.log('flist',res.response)
} else {
this.fileList.push(res)
}
})
this.$message.success(`${info.file.name} 删除成功。`);
} else if (status === 'done') {
this.fileList = []
this.myfileList = info.fileList;
// console.log('file3333',info.fileList)
if (info.fileList.length > 1) {
info.fileList.splice(1)
// this.myfileList = info.fileList;
if(this.myfileList.length > 0){
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.success(`${info.file.name} 文件上传成功。`);
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
} else {
this.fileList.push(res)
}
})
// console.log('file1111',this.fileList)
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.error('最多只能上传一个文件');
return
}
// console.log('my222',this.myfileList)
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
// console.log('flist',res.response)
} else {
this.fileList.push(res)
}
})
if(this.myfileList.length > 0){
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.success(`${info.file.name} 文件上传成功。`);
}
} else if (status === 'uploading') {
this.myfileList = info.fileList;
this.$emit('uploadSuccess')
// this.$message.success(`${info.file.name} 文件上传成功。`);
}
} else if (status === 'uploading') {
this.myfileList = info.fileList;
this.$emit('uploadSuccess')
// this.$message.success(`${info.file.name} 文件上传成功。`);
}
}else{
this.$message.warning('不支持上传该类型的文件!')
}
}else{
this.$message.warning('不支持上传该类型的文件!')
}
},
}
}