文件名重复问题修复

czks-cmt-gwj地图合并
liujun 2024-02-27 11:03:55 +08:00
parent 1cd73243f6
commit a9c0eb45d7
1 changed files with 11 additions and 0 deletions

View File

@ -66,6 +66,17 @@ export default {
this.$refs.uploadFile.clearFiles() this.$refs.uploadFile.clearFiles()
return false return false
} }
let nameNumber = 0
for (let j = 0; j < fileList.length; j++) {
if (fileList[j].name === file.name) {
nameNumber = nameNumber + 1
}
}
if (nameNumber > 1) {
this.$message.error('文件名重复,请重新选择!')
this.$refs.uploadFile.handleRemove(file)
return false
}
this.$emit('update:fileList', fileList) this.$emit('update:fileList', fileList)
}, },
onRemove(file, fileList) { onRemove(file, fileList) {