@@ -17,6 +17,7 @@ | |||
:nodeFolder="currentNodeFolder" | |||
:currentFolder="currentFolder" | |||
@commitFile="showCommitWindow" | |||
@change-file-status="toggleFileShareStatus" | |||
@dblclickFile="fileClick(file)" | |||
@filePreview="filePreview" | |||
@openFileWith="openFileWith(file)" | |||
@@ -125,6 +126,7 @@ | |||
:nodeFolder="currentNodeFolder" | |||
:currentFolder="currentFolder" | |||
@commitFile="showCommitWindow" | |||
@change-file-status="toggleFileShareStatus" | |||
@dblclickFile="fileClick(file)" | |||
@filePreview="filePreview" | |||
@openFileWith="openFileWith(file)" | |||
@@ -446,6 +448,7 @@ import AddFileButton from '../add-file-button'; | |||
import * as services from '../../service'; | |||
import { FileWorkStatus, getFileStoreKey, injectionFileLocalStatus, LoadingEnum, VirtualFolder, analyzeRelativePath, imgExtensionList, RecExtensionList, VideoExtensionList, office, filePreviewList } from '../../helper'; | |||
import { propertyOf, uniqBy, throttle, flatten, debounce, cloneDeep } from 'lodash'; | |||
import { wrapErrorHint } from '@/utils/request'; | |||
const $ = window.jQuery; | |||
const Velocity = window.Velocity; | |||
@@ -1822,6 +1825,15 @@ export default { | |||
this.commitJudgeFile = file; | |||
this.fileImgClass = fileImgClass; | |||
}, | |||
async toggleFileShareStatus(file) { | |||
const nextStatus = file.status == 2 ? 1 : 2; | |||
const hintKeyword = nextStatus === 2 ? '开启': '关闭'; | |||
const res = await this.$fetchApi('file/changeFileStatus', { fileId: file.id, status: nextStatus }); | |||
wrapErrorHint(res); | |||
if(res.Code) { return } | |||
notify.success(`文件已${hintKeyword}协同`); | |||
file.status = nextStatus; | |||
}, | |||
/** | |||
* 提交本地文件 fileImgClass: 获得文件图标的类型 string | |||
* remarkNote: 要提交的备注信息 string | |||
@@ -83,12 +83,12 @@ | |||
<!-- 灰色感叹号 协作文件无灰色钩--> | |||
<div | |||
class="yijianxietong have-modified-icon" | |||
v-if="isInWorkFolder && isFileModified" | |||
v-if="isInWorkFolder && !fileEnableShare" | |||
> | |||
<i | |||
class="icon font_family icon-icon_status_wenjianbiaojiwancheng yijianIcon" | |||
title="文件已经被修改 点击进行文件提交" | |||
@click.stop="commitFile" | |||
title="点击开启文件协同" | |||
@click.stop="toggleFileShareStatus" | |||
/> | |||
</div> | |||
<!-- 蓝色更新图标 只有协作文件有更新图标--> | |||
@@ -104,13 +104,14 @@ | |||
</div> | |||
<!-- 绿色钩 协作文件无绿色钩--> | |||
<div | |||
v-if="isInWorkFolder && localFileIsLatest" | |||
v-if="isInWorkFolder && fileEnableShare" | |||
class="yijianxietong isonselect" | |||
> | |||
<i | |||
class="icon font_family icon-icon_status_wenjianbiaojiwancheng yijianIcon" | |||
title="已是最新版本" | |||
></i> | |||
title="点击关闭文件协同" | |||
@click.stop="toggleFileShareStatus" | |||
/> | |||
</div> | |||
</template> | |||
</template> | |||
@@ -352,12 +353,19 @@ export default { | |||
return localIpfsCid && status == "1"; | |||
}, | |||
//文件是否没有被修改也不需要更新 -》 显示绿色图标 | |||
localFileIsLatest() { | |||
const { ipfsCid } = this.file; | |||
const localIpfsCid = this.localIpfsCid; | |||
// 这里的localIpfsCid是包含标记0 1 的 0:本地未修改 1本地修改 | |||
const [myLocalIpfsCid, status] = localIpfsCid.split(";"); | |||
return localIpfsCid && myLocalIpfsCid === ipfsCid && status == "0"; | |||
// localFileIsLatest() { | |||
// const { ipfsCid } = this.file; | |||
// const localIpfsCid = this.localIpfsCid; | |||
// // 这里的localIpfsCid是包含标记0 1 的 0:本地未修改 1本地修改 | |||
// const [myLocalIpfsCid, status] = localIpfsCid.split(";"); | |||
// return localIpfsCid && myLocalIpfsCid === ipfsCid && status == "0"; | |||
// }, | |||
/** | |||
* 文件已启用协同 | |||
* status --- 1: 未协同 2: 已协同 | |||
*/ | |||
fileEnableShare() { | |||
return this.file.status == '2'; | |||
}, | |||
fileIsDifferent() { | |||
const { ipfsCid } = this.file; | |||
@@ -381,8 +389,11 @@ export default { | |||
// } | |||
}, | |||
methods: { | |||
commitFile() { | |||
this.$emit('commitFile', this.file, this.fileImgClass); | |||
// commitFile() { | |||
// this.$emit('commitFile', this.file, this.fileImgClass); | |||
// }, | |||
toggleFileShareStatus() { | |||
this.$emit('change-file-status', this.file); | |||
}, | |||
oneOf, | |||
// 打开方式 | |||