Ver a proveniência

完成创建文件副本功能

dev
kim131 há 4 anos
ascendente
cometimento
7b6e1ba64c
3 ficheiros alterados com 34 adições e 29 eliminações
  1. +13
    -7
      src/views/main_web/workspace/components/file-milestone.vue
  2. +4
    -9
      src/views/main_web/workspace/components/version-item.vue
  3. +17
    -13
      src/views/main_web/workspace/workspace.new.vue

+ 13
- 7
src/views/main_web/workspace/components/file-milestone.vue Ver ficheiro

@@ -50,6 +50,7 @@
<version-item
nowVersion
:file="fileNowVersion"
@makeCopy="onMakeCopy"
></version-item>
<!-- 分割线 -->
<div class="title">里程碑</div>
@@ -59,6 +60,7 @@
:key ="fileInfo.currentHash"
:file="fileInfo"
:fileId ="file.id"
@makeCopy="onMakeCopy"
>
</version-item>
</div>
@@ -103,6 +105,7 @@
:key ="fileInfo.currentHash"
:file="fileInfo"
:fileId ="file.id"
@makeCopy="onMakeCopy"
>
</version-item>
</div>
@@ -115,6 +118,7 @@

<script>
import VersionItem from './version-item.vue';
import { cloneDeep } from 'lodash';

export default {
components: {
@@ -136,7 +140,7 @@ export default {
},
watch: {
fileHistoryList(...args){
// console.log('fileHistoryList: ', this.fileHistoryList, args);
console.log('fileHistoryList: ', this.fileHistoryList, args);
this.getFileMilestoneList(this.fileHistoryList);
this.getFileNowVersion(this.fileHistoryList);
this.getFileOtherVersion();
@@ -156,6 +160,7 @@ export default {
// this.getFileMilestoneList(this.fileHistoryList);
// this.getFileNowVersion(this.fileHistoryList);
// this.getFileOtherVersion();
},
data() {
return {
@@ -187,6 +192,13 @@ export default {
};
},
methods: {
onMakeCopy(commitInfo){
console.log('asdasda:', commitInfo, this.fileMilestoneInfo, this.file);
const newFile = cloneDeep(this.file);
// newFile.archName = `${newFile.archName}-${}`
newFile.ipfsCid = commitInfo.currentHash;
this.$emit('makeCopy', newFile, commitInfo.version);
},
//点击某一版本
clickVersion(){
this.isFileNameShow = true;
@@ -280,12 +292,6 @@ export default {
refresh(){
}



},
};
</script>


+ 4
- 9
src/views/main_web/workspace/components/version-item.vue Ver ficheiro

@@ -69,7 +69,7 @@
</div>
</div>
<!-- 创建副本 -->
<div class="create_copy">
<div class="create_copy" @click="onMakeCopy" v-if="!nowVersion">
<div class="create_copy_content">
<img src="static/img/文件.svg" alt="">
<p>从该版本创建副本</p>
@@ -144,6 +144,9 @@ export default {
},

methods:{
onMakeCopy(){
this.$emit('makeCopy', this.file);
},
//选择某一版本
clickVersion(){
if(!this.nowVersion){
@@ -202,14 +205,6 @@ export default {
setMileStoneClick(val) {
this.$bus.$emit('setMileStoneClick', val, this.file);
}







},

computed: {


+ 17
- 13
src/views/main_web/workspace/workspace.new.vue Ver ficheiro

@@ -486,6 +486,7 @@
<file-milestone v-if="checkMilestoneShow"
:fileMilestoneInfo="fileMilestoneInfo"
@closeMilestonePain="closeMilestonePain"
@makeCopy="copyWorkFileBtnClick"
:fileHistoryList ="fileHistoryList"
:file = "currentFile"
>
@@ -1970,12 +1971,12 @@ export default {

if(isCooperationFile) { system.clientOpenFileWith(filePath); return; }
// 将文件状态设置为编辑中
const flagRes = await services.changeFileWorkStatus(fileId, 2);
if(flagRes.Code !== 0) return;
file.workStatus = 2;
file.modifyUserId = sessionStorage.userId;
// const flagRes = await services.changeFileWorkStatus(fileId, 2);
// if(flagRes.Code !== 0) return;
// file.workStatus = 2;
// file.modifyUserId = sessionStorage.userId;
system.clientOpenFileWith(filePath);
this.fetchFolderFiles();
// this.fetchFolderFiles();
},
/**
* 点击文件事件:直接打开文件
@@ -2101,16 +2102,20 @@ export default {
/**
* 点击了复制文件副本的按钮
*/
async copyWorkFileBtnClick(targetFile) {
const copyFile = {...targetFile};
async copyWorkFileBtnClick(targetFile, version) {
// console.log(targetFile, version);
const copyFile = cloneDeep(targetFile);
let nowNum = 1, tempName = "";
if(version) {
copyFile.archName = `${copyFile.archName}-版本${version}`;
}

//先添加 - 副本字样 再判断是否重复 如果重复就修改版本信息
tempName = targetFile.archName + '-副本';
tempName = copyFile.archName + '-副本';
let isExists = this.workFileList.find(file => file.archName === tempName);
while(isExists) {
// - 副本存在 -》修改为 -副本(x) 的字样
tempName = targetFile.archName + `-副本(${ ++ nowNum})`;
tempName = copyFile.archName + `-副本(${ ++ nowNum})`;
isExists = this.workFileList.find(file => file.archName === tempName);
}
let hour = '0' + new Date().getHours();
@@ -2125,9 +2130,8 @@ export default {
copyFile.modifyTime = new Date();
copyFile.createUserId = sessionStorage.userId;
copyFile.createTime = new Date();
// console.log(copyFile);

const addFileRes = await services.addFile(copyFile);
copyFile.historyCurrentIpfsCid = '';
await services.addFile(copyFile);
this.fetchFolderFiles();
},
deleteFileClick(fileId, createUserId, archName, ipfscid) {
@@ -2168,7 +2172,7 @@ export default {
this.checkMilestoneShow = true;
const localWorkspacePrefix = this.localWorkspacePrefix;
const fileStoreKey = getFileStoreKey(file, this.currentNodeFolder);
if(!this.localFileHashMap[fileStoreKey]) return;
if(!this.localFileHashMap[fileStoreKey]) return;
const filePath = `${localWorkspacePrefix}\\${fileStoreKey}`;
this.fileMilestoneInfo.path = filePath;
const res = await services.queryProjArchiveHistory(file.id);


Carregando…
Cancelar
Guardar