Explorar el Código

修复多附图时下载报错问题

cfort hace 1 año
padre
commit
8d63d349aa
Se han modificado 1 ficheros con 8 adiciones y 2 borrados
  1. 8 2
      src/business/platform/file/image/index.vue

+ 8 - 2
src/business/platform/file/image/index.vue

@@ -304,6 +304,10 @@ export default {
             this.cacheData[v[this.valueKey]] = v
         },
         setRealFileList (v) {
+            if (this.realFileList.some(item => item[this.valueKey] === v)) {
+                // 已存在,不重复添加
+                return
+            }
             this.realFileList.push(this.cacheData[v])
         },
         /**
@@ -483,9 +487,11 @@ export default {
         },
         // 下载
         onDownloadImage (index) {
-            this.setRealFileList(this.fileList[index][this.valueKey])
+            const value = this.fileList[index][this.valueKey]
+            this.setRealFileList(value)
+            const file = this.realFileList.find(item => item.id === value)
             this.$nextTick(() => {
-                downloadFile(this.realFileList[index])
+                downloadFile(file)
             })
         },
         // 图片上传数量限制