Bläddra i källkod

workspace update

master
unknown 4 år sedan
förälder
incheckning
c6a022dd0b
4 ändrade filer med 119 tillägg och 101 borttagningar
  1. +3
    -3
      src/services/system.js
  2. +1
    -1
      src/views/main_web/workspace/components/add-file-button.vue
  3. +97
    -91
      src/views/main_web/workspace/components/file-item.vue
  4. +18
    -6
      src/views/main_web/workspace/workspace.new.vue

+ 3
- 3
src/services/system.js Visa fil

@@ -147,8 +147,8 @@ const system = {
// 项目id
ProjId: projectId,
// ShowUrl: "string",
// Status: 0,
// Version: 0,
Status: 2,
Version: 1,
// WorkStatus: 0
};

@@ -210,7 +210,7 @@ const system = {

const res = await fetchApi('file/updateFile', copyFile);
wrapErrorHint(res);
if(res.Code === 0) { notify.success(`${archName} 更新成功`); }
// if(res.Code === 0) { notify.success(`${archName} 更新成功`); }
onSuccessHandler(copyFile);
return;
} catch(err) {


+ 1
- 1
src/views/main_web/workspace/components/add-file-button.vue Visa fil

@@ -23,7 +23,7 @@
<div class="dragareaBox">
<div
class="dragarea_top uploadBtn"
@click="clientUpload"
@click="clientUpload(), isShowNewFiledialog = false"
>
<img src="static\img\upload.png" alt class="uploadBtnImg" />
<span class="uploadText">点击上传本地文件</span>


+ 97
- 91
src/views/main_web/workspace/components/file-item.vue Visa fil

@@ -13,7 +13,7 @@
v-if="!oneOf(file.extension, imgExtensionList)"
class="defultImage-mid"
:class="`${file.extension}-mid ${
isClient && file.downloadStatus !== DownloadStatus.DOWNLOADED ? 'toumin' : ''
isClient && !localFileIsLatest ? 'toumin' : ''
}`"
@contextmenu.prevent.stop="rightShowMenu($event, file, 1)"
/>
@@ -22,7 +22,7 @@
v-else
class="defultImage-mid img_bg-mid"
:class="
isClient && file.downloadStatus !== DownloadStatus.DOWNLOADED ? 'toumin' : ''
isClient && !localFileIsLatest ? 'toumin' : ''
"
@contextmenu.prevent.stop="rightShowMenu($event, file, 1)"
>
@@ -34,106 +34,91 @@
<!-- 标签 -->
<div
class="eidtTip"
v-if="isWorking && file.modifyUserId !== currentUserId"
v-if="isInWorkFolder && isWorking && file.modifyUserId !== currentUserId"
>
工作中
</div>

<div
@contextmenu.prevent.stop="
rightShowMenu($event, file, 1)
"
class="downloadIcon"
@click="clientDownLoad(file, 1)"
v-if="isClient && file.downloadStatus === DownloadStatus.UNDOWNLOAD && file.workStatus !== FileWorkStatus.WORKING
"
>
<div class="readytodownload-icon"><img src="/static/img/download.svg" alt class="imgjuzhong" /></div>
</div>

<!-- 如果不在工作中 且上一次的修改者不是自己说明文件已经被更新 本地需要下载 -->
<div
@contextmenu.prevent.stop="
rightShowMenu($event, file, 1)
"
class="downloadIcon"
@click="clientDownLoad(file, 1)"
v-if="isClient && file.workStatus !== FileWorkStatus.WORKING && file.modifyUserId !== currentUserId
"
>
<div class="readytodownload-icon"><img src="/static/img/download.svg" alt class="imgjuzhong" /></div>
</div>
<div
class="downloadIcon"
v-if="
isClient &&
file.downloadStatus === DownloadStatus.DOWNLOADING
"
>
<div class="progress-circle">
<img class="bg-pic" src="/static/img/download.svg" alt="">
<el-progress :width="45" :height="45"
type="circle" :show-text="false"
:percentage="file.loadProgress" :stroke-width="3" color="rgb(140, 0, 255)">
</el-progress>
</div>
</div>

<div
@contextmenu.prevent.stop="rightShowMenu($event, file, 1)"
class="downloadIcon"
v-if="isClient && file.downloadStatus === DownloadStatus.UPLOADING"
>
<div class="progress-circle">
<img class="bg-pic" src="/static/img/upload.png" alt="" :style="{ width: '24px' }" >
<el-progress :width="45" :height="45"
type="circle" :show-text="false"
:percentage="file.loadProgress" :stroke-width="3" color="rgb(140, 0, 255)">
</el-progress>
</div>
<!-- <span class="spanjuzhong">
<i class="el-icon-loading largeicon"></i>
<div class="minifont">上传中 {{file.loadProgress}}</div>
</span> -->
</div>

<!-- 左上角图标 -->
<template v-if="isClient && file.localIpfsCid">
<!-- 灰色感叹号 -->
<template v-if="isClient">
<!-- 如果不在工作中 且上一次的修改者不是自己说明文件已经被更新 本地需要下载 -->
<!-- 待下载 状态蒙板 -->
<div
class="yijianxietong modified-icon-parent"
v-if="isInWorkFolder && (isWorking || (file.modifyUserId === userId && file.localIpfsCid !== file.ipfsCid))"
@contextmenu.prevent.stop="rightShowMenu($event, file, 1)"
class="downloadIcon"
@click="clientDownLoad(file, 1)"
v-if="(!isInWorkFolder || !otherUserIsWorking) && !localFileIsLatest"
>
<img src="/static/img/警示.svg" alt
class="have-modified-icon"
title="文件已经被修改 点击进行文件更新"
@click="updateFileWorkStatus(file, 1, '文件已更新', 1)"
/>
<div class="readytodownload-icon"><img src="/static/img/download.svg" alt class="imgjuzhong" /></div>
</div>
<!-- 蓝色更新图标 协同文件列表中当本地文件和云端文件不同时 出现 -->
<!-- 下载中 状态蒙板 -->
<div
v-if="
!isInWorkFolder && file.downloadStatus === DownloadStatus.DIFF
"
class="yijianxietong isonselect_update"
class="downloadIcon"
v-if="file.downloadStatus === DownloadStatus.DOWNLOADING"
>
<i
class="icon font_family icon-icon_status_wenjianbiaojigengxin yijianIcon"
title="当前文件不是最新的文件"
@click="clientDownLoad(file, 1)"
/>
<div class="progress-circle">
<LottieSvg class="bg-pic" :width="40" :height="40" path="static/img/lottie.download.svg.json" />
<el-progress :width="45" :height="45"
type="circle" :show-text="false"
:percentage="file.loadProgress" :stroke-width="3" color="rgb(140, 0, 255)">
</el-progress>
</div>
</div>
<!-- 绿色钩 -->
<!-- 上传中 状态蒙板 todo: 调整样式-->
<div
v-if="isInWorkFolder && file.workStatus === FileWorkStatus.NOT_WORKING"
class="yijianxietong isonselect"
@contextmenu.prevent.stop="rightShowMenu($event, file, 1)"
class="downloadIcon"
v-if="isClient && file.downloadStatus === DownloadStatus.UPLOADING"
>
<i
class="icon font_family icon-icon_status_wenjianbiaojiwancheng yijianIcon"
title="已是最新版本"
></i>
<div class="progress-circle">
<img class="bg-pic" src="/static/img/upload.png" alt="" :style="{ width: '24px' }" >
<el-progress :width="45" :height="45"
type="circle" :show-text="false"
:percentage="file.loadProgress" :stroke-width="3" color="rgb(140, 0, 255)">
</el-progress>
</div>
<!-- <span class="spanjuzhong">
<i class="el-icon-loading largeicon"></i>
<div class="minifont">上传中 {{file.loadProgress}}</div>
</span> -->
</div>

<!-- 左上角图标 -->
<template v-if="fileInLocal">
<!-- 灰色感叹号 -->
<div
class="yijianxietong modified-icon-parent"
v-if="isInWorkFolder && file.modifyUserId === currentUserId && isWorking"
>
<img src="/static/img/警示.svg" alt
class="have-modified-icon"
title="文件已经被修改 点击进行文件更新"
@click="updateFileWorkStatus(file, 1, '文件已更新', 1)"
/>
</div>
<!-- 蓝色更新图标 协同文件列表中当本地文件和云端文件不同时 出现 -->
<div
v-if="
!isInWorkFolder && file.downloadStatus === DownloadStatus.DIFF
"
class="yijianxietong isonselect_update"
>
<i
class="icon font_family icon-icon_status_wenjianbiaojigengxin yijianIcon"
title="当前文件不是最新的文件"
@click="clientDownLoad(file, 1)"
/>
</div>
<!-- 绿色钩 -->
<div
v-if="isInWorkFolder && file.workStatus === FileWorkStatus.NOT_WORKING"
class="yijianxietong isonselect"
>
<i
class="icon font_family icon-icon_status_wenjianbiaojiwancheng yijianIcon"
title="已是最新版本"
></i>
</div>
</template>
</template>

<!-- 右上设置按钮 -->
@@ -165,7 +150,7 @@
>{{ file.archName }}</strong>

<span
v-if="file.createUserId != currentUserId"
v-if="isInWorkFolder && file.createUserId != currentUserId"
class="yiyunwenjian_infodesc"
>{{ file.createUserName }} 创建</span>
@@ -178,6 +163,7 @@
版本
{{ file.version }}
</span>
<span v-if="!isInWorkFolder" class="yiyunwenjian_infodesc">{{file.nodeName}}</span>
</div>
</div>
</el-tooltip>
@@ -186,12 +172,16 @@

<script>
import system from "@/services/system";
import LottieSvg from '@/components/lottieSvg';
import { FileWorkStatus, DownloadStatus } from '../helper';

const imgExtensionList = ["jpg", "png", "bmp", "gif", "jpeg"];
const oneOf = (target, list) => list.indexOf(target) !== -1

export default {
components: {
LottieSvg
},
props: {
file: {
type: Object,
@@ -228,8 +218,24 @@ export default {
return file.folderId === currentFolder.id;
},
isWorking() {
console.log(this.file, this.file.archName);
return this.file.workStatus === FileWorkStatus.WORKING;
},
fileIsDifferent() {
const { localIpfsCid, ipfsCid } = this.file;
return localIpfsCid && localIpfsCid !== ipfsCid;
},
localFileIsLatest() {
const { localIpfsCid, ipfsCid } = this.file;
return localIpfsCid && localIpfsCid === ipfsCid;
},
// 本地是否有文件
fileInLocal() {
return !!this.file.localIpfsCid;
},
// 其他人员正在修改
otherUserIsWorking() {
const { modifyUserId, workStatus } = this.file;
return workStatus === FileWorkStatus.WORKING && modifyUserId !== this.currentUserId;
}
},
methods: {


+ 18
- 6
src/views/main_web/workspace/workspace.new.vue Visa fil

@@ -540,7 +540,7 @@ export default {
const userId = this.userId;
const projId = this.projectId;
const workList = await services.fetchWorkFlow(projId, userId);
const folderList = workList.filter(folder => folder.nodeId !== folder.templateId);
const folderList = workList.filter(folder => folder.nodeId !== folder.templateId && folder.folderName !== '公共文件夹');

this.nodeFolders = folderList;
this.folderMap = folderList.reduce((h, f) => (h[f.id] = f, h), {});
@@ -578,6 +578,7 @@ export default {
this.fileLocalStateMap,
this.folderMap,
);
this.resolveUploadFileList(this.workFileList);
this.workSubFolderList = folderResInfo.folder;
this.cooperationFileList = injectionFileLocalStatus(
folderResInfo.coordinationFiles,
@@ -644,22 +645,31 @@ export default {
// 重置面包屑导航数组
this.breadcrumbFolderList = this.breadcrumbFolderList.slice(0, breadFolderIdx + 1);
},
/**
* 去掉上传队列中已经上传成功的文件
*/
resolveUploadFileList(fileList) {
this.uploadFileList = this.uploadFileList.filter(uploadFile => {
const targetFile = fileList.find(iFile => iFile.archName === uploadFile.archName && iFile.extension === uploadFile.extension);
return !targetFile;
});
},
/**
* 客户端上传文件
*/
clientUpload() {
if(!this.isClient) return;
this.isShowNewFiledialog = false;
const { folderName, levelId, id: folderId } = this.currentFolder;
// console.log(folderName, levelId, folderId);
system.uploadFile(
this.projectId, this.projectName, folderId, folderName, levelId, this.workFileList,
(file) => { // onSuccess
const {ArchName, IpfsCid} = file;
const {ArchName, IpfsCid, Extension} = file;
// 注入到文件下载检测表中
const key = `${folderName}\\${ArchName}`;
const key = `${folderName}\\${ArchName}${Extension ? `.${Extension}`: ''}`;
this.fileDownloadStatusHash[key] = IpfsCid;
this.refreshFileStatus();
this.fetchFolderFiles();
},
(progressData, uploadFile) => { // onLoading
const { process, hash } = progressData;
@@ -818,8 +828,8 @@ export default {
fileClick: async function (file) {
if(!this.isClient) return;
if(!fileIsDownloaded(file)) return;
const { archName, extension, id: fileId } = file;
const { folderName } = this.currentFolder;
const { archName, extension, id: fileId, nodeName } = file;
const folderName = nodeName || this.currentFolder.folderName;
const localWorkspacePrefix = this.localWorkspacePrefix;
const filePath = `${localWorkspacePrefix}\\${folderName}\\${archName}${extension ? `.${extension}` : ''}`;
@@ -828,6 +838,8 @@ export default {
return;
}
system.openFile(filePath);
// 若文件在协作文件中,则不更改状态
if(nodeName) { return; }
// 将文件状态设置为编辑中
const flagRes = await services.changeFileWorkStatus(fileId, 2);
if(flagRes.Code !== 0) return;


Laddar…
Avbryt
Spara