Parcourir la source

增加文件本地状态检测

master
unknown il y a 4 ans
Parent
révision
1d1629e247
1 fichiers modifiés avec 28 ajouts et 2 suppressions
  1. +28
    -2
      src/views/main_web/workspace/workspace.vue

+ 28
- 2
src/views/main_web/workspace/workspace.vue Voir le fichier

@@ -2928,6 +2928,7 @@ export default {
//
socketIns: null, // 监听文件变化的socket实例
projectName: sessionStorage.projName,
fileDownloadStatusHash: {},
};
},
created: function () {
@@ -2992,12 +2993,35 @@ export default {
* }
*/
const hash = JSON.parse(data);

this.fileDownloadStatusHash = hash;
this.refreshFileStatus();
}catch(e) {
console.log('socket file change message error:', e);
}
// console.log('socket file change message detected:', args);
},
refreshFileStatus(){
const ctx = this;
const fileStatusHash = this.fileDownloadStatusHash;
const { folderName, levelId, id: folderId } = this.nowFolder;
const commonFolderName = '公共文件夹';
['myFilesList'].forEach((key) => {
const list = ctx[key];
let ifModify = false;
if(!list || !list.length) return;
list.forEach(file => {
const { archName, extension } = file;
const fileKey = `${folderName}\\${archName}${extension ? `.${extension}`:''}`;
if(fileStatusHash[fileKey] && !file.isDownload) {
file.isDownload = true;
ifModify = true;
}
});
if(ifModify) {
ctx[key] = ctx[key].concat([]);
}
});
},
removeMilestone(filesList){
return filesList.filter(file=>{
return file.milestone != 2;
@@ -3847,6 +3871,7 @@ export default {
this.loadListCommonFiles(data, userId);
}
}
this.refreshFileStatus();
// debugger;
// if (currentFolder.folderName == "公共文件夹") {
// this.fileindex = 2;
@@ -4422,6 +4447,7 @@ export default {
var folderName = this.listUserFolders[this.nowFolderIndex].folderName;
var projID = file.projID;
var type = "open";
debugger;
system.openFile(
archid,
filename,
@@ -6655,7 +6681,7 @@ export default {
this.myListFolderGroups = this.folderFileList.listOtherFolderGroups;
this.folderGroupBreads =null;
}
this.refreshFileStatus();
// this.timer = setInterval(() => {
// this.intoFoldergroup(foldergroup);
// }, 3 * 1000);


Chargement…
Annuler
Enregistrer