diff --git a/src/views/components_web/workLine/workLine.vue b/src/views/main_web/workspace/components/workLine.vue similarity index 95% rename from src/views/components_web/workLine/workLine.vue rename to src/views/main_web/workspace/components/workLine.vue index ceda3326..dcd82a66 100644 --- a/src/views/components_web/workLine/workLine.vue +++ b/src/views/main_web/workspace/components/workLine.vue @@ -1,322 +1,320 @@ - - - + + + diff --git a/src/views/main_web/workspace/service.js b/src/views/main_web/workspace/service.js new file mode 100644 index 00000000..1e670e3f --- /dev/null +++ b/src/views/main_web/workspace/service.js @@ -0,0 +1,25 @@ +import { fetchApi } from '@/utils/request'; +import { firstCharToLowerCase, firstCharToUpperCase } from '@/utils/tool'; + + +export async function fetchWorkFlow(projectId, userId) { + const res = await fetchApi('folder/queryNodeFolderListByProjectIdAndUserId', { projectId, userId }); + const list = (res.Data || []).map(node => { + const lower = firstCharToLowerCase(node); + // 工作链中的上下游 + lower.listsShareFrom = [[], []]; + return lower; + }); + return list; +} + +/** + * 查询文件夹下边的文件(包含子文件夹以及协同文件) + * @param {*} folderId + * @param {*} userId + */ +export async function fetchFolderFileList(folderId, userId) { + const res = await fetchApi('folder/queryFileListByFolderId', {folderId, userId}); + console.log(res); + return res; +} \ No newline at end of file diff --git a/src/views/main_web/workspace/workspace.vue b/src/views/main_web/workspace/workspace.vue index 6cf69f71..7f72bcc7 100644 --- a/src/views/main_web/workspace/workspace.vue +++ b/src/views/main_web/workspace/workspace.vue @@ -2264,7 +2264,7 @@
{{ item.extension }} @@ -2332,7 +2332,7 @@
{{ item.extension }} @@ -2710,12 +2710,13 @@ import officeview from "@/views/components/officeview/officeview.vue"; import imageview from "@/views/components/imageview/imageview.vue"; // import BMapComponent from "@/views/components/map/bmap"; import DistWork from "@/views/components_web/distWork/distWork"; -import WorkLine from "@/views/components_web/workLine/workLine"; +import WorkLine from "./components/workLine"; import ProjSetting from "@/views/components_web/projSetting/projSetting"; import FileShare from "@/views/components_web/share_setting/fileshare"; import draggable from "vuedraggable"; import vuetify from "vuetify"; import back from '@/services/system'; +import * as services from './service'; const $ = window.jQuery; const Velocity = window.Velocity; @@ -2730,7 +2731,7 @@ const initialTempFile = (folderGroupID, folderGroupName) => ({ folderGroupID, folderGroupName, folderID: "", - levelID: "", + levelId: "", modifyTime: "", modifyUserID: "", superID: "", @@ -2939,7 +2940,7 @@ export default { folderGroupID: "", folderID: "", superID: "", - levelID: "", + levelId: "", folderGroupName: "", childCount: 0, createUserID: "", @@ -3145,6 +3146,7 @@ export default { } }, /** + * todo * 获取设置信息 */ loadSettings() { @@ -3181,6 +3183,7 @@ export default { }); }, /** + * todo * 判断用户是否是项目负责人 */ loadProjManager: function () { @@ -3679,62 +3682,65 @@ export default { this.isonselect = "-2"; } }, - /* - *获取列表文件夹 - */ - listFolders: function () { - var thisApp = this; - this.$axios({ - method: "get", - url: encodeURI( - process.env.API_HOST + - "folders/work/" + - this.userId + - "/" + - this.projId - ), - }) - .then((response) => { - thisApp.listUserFolders = response.data; - if (thisApp.listUserFolders.length > 0) { - if (this.$route.params.folderId != undefined) { - var folderid = this.$route.params.folderId; - for ( - let index = 0; - index < thisApp.listUserFolders.length; - index++ - ) { - if (thisApp.listUserFolders[index].folderID == folderid) { - thisApp.nowFolderIndex = index; - } - } - } else { - if ( - sessionStorage.nowFolderIndex != "" && - sessionStorage.nowFolderIndex != undefined - ) { - thisApp.nowFolderIndex = parseInt( - sessionStorage.nowFolderIndex - ); - } else { - thisApp.nowFolderIndex = 0; - } - } - thisApp.nowFolder = thisApp.listUserFolders[thisApp.nowFolderIndex]; - thisApp.listFiles(); - if ( - thisApp.dbClickSelectedFolderGroupData == null || - JSON.stringify(thisApp.dbClickSelectedFolderGroupData) == "{}" - ) { - thisApp.timer = setInterval(() => { - thisApp.listFiles(); - }, 3 * 1000); - } + /** + * todo + * 获取列表文件夹 + */ + async listFolders () { + const userId = this.userId; + const projId = this.projId; + const workList = await services.fetchWorkFlow(projId, userId); + const folderList = workList.slice(1); + console.log(folderList); + this.listUserFolders = folderList; + if(!folderList.length) return; + if (this.$route.params.folderId != undefined) { + var folderId = this.$route.params.folderId; + folderList.forEach((folder, index) => { + if(folder.id === folderId) { + this.nowFolderIndex = index; } - }) - .catch((error) => { - console.log(error); }); + } else { + if ( + sessionStorage.nowFolderIndex != "" && + sessionStorage.nowFolderIndex != undefined + ) { + this.nowFolderIndex = parseInt( + sessionStorage.nowFolderIndex + ); + } else { + this.nowFolderIndex = 0; + } + } + + this.nowFolder = folderList[this.nowFolderIndex]; + this.listFiles(); + if ( + this.dbClickSelectedFolderGroupData == null || + JSON.stringify(this.dbClickSelectedFolderGroupData) == "{}" + ) { + this.timer = setInterval(() => { + this.listFiles(); + }, 3 * 1000); + } + // var thisApp = this; + // this.$axios({ + // method: "get", + // url: encodeURI( + // process.env.API_HOST + + // "folders/work/" + + // this.userId + + // "/" + + // this.projId + // ), + // }) + // .then((response) => { + + // }) + // .catch((error) => { + // console.log(error); + // }); }, /** * 更新新项目标识 @@ -3761,91 +3767,134 @@ export default { /** * 获取当前工作下文件 */ - listFiles: function () { - var thisApp = this; - thisApp.isCommonPage = false; - thisApp.nowFolderId = - thisApp.listUserFolders[thisApp.nowFolderIndex].folderID; // 设置当前打开工作文件夹ID - thisApp.nowFolderName = - thisApp.listUserFolders[thisApp.nowFolderIndex].folderName; // 设置当前工作名称 - var folderPerm = - thisApp.listUserFolders[thisApp.nowFolderIndex].folderPerm; - if ( - this.listUserFolders[thisApp.nowFolderIndex].folderName == "公共文件夹" - ) { + async listFiles() { + const currentFolderIdx = this.nowFolderIndex; + const currentFolder = this.listUserFolders[currentFolderIdx]; + const userId = this.userId; + this.isCommonPage = false; + this.nowFolderId = currentFolder.id; // 设置当前打开工作文件夹ID + this.nowFolderName = currentFolder.folderName; // 设置当前工作名称 + this.folderPerm = currentFolder.folderPerm; + // thisApp.isCommonPage = false; + // thisApp.nowFolderId = + // thisApp.listUserFolders[thisApp.nowFolderIndex].id; // 设置当前打开工作文件夹ID + // thisApp.nowFolderName = + // thisApp.listUserFolders[thisApp.nowFolderIndex].folderName; // 设置当前工作名称 + // var folderPerm = + // thisApp.listUserFolders[thisApp.nowFolderIndex].folderPerm; + const isCommonFolder = currentFolder.folderName === '公共文件夹'; + if(isCommonFolder) { this.fileindex = 2; - sessionStorage.comFolderId = - thisApp.listUserFolders[thisApp.nowFolderIndex].folderID; + sessionStorage.comFolderId = currentFolder.id; this.isCommonPage = true; - this.$axios({ - method: "get", - url: encodeURI( - process.env.API_HOST + - "archives" + - "/all/" + - thisApp.nowFolderId + - "/" + - sessionStorage.userId - ), - }) - .then((response) => { - thisApp.folderFileList = response.data; - if (this.currentPageType == 0) { - // 加载我的文件 - this.myFilesList = this.folderFileList.listMyFiles; - //zxm+ 加载我的文件夹组 - this.myListFolderGroups = this.folderFileList.listFolderGroups; - } else { - // 加载工作文件 - this.myFilesList = this.folderFileList.listOtherFiles; - //zxm+ 加载工作文件夹组 - this.myListFolderGroups = this.folderFileList.listOtherFolderGroups; - } - thisApp.loadCommitedComFiles(); - }) - .catch((error) => { - console.log(error); - }); + } else if (this.fileindex == 2) { this.fileindex = 0; } + + const res = await services.fetchFolderFileList(currentFolder.id, userId); + if(res.Code !== 0) return; + const folderResInfo = (res.Data || {}); + const folderFileList = this.folderFileList = { + listAllFiles:null, + listBreadFolderGroups: null, + listFolderGroups: folderResInfo.folder, + // 我的文件 + listMyFiles: folderResInfo.myFile, + // 工作文件 + listOtherFiles: folderResInfo.workFile, + listOtherFolderGroups: null, + } + + if (this.currentPageType == 0) { + // 加载我的文件 + this.myFilesList = this.folderFileList.listMyFiles; + // 加载我的文件夹 zxm+ + this.myListFolderGroups = this.folderFileList.listFolderGroups; + } else { + // 加载工作文件 + this.myFilesList = this.folderFileList.listOtherFiles; + // 加载工作文件分组 zxm+ + this.myListFolderGroups = this.folderFileList.listOtherFolderGroups; + } + + if(isCommonFolder) { + this.loadCommitedComFiles(); } else { - if (this.fileindex == 2) { - this.fileindex = 0; + if (this.curactive == 0) { + this.listCollaborationFiles(); + } else if (this.curactive == 1) { + this.loadListCommonFiles(); } - this.$axios({ - method: "get", - url: encodeURI( - process.env.API_HOST + - "archives" + - "/all/" + - thisApp.nowFolderId + - "/" + - sessionStorage.userId - ), - }) - .then((response) => { - thisApp.folderFileList = response.data; - if (this.currentPageType == 0) { - // 加载我的文件 - thisApp.myFilesList = thisApp.folderFileList.listMyFiles; - // 加载我的文件夹 zxm+ - thisApp.myListFolderGroups = - thisApp.folderFileList.listFolderGroups; - } else { - // 加载工作文件 - thisApp.myFilesList = thisApp.folderFileList.listOtherFiles; - // 加载工作文件分组 zxm+ - thisApp.myListFolderGroups = - thisApp.folderFileList.listOtherFolderGroups; - } - if (thisApp.curactive == 0) { - thisApp.listCollaborationFiles(); - } else if (thisApp.curactive == 1) { - thisApp.loadListCommonFiles(); - } - }) - .catch((error) => { - console.log(error); - }); } + + // debugger; + // if (currentFolder.folderName == "公共文件夹") { + // this.fileindex = 2; + // sessionStorage.comFolderId = currentFolder.id; + // this.isCommonPage = true; + // this.$axios({ + // method: "get", + // url: encodeURI( + // process.env.API_HOST + + // "archives" + + // "/all/" + + // this.nowFolderId + + // "/" + + // sessionStorage.userId + // ), + // }) + // .then((response) => { + // this.folderFileList = response.data; + // if (this.currentPageType == 0) { + // // 加载我的文件 + // this.myFilesList = this.folderFileList.listMyFiles; + // //zxm+ 加载我的文件夹组 + // this.myListFolderGroups = this.folderFileList.listFolderGroups; + // } else { + // // 加载工作文件 + // this.myFilesList = this.folderFileList.listOtherFiles; + // //zxm+ 加载工作文件夹组 + // this.myListFolderGroups = this.folderFileList.listOtherFolderGroups; + // } + // this.loadCommitedComFiles(); + // }) + // .catch((error) => { + // console.log(error); + // }); + // } else { + // if (this.fileindex == 2) { this.fileindex = 0; } + // this.$axios({ + // method: "get", + // url: encodeURI( + // process.env.API_HOST + + // "archives" + + // "/all/" + + // this.nowFolderId + + // "/" + + // sessionStorage.userId + // ), + // }) + // .then((response) => { + // this.folderFileList = response.data; + // if (this.currentPageType == 0) { + // // 加载我的文件 + // this.myFilesList = this.folderFileList.listMyFiles; + // // 加载我的文件夹 zxm+ + // this.myListFolderGroups = this.folderFileList.listFolderGroups; + // } else { + // // 加载工作文件 + // this.myFilesList = this.folderFileList.listOtherFiles; + // // 加载工作文件分组 zxm+ + // this.myListFolderGroups = this.folderFileList.listOtherFolderGroups; + // } + // if (this.curactive == 0) { + // this.listCollaborationFiles(); + // } else if (this.curactive == 1) { + // this.loadListCommonFiles(); + // } + // }) + // .catch((error) => { + // console.log(error); + // }); + // } }, /** * 获取协作文件 @@ -6366,7 +6415,7 @@ export default { folderGroupID: "", folderID: "", superID: "", - levelID: "", + levelId: "", folderGroupName: "", childCount: 0, createUserID: "", @@ -6395,9 +6444,10 @@ export default { } this.folderGroupData.folderGroupID = this.dbClickSelectedFolderGroupData.folderGroupID; this.folderGroupData.superID = this.dbClickSelectedFolderGroupData.folderGroupID; - this.folderGroupData.levelID = this.dbClickSelectedFolderGroupData.levelID; + this.folderGroupData.levelId = this.dbClickSelectedFolderGroupData.levelId; this.folderGroupData.folderID = this.nowFolder.folderID; this.folderGroupData.createUserID = sessionStorage.userId; + // debugger; this.$axios({ method: "post", url: encodeURI(process.env.API_HOST + "folders/foldergroup"), @@ -6455,7 +6505,7 @@ export default { var param = { folderId: foldergroup.folderID, foldergroupId: foldergroup.folderGroupID, - levelID: foldergroup.levelID, + levelId: foldergroup.levelId, userId: sessionStorage.userId, }; this.$axios({