|
@@ -160,6 +160,7 @@ export default {
|
|
|
* showDivider=false时 ‘附件‘Divider隐藏
|
|
|
*/
|
|
|
async newUpload(auth, fileList, directory, maxValue, dividerName, uploadFlag, delFlag, showDivider) {
|
|
|
+ console.log(fileList);
|
|
|
|
|
|
await this.fileLoadingFalse()
|
|
|
if (this.commonJS.isEmpty(fileList)) {
|
|
@@ -202,18 +203,25 @@ export default {
|
|
|
this.delFlag = delFlag
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
for await (let item of fileList) {
|
|
|
- await this.ossService.getFileSizeByUrl(item.url).then((data) => {
|
|
|
- item.lsUrl = data.url
|
|
|
- item.size = data.size
|
|
|
+ if (item.url && item.url !== null && item.url !== undefined && item.url !== "") {
|
|
|
+ await this.ossService.getFileSizeByUrl(item.url).then((data) => {
|
|
|
+ item.lsUrl = data.url
|
|
|
+ item.size = data.size
|
|
|
+ this.dataList.push(item)
|
|
|
+ this.dataListNew.push(item)
|
|
|
+ this.fileList.push(item)
|
|
|
+ if (this.dataListNew.length === fileList.length) {
|
|
|
+ this.fileLoading = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
this.dataList.push(item)
|
|
|
this.dataListNew.push(item)
|
|
|
this.fileList.push(item)
|
|
|
- console.log(item);
|
|
|
- if (this.dataListNew.length === fileList.length) {
|
|
|
- this.fileLoading = true
|
|
|
- }
|
|
|
- })
|
|
|
+ this.fileLoading = true
|
|
|
+ }
|
|
|
}
|
|
|
// this.dataList = JSON.parse(JSON.stringify(fileList))
|
|
|
// this.dataListNew = JSON.parse(JSON.stringify(fileList))
|
|
@@ -262,6 +270,8 @@ export default {
|
|
|
flag = true
|
|
|
}
|
|
|
})
|
|
|
+ console.log(this.fileList);
|
|
|
+
|
|
|
if (flag) {
|
|
|
this.$message.error(`${row.fileName}已存在,无法重复上传`);
|
|
|
return
|
|
@@ -331,10 +341,9 @@ export default {
|
|
|
})
|
|
|
|
|
|
if (fileListNamesList.indexOf(file.name) != -1) {
|
|
|
- console.log(this.fileList);
|
|
|
+ console.log(fileListNamesList);
|
|
|
|
|
|
this.$message.error(`${file.name}已存在,无法重复上传`)
|
|
|
-
|
|
|
return
|
|
|
} else {
|
|
|
|
|
@@ -420,12 +429,14 @@ export default {
|
|
|
this.$refs.upload.clearFiles()
|
|
|
this.dataList = []
|
|
|
this.dataListNew = []
|
|
|
+ this.fileList = []
|
|
|
this.createBy = ''
|
|
|
},
|
|
|
/**
|
|
|
* 获取当前文件列表中的文件数据
|
|
|
*/
|
|
|
getDataList() {
|
|
|
+
|
|
|
return this.dataListNew
|
|
|
},
|
|
|
/**
|
|
@@ -444,6 +455,13 @@ export default {
|
|
|
}
|
|
|
return true
|
|
|
}
|
|
|
+
|
|
|
+ const invalidFile = this.dataListNew.find(file => !file.url); // 找到第一个 URL 为空的文件
|
|
|
+ if (invalidFile) {
|
|
|
+ this.$message.warning(`${invalidFile.name}的URL为空,请检查后重新上传`)
|
|
|
+ return true; // 只要有一个 url 为空,直接 return
|
|
|
+ }
|
|
|
+
|
|
|
return false
|
|
|
},
|
|
|
ifName(row) {
|