From 30180489524d84a26ac602cf4ab8169aa0ab6233 Mon Sep 17 00:00:00 2001 From: kim131 <1035828775@qq.com> Date: Mon, 7 Dec 2020 16:18:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=8F=E4=BD=9C=E6=96=87=E4=BB=B6=E4=BB=A5?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E5=BD=A2=E5=BC=8F=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/css/main.css | 25 +- src/App.vue | 5 + .../workspace/components/folder-item.vue | 9 + .../workspace/components/workLine.vue | 22 +- .../main_web/workspace/workspace.new.vue | 296 ++++++++++++++++-- 5 files changed, 317 insertions(+), 40 deletions(-) diff --git a/public/static/css/main.css b/public/static/css/main.css index 45bc6029..af746f83 100644 --- a/public/static/css/main.css +++ b/public/static/css/main.css @@ -4368,8 +4368,10 @@ button:focus { } /* 协作文件超出部分滚动条 */ .fifleBox{ - min-height: 215px; - max-height: 215px; + min-height: 204px; + max-height: 204px; + /* min-height: 215px; + max-height: 215px; */ /* max-height: 255px; */ /* max-height: 275px; */ overflow-y: scroll; @@ -4379,8 +4381,8 @@ button:focus { background-color: #adadad; } .neibianju1 .fifleBox{ - height: calc(100vh - 210px); - max-height: calc(100vh - 210px); + height: calc(100vh - 236px); + max-height: calc(100vh - 236px); overflow-y: auto; } .yiyun_title_label{ @@ -4680,7 +4682,7 @@ button:focus { left: -30px; } .layerout_H2{ - height: calc(100vh - 364px); + height: calc(100vh - 368px); overflow-y: auto; transition: ease all 0.5s; background-color: #f6f6f6; @@ -5336,6 +5338,9 @@ div.textlabelgray .el-form-item__content{ position: relative; } /*边距*/ +.ml-8 { + margin-left: 8px; +} .mt-10{ margin-top: 10px; } @@ -5380,7 +5385,7 @@ div.textlabelgray .el-form-item__content{ } /* 滚动条 */ .flex_right_pain_body::-webkit-scrollbar ,.largecontentBox::-webkit-scrollbar,.scollbarBox::-webkit-scrollbar,.middiaHeight::-webkit-scrollbar, -.tankuangaodu::-webkit-scrollbar,.listfilewarp::-webkit-scrollbar,.jsmind-inner::-webkit-scrollbar,.newfiledialog::-webkit-scrollbar,.scollBar::-webkit-scrollbar,.fixtable::-webkit-scrollbar +.tankuangaodu::-webkit-scrollbar,.jsmind-inner::-webkit-scrollbar,.newfiledialog::-webkit-scrollbar,.scollBar::-webkit-scrollbar,.fixtable::-webkit-scrollbar ,.worklink::-webkit-scrollbar,#bigbody::-webkit-scrollbar,.fulldialog::-webkit-scrollbar,.appiframebox::-webkit-scrollbar,.appiframebox::-webkit-scrollbar,.listfilewarp1::-webkit-scrollbar{ width: 8px; height: 8px; @@ -5390,7 +5395,7 @@ div.textlabelgray .el-form-item__content{ height:8px; } .flex_right_pain_body::-webkit-scrollbar-track ,.largecontentBox::-webkit-scrollbar-track,.scollbarBox::-webkit-scrollbar-track,.middiaHeight::-webkit-scrollbar-track, -.tankuangaodu::-webkit-scrollbar-track,.listfilewarp::-webkit-scrollbar-track,.jsmind-inner::-webkit-scrollbar-track,.newfiledialog::-webkit-scrollbar-track,.scollBar::-webkit-scrollbar-track,.fixtable::-webkit-scrollbar-track +.tankuangaodu::-webkit-scrollbar-track,.jsmind-inner::-webkit-scrollbar-track,.newfiledialog::-webkit-scrollbar-track,.scollBar::-webkit-scrollbar-track,.fixtable::-webkit-scrollbar-track ,.worklink::-webkit-scrollbar-track,#bigbody::-webkit-scrollbar-track,.fulldialog::-webkit-scrollbar-track,.appiframebox::-webkit-scrollbar-track,.appiframebox::-webkit-scrollbar-track,.listfilewarp1::-webkit-scrollbar-track{ background-color:transparent; -webkit-border-radius: 2em; @@ -5398,7 +5403,7 @@ div.textlabelgray .el-form-item__content{ border-radius:2em; } .flex_right_pain_body::-webkit-scrollbar-thumb,.largecontentBox::-webkit-scrollbar-thumb,.scollbarBox::-webkit-scrollbar-thumb,.middiaHeight::-webkit-scrollbar-thumb, -.tankuangaodu::-webkit-scrollbar-thumb,.listfilewarp::-webkit-scrollbar-thumb,.jsmind-inner::-webkit-scrollbar-thumb,.newfiledialog::-webkit-scrollbar-thumb,.scollBar::-webkit-scrollbar-thumb,.fixtable::-webkit-scrollbar-thumb +.tankuangaodu::-webkit-scrollbar-thumb,.jsmind-inner::-webkit-scrollbar-thumb,.newfiledialog::-webkit-scrollbar-thumb,.scollBar::-webkit-scrollbar-thumb,.fixtable::-webkit-scrollbar-thumb ,.worklink::-webkit-scrollbar-thumb,#bigbody::-webkit-scrollbar-thumb,.fulldialog::-webkit-scrollbar-thumb,.appiframebox::-webkit-scrollbar-thumb,.appiframebox::-webkit-scrollbar-thumb,.listfilewarp1::-webkit-scrollbar-thumb{ background-color:#adadad; -webkit-border-radius: 2em; @@ -7386,8 +7391,8 @@ border-radius:2em; } .DevtopIcon{ position: absolute; - left: 0px; - top: 6px; + left: 30px; + top: 17px; } .orginoverflow{ overflow: inherit; diff --git a/src/App.vue b/src/App.vue index 0feaabbb..57ed4f62 100644 --- a/src/App.vue +++ b/src/App.vue @@ -30,6 +30,7 @@ --> @@ -161,4 +162,8 @@ jmnode { color: #333; } } + +.workspace-bigbody { + overflow: hidden !important; +} \ No newline at end of file diff --git a/src/views/main_web/workspace/components/folder-item.vue b/src/views/main_web/workspace/components/folder-item.vue index 41220fe0..c0b8cd88 100644 --- a/src/views/main_web/workspace/components/folder-item.vue +++ b/src/views/main_web/workspace/components/folder-item.vue @@ -41,6 +41,7 @@ :style="{ top: rightMenuTop + 'px', left: rightMenuLeft + 'px'}" > @@ -64,6 +65,10 @@ export default { type: Boolean, default: false, }, + isWorkFolder: { + type: Boolean, + default: true + } }, data(){ return { @@ -96,6 +101,10 @@ export default { e.preventDefault(); this.$emit('commitFolder', this.folder); }, + deleteFolderClick() { + this.$emit('deleteFolderClick', this.folder.id); + this.closeRightMenu(); + } }, watch: { rightMenuVisible(value) { diff --git a/src/views/main_web/workspace/components/workLine.vue b/src/views/main_web/workspace/components/workLine.vue index e7088965..141fd5ee 100644 --- a/src/views/main_web/workspace/components/workLine.vue +++ b/src/views/main_web/workspace/components/workLine.vue @@ -116,7 +116,7 @@ @click="showNewAppManagement(from)" > - {{from}} + {{from.nodeName }}
{{ - share + share.nodeName }}
@@ -337,7 +337,10 @@ export default { const data=await this.$fetchApi('folder/queryNodeFolderListByProjectId', { projectId: sessionStorage.projId }); var folderList=data.Data.folder; const temp=folderList.reduce((h,folder)=>{ - h[folder.NodeId]=folder.FolderName; + h[folder.NodeId] = {}; + h[folder.NodeId].nodeName = folder.FolderName; + h[folder.NodeId].nodeId = folder.Id; + //h[folder.NodeId]=folder.FolderName; return h; },{}); var templateId=this.listUserFolders[0].templateId; @@ -350,7 +353,7 @@ export default { this.getNestItem(nodeLists,nestNodeIdLists,parentNodeId); var headNode={nodeId:null,parentNodeId:templateId}; nestNodeIdLists.unshift(headNode); - + nestNodeIdLists.forEach(async node=>{ const Res=await queryFileExchange(templateId,node.parentNodeId,node.nodeId); this.listUserFolders.forEach(item=>{ @@ -364,6 +367,7 @@ export default { ) }) }) + }, @@ -389,6 +393,11 @@ export default { }, + }, + computed: { + nowFolderShareNodesLen() { + return this.listUserFolders[this.nowFolderIndex] ? this.listUserFolders[this.nowFolderIndex].listsShareFrom[1].length : 0; + } }, watch: { isShowlink(data) { @@ -398,7 +407,10 @@ export default { }, listUserFolders() { this.getFileExchange(); - } + }, + nowFolderShareNodesLen() { + this.$emit('finishGetExchangeNodes'); + }, }, }; diff --git a/src/views/main_web/workspace/workspace.new.vue b/src/views/main_web/workspace/workspace.new.vue index 710a35a3..3a2f1461 100644 --- a/src/views/main_web/workspace/workspace.new.vue +++ b/src/views/main_web/workspace/workspace.new.vue @@ -29,10 +29,12 @@ @showWorklinkPage="showWorklinkPage" @nowFolderClick="nowFolderClick" @hideWorklinkPage="hideWorklinkPage" + @finishGetExchangeNodes="finishGetExchangeNodes" />
@@ -44,14 +46,14 @@ class="section_item section_item_aside_fl" > - 工作文件 + 工作文件 {{breadFolder.folderName}} @@ -59,7 +61,7 @@
@@ -126,11 +129,26 @@
+ + + + +
- +
- +
-

+ +
+ + + 协作文件 + {{breadFolder.folderName}} + + +

@@ -166,12 +200,12 @@
-
+
+ +
+ +
+
+
+
+ +
@@ -337,6 +402,7 @@ export default { nodeFolders: [], // 节点文件夹 currentNodeFolder: {}, // 当前节点文件夹 currentFolder: {}, // 当前文件夹,可以是节点文件夹,可以是子文件夹 + currentFolderInCoop: {},//协作文件下当前的文件夹 /* 右键菜单 */ rightMenuvisible: false, rightMenuleft: 0, @@ -351,9 +417,13 @@ export default { subFolderMap: {}, // 子文件夹哈希: { [folderPath]: VirtualFolder } breadcrumbFolderList: [], // 面包屑导航对应的文件夹队列 + breadcrumbFolderListInCoop: [],//协作文件夹对应额面包屑导航 + uploadFileList: [], // 上传文件的队列 workFileList: [], // 工作文件队列 + workSubFolderList: [], // 工作文件夹队列 + coopSubFolderList: [],//协作文件夹队列 tempWorkSubFolderList: [], // 临时的工作文件夹队列 cooperationFileList: [], // 协作文件队列 @@ -382,6 +452,11 @@ export default { localFolderLoadStateMap: {}, tempRightFileId: "", // 存储点击了右键菜单的id + workFileScrollBar: null, + isShowStartNodeFolders: true,//协作文件是否显示一开始的节点文件夹 + isfinishGetExchangeNodes: false, + exchangeNodeListsInCoop: [],//存储与当前节点具有交换关系的节点列表 + reverseLocalFileHashMap: {},//键名是 ipfscid 键值是localFileHashMap的键名 }; }, mounted: function () { @@ -400,6 +475,10 @@ export default { errorEvent => { notify.error('本地网关通讯失败'); } ); this.intervalTask(); + + + this.workFileScrollBar = this.$refs.workfilescrollbar; + // this.workFileScrollBar && this.workFileScrollBar.addEventListener('scroll', this.workFilePartScrollListener); }, destroyed: function () { window.removeEventListener("scroll", this.onscroll); @@ -425,6 +504,116 @@ export default { } }, methods: { + // 工作文件区域滚动条监听 卷去的头部 scrollTop >= scrollHeight - clientHeight的时候 认为滑到了底部 + workFilePartScrollListener() { + const tempBar = this.workFileScrollBar; + if(tempBar && tempBar.scrollTop >= tempBar.scrollHeight - tempBar.clientHeight) { + console.log('滑到了底部'); + this.openCopage(); + } + }, + // 删除文件夹 递归删除文件夹下面的所有文件 + deleteFolderClick(id) { + const { subFolderList, workFileList, subFolderMap, userId, localFileHashMap, reverseLocalFileHashMap } = this; + const deleteFolderName = subFolderMap[id].folderName; + const thisApp = this; + const totalDeleteFileLists = []; + this.$confirm(`确认删除文件夹“${deleteFolderName}”吗?`, "", { + confirmButtonText: "确定", + cancelButtonText: "取消", + showClose: false, + type: "warning", + }).then(async function () { + circulateDelete(id); + const totalNum = totalDeleteFileLists.length; + console.log('要删除的文件总数是', totalNum); + let isFileInWorking = totalDeleteFileLists.find(f => f.workStatus == 2 && f.modifyUserId !== userId); + if(isFileInWorking) { + // 提示 该文件夹下有他人正在工作中的文件 -> 删除失败 + thisApp.$notify({ + title: " ", + message: `“${deleteFolderName}”文件夹下存在“工作中”文件,删除失败。`, + type: "error", + offset: 100, + duration: 2500, + }); + } else { + // 删除文件夹 + let counter = 0; + totalDeleteFileLists.forEach(async delFile => { + delete localFileHashMap[reverseLocalFileHashMap[delFile.ipfsCid]]; + const res = await services.deleteFile(delFile.id); + counter = res.Code == 0 ? counter+1 : counter; + if(counter == totalNum) { + thisApp.$notify({ + title: " ", + message: `“${deleteFolderName}”文件夹已删除。`, + type: "success", + offset: 100, + duration: 2500, + }); + } + thisApp.fetchFolderFiles(); + }) + } + }) + + function circulateDelete(deleteFolderId) { + const delFolderLists = subFolderList.filter(folder => folder.parentFolderPath == deleteFolderId); + if(delFolderLists.length == 0) { + //表明到了最底层的文件夹 删除deleteFolderId对应这个文件夹下面的所有文件 + let delFileLists = workFileList.filter(file => file.relativePath == deleteFolderId); + + // 删除与这个要删除文件夹同级的文件 + const parentFolderPath = subFolderMap[deleteFolderId].parentFolderPath + if(parentFolderPath !== "") { + const tempLists = workFileList.filter(wf => wf.relativePath == parentFolderPath); + delFileLists.push(...tempLists); + } + totalDeleteFileLists.push(...delFileLists); + } + delFolderLists.forEach(df => { + circulateDelete(df.id); + }) + } + + }, + // 当workLine组件获得节点的交换节点的时候 调用函数 + finishGetExchangeNodes() { + this.isfinishGetExchangeNodes = true; + this.getExchangeNodes(); + }, + // 协作文件一开始显示的文件夹要显示具有节点交换关系的文件夹 但是这个时候listShareFrom[1]还没有塞入值 + getExchangeNodes() { + const froms = this.currentNodeFolder.listsShareFrom[1]; + const tempMap = froms.map(f => f.nodeId); + this.exchangeNodeListsInCoop = this.nodeFolders.filter(folder => tempMap.includes(folder.id)); + }, + // 对协作文件的relativePath处理 生成文件夹 + dealWithCoopFiles(fileList) { + const folderList = []; + const folderMap = {}; + + fileList.forEach(file => { + const relativePath = file.relativePath; + if(relativePath) { + const paths = relativePath.split('/'); + paths.forEach((folderName, idx) => { + const fullRelativePath = paths.slice(0, idx + 1).join('/'); + if(folderMap[fullRelativePath]) return; + const folder = new VirtualFolder(fullRelativePath); + const parentRelativePath = folder.parentFolderPath; + folderList.push(folder); + folderMap[fullRelativePath] = folder; + if(folderMap[parentRelativePath]) { + folderMap[parentRelativePath].childCount++; + } + }); + folderMap[relativePath].fileCount++; + } + }); + this.coopSubFolderList = folderList; + }, // 接收到了一个文件的右键菜单点击事件 oneFileRightBtnClick(id) { this.tempRightFileId = id; @@ -433,16 +622,32 @@ export default { // 文件展示过滤 filterFiles(fileList) { // 子文件会有这个属性,节点文件夹不会有 - const { folderPath = '' } = this.currentFolder; + const { folderPath = '' } = this.currentFolder ; return fileList.filter(file => { if(file.relativePath !== folderPath) return false; return true; }); }, - // 文件展示过滤 + // 文件夹展示过滤 filterFolders(folderList) { // 子文件会有这个属性,节点文件夹不会有 - const { folderPath = '' } = this.currentFolder; + const { folderPath = '' } = this.currentFolder; + return folderList.filter(folder => { + if(folder.parentFolderPath !== folderPath) return false; + return true; + }); + }, + // 协作文件下的文件展示过滤 + filterFilesInCoop(fileList){ + const { folderPath = '' } = this.currentFolderInCoop; + return fileList.filter(file=> { + if(file.relativePath !== folderPath) return false; + return true; + }); + }, + // 协作文件下的文件夹展示过滤 + filterFoldersInCoop(folderList) { + const { folderPath = '' } = this.currentFolderInCoop; return folderList.filter(folder => { if(folder.parentFolderPath !== folderPath) return false; return true; @@ -604,6 +809,7 @@ export default { */ previousFolder () { this.goFolder(this.nowFolderIndex - 1); + this.isShowStartNodeFolders = true; }, /** * 查看下一个文件夹文件 @@ -629,15 +835,23 @@ export default { this.clearCurrentFolderFiles(); } this.currentFolder = this.currentNodeFolder; + this.currentFolderInCoop = this.currentNodeFolder; this.breadcrumbFolderList = []; + this.breadcrumbFolderListInCoop = []; this.fetchFolderFiles(); }, /** * 进入子文件夹 */ - intoSubFolder(folder) { - this.currentFolder = folder; - this.breadcrumbFolderList.push(folder); + intoSubFolder(folder, flag) { + if(flag == 0) { + this.currentFolder = folder; + this.breadcrumbFolderList.push(folder); + } else if(flag == 1) { + this.currentFolderInCoop = folder; + this.breadcrumbFolderListInCoop.push(folder); + } + // this.clearCurrentFolderFiles(); // this.fetchFolderFiles(); }, @@ -646,6 +860,7 @@ export default { */ nowFolderClick(nextFolderIndex) { this.goFolder(nextFolderIndex); + this.isShowStartNodeFolders = true;//上面切换点击到另一个工作节点的时候 协作文件先显示总的节点入口 }, /* 文件夹及文件API */ @@ -668,6 +883,7 @@ export default { this.currentNodeFolder = folderList[0]; } this.currentFolder = this.currentNodeFolder; + this.currentFolderInCoop = this.currentNodeFolder; this.fetchFolderFiles(); }, /** @@ -695,6 +911,7 @@ export default { // resolve dupilicate folders this.tempWorkSubFolderList = this.tempWorkSubFolderList.filter(tempFolder => !folderResInfo.folder.some(folder => folder.id === tempFolder.id)); this.cooperationFileList = folderResInfo.coordinationFiles; + this.dealWithCoopFiles(this.cooperationFileList); this.resolveUploadFileList(this.cooperationFileList); }, 1000), /** @@ -749,14 +966,28 @@ export default { /** * 面包屑导航点击 */ - clickBreadcrumb(breadFolderIdx) { - const targetFolder = breadFolderIdx === -1 + clickBreadcrumb(breadFolderIdx, flag) { + if(flag == 0) { + // 工作文件 + const targetFolder = breadFolderIdx === -1 ? this.currentNodeFolder : this.breadcrumbFolderList[breadFolderIdx]; - this.currentFolder = targetFolder; - this.fetchFolderFiles(); - // 重置面包屑导航数组 - this.breadcrumbFolderList = this.breadcrumbFolderList.slice(0, breadFolderIdx + 1); + this.currentFolder = targetFolder; + this.fetchFolderFiles(); + // 重置面包屑导航数组 + this.breadcrumbFolderList = this.breadcrumbFolderList.slice(0, breadFolderIdx + 1); + } else if(flag == 1) { + // 协作文件 + const targetFolder = breadFolderIdx === -1 + ? this.currentNodeFolder + : this.breadcrumbFolderListInCoop[breadFolderIdx]; + this.currentFolderInCoop = targetFolder; + this.isShowStartNodeFolders = breadFolderIdx === -1; + // this.fetchFolderFiles(); + // 重置面包屑导航数组 + this.breadcrumbFolderListInCoop = this.breadcrumbFolderListInCoop.slice(0, breadFolderIdx + 1); + } + }, /** * 客户端选择文件列表并上传 @@ -810,7 +1041,7 @@ export default { * } */ async clientUpload(filePaths) { // uploadTask - + console.log('filePaths'); const tasksGroup = await Promise.all(filePaths.map(path => system.analyzeSystemPath(path))); const uploadTasks = flatten(tasksGroup); const { folderName, levelId, id: folderId } = this.currentNodeFolder; @@ -1069,6 +1300,8 @@ export default { this.isShowpageIcon = true; this.neibianju = "neibianju"; this.closepageH = ""; + + // this.workFileScrollBar ? this.workFileScrollBar.scrollTop = 0 : ""; }, /** * 点击了复制文件副本的按钮 @@ -1140,6 +1373,16 @@ export default { } }, watch: { + localFileHashMap(val) { + let temp = {}; + for(let key in val) { + temp[val[key]] = key; + } + this.reverseLocalFileHashMap = temp; + }, + nowFolderIndex() { + this.isfinishGetExchangeNodes && this.getExchangeNodes(); + }, rightMenuvisible(value) { if (value) { document.body.addEventListener("click", this.closeShowMenu); @@ -1182,6 +1425,9 @@ export default {