|
@@ -563,6 +563,20 @@ |
|
|
<div class="minifont">下载中 {{file.loadProgress}}</div> |
|
|
<div class="minifont">下载中 {{file.loadProgress}}</div> |
|
|
</span> |
|
|
</span> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div |
|
|
|
|
|
@contextmenu.prevent.stop=" |
|
|
|
|
|
rightShowMenu($event, file, 1) |
|
|
|
|
|
" |
|
|
|
|
|
class="downloadIcon" |
|
|
|
|
|
v-if=" |
|
|
|
|
|
isClient && file.downloadStatus === 3 |
|
|
|
|
|
" |
|
|
|
|
|
> |
|
|
|
|
|
<span class="spanjuzhong"> |
|
|
|
|
|
<i class="el-icon-loading largeicon"></i> |
|
|
|
|
|
<div class="minifont">上传中 {{file.loadProgress}}</div> |
|
|
|
|
|
</span> |
|
|
|
|
|
</div> |
|
|
<div |
|
|
<div |
|
|
v-if="file.status == 1" |
|
|
v-if="file.status == 1" |
|
|
class="yijianxietong isonselect_defual" |
|
|
class="yijianxietong isonselect_defual" |
|
@@ -2616,9 +2630,20 @@ const DownloadStatus = { |
|
|
*/ |
|
|
*/ |
|
|
DOWNLOADING: 1, |
|
|
DOWNLOADING: 1, |
|
|
/** |
|
|
/** |
|
|
* 已下载 |
|
|
|
|
|
|
|
|
* 已下载/已上传 |
|
|
*/ |
|
|
*/ |
|
|
DOWNLOADED: 2 |
|
|
|
|
|
|
|
|
DOWNLOADED: 2, |
|
|
|
|
|
/** |
|
|
|
|
|
* 上传中 |
|
|
|
|
|
*/ |
|
|
|
|
|
UPLOADING: 3, |
|
|
|
|
|
} |
|
|
|
|
|
/** |
|
|
|
|
|
* 文件工作状态 |
|
|
|
|
|
*/ |
|
|
|
|
|
const FileWorkStatus = { |
|
|
|
|
|
NOT_WORKING: 1, |
|
|
|
|
|
WORKING: 2, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const fileIsDownloaded = file => file.downloadStatus === DownloadStatus.DOWNLOADED; |
|
|
const fileIsDownloaded = file => file.downloadStatus === DownloadStatus.DOWNLOADED; |
|
@@ -2862,7 +2887,7 @@ export default { |
|
|
localWorkspacePrefix: '', // 本地工作目录前缀 |
|
|
localWorkspacePrefix: '', // 本地工作目录前缀 |
|
|
socketIns: null, // 监听文件变化的socket实例 |
|
|
socketIns: null, // 监听文件变化的socket实例 |
|
|
projectName: sessionStorage.projName, |
|
|
projectName: sessionStorage.projName, |
|
|
fileDownloadStatusHash: {}, |
|
|
|
|
|
|
|
|
fileDownloadStatusHash: {}, // 文件上传/下载状态存储 |
|
|
folderMap: {}, // 文件夹id哈希: { [folderId]: folder } |
|
|
folderMap: {}, // 文件夹id哈希: { [folderId]: folder } |
|
|
fileLocalStateMap: {}, // 本地网关文件通信数据缓存: { [fileId]: { } } |
|
|
fileLocalStateMap: {}, // 本地网关文件通信数据缓存: { [fileId]: { } } |
|
|
}; |
|
|
}; |
|
@@ -2969,7 +2994,7 @@ export default { |
|
|
file.downloadStatus = DownloadStatus.DOWNLOADED; |
|
|
file.downloadStatus = DownloadStatus.DOWNLOADED; |
|
|
ifModify = true; |
|
|
ifModify = true; |
|
|
} |
|
|
} |
|
|
if(stateMap[file.id] && file.downloadStatus !== DownloadStatus.DOWNLOADED) { |
|
|
|
|
|
|
|
|
if(stateMap[file.id]) { |
|
|
Object.assign(file, stateMap[file.id]); |
|
|
Object.assign(file, stateMap[file.id]); |
|
|
ifModify = true; |
|
|
ifModify = true; |
|
|
} |
|
|
} |
|
@@ -3303,27 +3328,50 @@ export default { |
|
|
// console.log(error); |
|
|
// console.log(error); |
|
|
// }); |
|
|
// }); |
|
|
// }, |
|
|
// }, |
|
|
async updateFileWorkStatus(file, workStatus, message) { |
|
|
|
|
|
// const params = { |
|
|
|
|
|
// FolderId: file.folderId, |
|
|
|
|
|
// FileId: file.id, |
|
|
|
|
|
// UserId: this.userId, |
|
|
|
|
|
// FileStatus: file.status |
|
|
|
|
|
// } |
|
|
|
|
|
// file.loadingProgress = 0; |
|
|
|
|
|
|
|
|
|
|
|
const [resFlag] = await Promise.all([ |
|
|
|
|
|
services.changeFileWorkStatus(file.id, workStatus), |
|
|
|
|
|
// services.fileCoordinationChange(params) |
|
|
|
|
|
]); |
|
|
|
|
|
if(resFlag.Code !== 0) return; |
|
|
|
|
|
notify.success(message); |
|
|
|
|
|
file.workStatus = workStatus; |
|
|
|
|
|
this.$forceUpdate(); |
|
|
|
|
|
|
|
|
async updateFileWorkStatus(file, nextWorkStatus, message) { |
|
|
|
|
|
if(!this.isClient || nextWorkStatus === FileWorkStatus.WORKING && file.workStatus === FileWorkStatus.NOT_WORKING) { |
|
|
|
|
|
const [resFlag] = await services.changeFileWorkStatus(file.id, nextWorkStatus); |
|
|
|
|
|
if(resFlag.Code !== 0) return; |
|
|
|
|
|
notify.success(message); |
|
|
|
|
|
this.$forceUpdate(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
// 仅当文件从工作中变成非工作状态时执行下面的代码 |
|
|
// todo 获取文件最新的hash并更新文件 |
|
|
// todo 获取文件最新的hash并更新文件 |
|
|
// if(workStatus === 1 && file.workStatus === 2) { |
|
|
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
const { folderName, levelId, id: folderId } = this.nowFolder; |
|
|
|
|
|
const { archName, extension, id: fileId } = file; |
|
|
|
|
|
const stateMap = this.fileLocalStateMap; |
|
|
|
|
|
const updateState = { |
|
|
|
|
|
loadProgress: 0, |
|
|
|
|
|
downloadStatus: DownloadStatus.UPLOADING, |
|
|
|
|
|
isDownload: true, |
|
|
|
|
|
}; |
|
|
|
|
|
stateMap[fileId] = updateState; |
|
|
|
|
|
this.refreshFileStatus(); |
|
|
|
|
|
// const fileList = this.currentPageType === 0 ? this.folderFileList.listMyFiles : this.folderFileList.listOtherFiles; |
|
|
|
|
|
const fileKey = `${folderName}\\${archName}${extension ? `.${extension}`:''}`; |
|
|
|
|
|
system.updateFile( |
|
|
|
|
|
file, this.localWorkspacePrefix, |
|
|
|
|
|
this.projectName, folderName, |
|
|
|
|
|
async (fileNewState) => { |
|
|
|
|
|
const [resFlag] = await services.changeFileWorkStatus(file.id, nextWorkStatus); |
|
|
|
|
|
notify.success(message); |
|
|
|
|
|
const {IpfsCid} = fileNewState; |
|
|
|
|
|
// 注入到文件下载检测表中 |
|
|
|
|
|
this.fileDownloadStatusHash[fileKey] = IpfsCid; |
|
|
|
|
|
this.refreshFileStatus(); |
|
|
|
|
|
}, |
|
|
|
|
|
(progressData) => { |
|
|
|
|
|
const { process, hash } = progressData; |
|
|
|
|
|
const updateState = { |
|
|
|
|
|
loadProgress: process, |
|
|
|
|
|
downloadStatus: process === 100 ? DownloadStatus.DOWNLOADED : DownloadStatus.UPLOADING, |
|
|
|
|
|
isDownload: true, |
|
|
|
|
|
}; |
|
|
|
|
|
stateMap[fileId] = updateState; |
|
|
|
|
|
this.refreshFileStatus(); |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
}, |
|
|
}, |
|
|
/** |
|
|
/** |
|
|
* 更改文件状态 |
|
|
* 更改文件状态 |
|
@@ -4755,7 +4803,7 @@ export default { |
|
|
const { folderName, levelId, id: folderId } = nowFolder; |
|
|
const { folderName, levelId, id: folderId } = nowFolder; |
|
|
// console.log(folderName, levelId, folderId); |
|
|
// console.log(folderName, levelId, folderId); |
|
|
system.uploadFile( |
|
|
system.uploadFile( |
|
|
sessionStorage.projId,sessionStorage.projName, folderId, folderName, levelId, this.myFilesList, |
|
|
|
|
|
|
|
|
sessionStorage.projId, sessionStorage.projName, folderId, folderName, levelId, this.myFilesList, |
|
|
(file) => { |
|
|
(file) => { |
|
|
const {ArchName, IpfsCid} = file; |
|
|
const {ArchName, IpfsCid} = file; |
|
|
// 注入到文件下载检测表中 |
|
|
// 注入到文件下载检测表中 |
|
|