修改文档管理上传刷新文件展示问题

This commit is contained in:
龙运模 2024-07-30 20:06:13 +08:00
parent aa794aceef
commit 2e88cddefd

View File

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