浏览代码

优化上传组件展示数据速度

huangguoce 3 周之前
父节点
当前提交
7aa7b355fc
共有 1 个文件被更改,包括 11 次插入15 次删除
  1. 11 15
      src/views/common/NewDigitalInvoiceUploadComponentTest.vue

+ 11 - 15
src/views/common/NewDigitalInvoiceUploadComponentTest.vue

@@ -380,21 +380,17 @@ export default {
 				this.uniqueId = uniqueId
 			}
 			this.oldDataList = []
-			for await (let item of fileList) {
-				if (item.remarks == uniqueId) {
-					// await this.ossService.getFileSizeByUrl(item.url).then((data) => {
-					// 	item.lsUrl = data.url
-					// 	item.size = data.size
-					this.invoiceNoSet.add(item.number);
-					this.dataList.push(item)
-					this.oldDataList.push(item)
-					this.dataListNew.push(item)
-					if (this.dataListNew.length === fileList.length) {
-						this.fileLoading = true
-					}
-					// })
-				}
-			}
+
+			const filtered = fileList.filter(item => item.remarks === uniqueId)
+
+			filtered.forEach(item => {
+				this.invoiceNoSet.add(item.number)
+			})
+
+			this.dataList = filtered
+			this.oldDataList = [...filtered]
+			this.dataListNew = [...filtered]
+			this.fileLoading = true
 			// this.dataList = JSON.parse(JSON.stringify(fileList))
 			// this.dataListNew = JSON.parse(JSON.stringify(fileList))
 			if (this.commonJS.isEmpty(showDivider)) {