Browse Source

refactor(converter.vue):只有转档成功的文件才能重复上传

liyangbin 2 years ago
parent
commit
9f1b706ae4
1 changed files with 26 additions and 22 deletions
  1. 26 22
      pages/converter.vue

+ 26 - 22
pages/converter.vue

@@ -514,27 +514,31 @@ export default {
                 this.uniqFileArr.push(array[i]);
             }
             // this.fileList,this.uniqFileArr数组去重
-            // {let newArr= [];
-            // let arrName = [];
-            // // let arrStatus = []
-            // for(var item of this.fileList){
-            //   // if(arrName.indexOf(item['name']) == -1 || arrStatus.indexOf(item['status']) == -1){
-            //   if(arrName.indexOf(item['name']) == -1){
-            //     arrName.push(item['name']);
-            //     // arrStatus.push(item['status'])
-            //     newArr.push(item);
-            //   }
-            // }
-            // this.fileList=newArr
-            // newArr=[]
-            // arrName=[]
-            // for(var item of this.uniqFileArr){
-            //   if(arrName.indexOf(item['name']) == -1 ){
-            //     arrName.push(item['name']);
-            //     newArr.push(item);
-            //   }
-            // }
-            // this.uniqFileArr=newArr}         
+            let newArr= [];
+            let arrName = [];
+            let arrStatus = []
+            for(var item of this.fileList){
+              if(arrName.indexOf(item['name']) == -1 || arrStatus.indexOf(item['status']) == -1){
+              // if(arrName.indexOf(item['name']) == -1){
+                arrName.push(item['name']);
+                arrStatus.push(item['status'])
+                newArr.push(item);
+              }else if(item['status'] === 6){
+                newArr.push(item);
+              }
+            }
+            this.fileList=newArr
+            newArr=[]
+            arrName=[]
+            arrStatus = []
+            for(var item of this.uniqFileArr){
+              if(arrName.indexOf(item['name']) == -1 || arrStatus.indexOf(item['status']) == -1){
+                arrName.push(item['name']);
+                arrStatus.push(item['status'])
+                newArr.push(item);
+              }
+            }
+            this.uniqFileArr=newArr           
             if(event.target){
               event.target.value=''
             }
@@ -783,7 +787,7 @@ export default {
                                     this.$set(item, "path", getFileList[i].path);
                                     // 对相同文件名与相同转换后文件进行去重
                                     this.changeSucesssFileList.forEach((iten,index)=>{
-                                      if(iten.name.indexOf(item.name) !== -1 && iten.output.indexOf(item.output) !== -1){
+                                      if(iten.id.indexOf(item.id) !== -1){
                                         this.changeSucesssFileList.splice(index,1)                                      
                                       }
                                     })