diff --git a/src/views/docsManager/uploadFile.vue b/src/views/docsManager/uploadFile.vue index b360c22..0c5f73a 100644 --- a/src/views/docsManager/uploadFile.vue +++ b/src/views/docsManager/uploadFile.vue @@ -94,11 +94,7 @@ export default { }, watch:{ - visible(val){ - if(!val){ - this.$TOOL.data.set('docsList', this.listProgress); - } - } + }, mounted() { eventBus.$on('sockBack', this.getWsResult); @@ -110,24 +106,22 @@ export default { getWsResult(res){ if(res.data && (res.data.type == 12)){ this.progressShow = true; - - if(this.listProgress.length == 0){ - const docsList = this.$TOOL.data.get('docsList'); - this.listProgress = docsList; + if(this.listProgress.length==0){ + this.listProgress.push(res.data); + } + let ids = this.listProgress.map(em=>em.file_unique_id); + if(!ids.includes(res.data.file_unique_id)){ + this.listProgress.push(res.data); } this.listProgress.forEach(em=>{ - if(em.uuid == res.data.file_unique_id){ + if(em.file_unique_id == res.data.file_unique_id){ em.rate = res.data.rate - // if(res.data.status == 1){ - // this.listProgress.splice(index,1); - // } } }) let list = this.listProgress.filter(em=> em.rate != 100); if(list.length==0 && res.data.status == 1){ this.progressShow = false; - this.$TOOL.data.set('docsList', []); } if(res.data.status == 1){ this.fileList.splice(this.fileList[0],1); @@ -183,7 +177,6 @@ export default { if (res.code == 200) { this.$message.success('提交成功,正在上传'); this.uploadShow = false; - this.listProgress = res.data.files; } }, handleExceed(){ @@ -192,7 +185,7 @@ export default { handleRemove(file,fileList,isArr=false){ if(isArr){ fileList = []; - this.listProgress = []; + // this.listProgress = []; }else{ const index = fileList.findIndex(f => f.uid === file.uid); if (index !== -1) {