Parcourir la source

标签设置,收藏打开

liuQiang il y a 1 an
Parent
commit
23a8cb98c2

+ 16 - 10
src/layout/NewIndex.vue

@@ -63,14 +63,17 @@ const openMaxmin = (title, path) => {
     }
     const oldStorage = JSON.parse(storage);
     // 判断是否存在相同的标签
-    if (oldStorage.find((item) => item.path === path)) {
-      //这里应该是打开旧的标签
-      return;
-    }
+    // if (oldStorage.find((item) => item.path === path)) {
+    //   //这里应该是打开旧的标签
+    //   return;
+    // }
     const thisId = layer.open({
       type: "iframe", //类型
-      move: false, //不可拖拽
+      // move: true, //拖拽
       maxmin: true,
+      moveOut:true,//可以拖出窗外
+      shade:false,//不显示遮罩
+      resize:true,//拉伸
       title: title,
       content: path,
       shadeClose: false, // 点击遮罩关闭
@@ -136,14 +139,17 @@ const openTab = (title, path) => {
     }
     const oldStorage = JSON.parse(storage);
     // 判断是否存在相同的标签
-    if (oldStorage.find((item) => item.path === path)) {
-      //这里应该是打开旧的标签
-      return;
-    }
+    // if (oldStorage.find((item) => item.path === path)) {
+    //   //这里应该是打开旧的标签
+    //   return;
+    // }
     const thisId = layer.open({
       type: "iframe", //类型
-      move: false, //不可拖拽
+      // move: true, //拖拽
       maxmin: true,
+      resize:true,//拉伸
+      moveOut:true,//可以拖出窗外
+      shade:false,//不显示遮罩
       title: title,
       content: path,
       shadeClose: false, // 点击遮罩关闭

+ 27 - 85
src/views/collect/index.vue

@@ -430,108 +430,50 @@ const folderClick = async (row, list, e, jump) => {
   if (openFolderTop.value.dirName.includes("个人空间")) {
     // 创建标签
     const addData = {
-      path: "/myfile" + firstFolderData.value.dirId,
+      path: "/myfile",
       name: firstFolderData.value.dirName,
       clickRowId:firstFolderData.value,
     };
-    addFolderAdd(addData);
+     const itemData = {
+        name: '个人空间',
+        path: "/myfile"
+    }
+    // addFolderAdd(addData);
+    sessionStorage.setItem('newTab',JSON.stringify(itemData))
+    sessionStorage.setItem('openFolder',JSON.stringify(addData))
   } else if (openFolderTop.value.dirName.includes("部门空间")) {
         // 创建标签
     const addData = {
-      path: "/department" + firstFolderData.value.dirId,
+      path: "/department",
       name: firstFolderData.value.dirName,
       clickRowId:firstFolderData.value,
     };
-    addFolderAdd(addData);
+    const itemData = {
+        name: '部门空间',
+        path: "/department"
+    }
+    // addFolderAdd(addData);
+    sessionStorage.setItem('newTab',JSON.stringify(itemData))
+    // addFolderAdd(addData);
+    sessionStorage.setItem('openFolder',JSON.stringify(addData))
   } else {
             // 创建标签
     const addData = {
-      path: "/publicment" + firstFolderData.value.dirId,
+      path: "/publicment",
       name: firstFolderData.value.dirName,
       clickRowId:firstFolderData.value,
     };
-    addFolderAdd(addData);
+    const itemData = {
+        name: '公公空间',
+        path: "/publicment"
+    }
+    // addFolderAdd(addData);
+    sessionStorage.setItem('newTab',JSON.stringify(itemData))
+    // addFolderAdd(addData);
+    sessionStorage.setItem('openFolder',JSON.stringify(addData))
   }
   // 初始化分页数据
 };
-// const folderClick = (row, list, e, jump) => {
-//   console.log("thisFolder.value", thisFolder.value);
-//   // 初始化分页数据
-//   tableBeEnd.value = true;
-//   filePageNum.value = 1;
-//   tableTotal.value = 0;
-//   if (row) {
-//     thisFolder.value = row.docDir ? row.docDir : row;
-//   } else {
-//     row = thisFolder.value;
-//   }
-//   console.log("row", row);
-
-//   if (row.favoriteId) {
-//     // 说明是拿到的收藏数据 也就是第一层
-//     pathLabelData.value = []; // 先把数据清空
-//     const labelItem = {
-//       name: row.docDir.dirName,
-//       dirId: row.docDir.dirId,
-//     };
-//     pathLabelData.value = [labelItem];
-//   } else {
-//     // 说明是点开拿到的数据 也就是第二层往后
-//     const oldArr = toRaw(pathLabelData.value);
-//     let newArr;
-//     if (jump == undefined) {
-//       newArr = oldArr.push({
-//         name: row.dirName,
-//         dirId: row.dirId,
-//       });
-//     } else {
-//       newArr = oldArr.splice(jump + 1);
-//     }
-//     pathLabelData.value = JSON.parse(JSON.stringify(oldArr));
-//   }
-//   newDirId.value = row.docDir ? row.docDir.dirId : row.dirId;
-//   newSpaceId.value = row.docDir ? row.docDir.spaceId : row.spaceId;
-//   const query = `${newDirId.value}?isAsc=${isAsc.value}&orderByColumn=createTime&pageSize=${pageSize.value}&pageNum=${filePageNum.value}`;
-//   documents
-//     .getALLdocumentByType(
-//       {
-//         parentId: newDirId.value - 0,
-//         spaceId: newSpaceId.value - 0,
-//         isAsc: isAsc.value,
-//         orderByColumn: "createTime"
-//       },
-//       2
-//     )
-//     .then((res) => {
-//       folderArr.value = res.rows;
-//       if (res.rows.length === 0) {
-//         myfile.getById(query).then((res) => {
-//           if (res.code === 200) {
-//             tableTotal.value = res.total;
-//             if (res.rows.length < res.total) {
-//               //第一次拿到的数据少于总数开启下拉事件
-//               tableBeEnd.value = false;
-//             }
-//             fileArr.value = res.rows;
-//           }
-//         });
-//       } else {
-//         myfile.getById(query).then((res) => {
-//           console.log("folerFile", res);
-//           if (res.code === 200) {
-//             tableTotal.value = res.total;
-//             if (res.rows.length < res.total) {
-//               //第一次拿到的数据少于总数开启下拉事件
-//               tableBeEnd.value = false;
-//             }
-//             fileArr.value = JSON.parse(JSON.stringify(res.rows));
-//             // console.log('fileList',toRaw(fileList.value));
-//           }
-//         });
-//       }
-//       loadingPreview.value = false
-//     });
-// };
 // 文件点击事件
 const clickFile = () => {};
 // 返回最顶层
@@ -574,7 +516,7 @@ const fileRight = (e, item) => {
     isTop.value = true;
   }
   // console.log("e", e);
-  console.log("item", toRaw(item));
+  // console.log("item", toRaw(item));
   //  唤出右键菜单,思路:获取鼠标位置来定位菜单
   showFlieRM.value = true;
   fileRightXY.value.top = e.pageY;

+ 48 - 5
src/views/department/MyFile.vue

@@ -1019,7 +1019,12 @@ export default {
                 name:row.dirName,
                 clickRowId:toRaw(row)
             }
-            addFolderAdd(addData) //加了这句代码界面会渲染两次
+            // addFolderAdd(addData) //加了这句代码界面会渲染两次
+             const itemData = {
+                name: row.dirName,
+                path:'/department' + row.dirId
+            }
+            sessionStorage.setItem('newTab',JSON.stringify(itemData))
             thisFolder.value = row
             console.log('row2',row);
             // topPath.value = row.dirPath
@@ -1313,17 +1318,34 @@ export default {
                     if(clickRow.value.isFiled === "Y" || !canEditArr.includes(copyFileType.value) || !toRaw(thisRole.value).some(item=>item == "edit")){
                         //归档了或者不允许编辑的格式 就是预览
                         if(thisFolderRole.value &&thisFolderRole.value.roles&& thisFolderRole.value.roles.l0800){
-                            addFileTab(clickRow.value, 0,1);
+                            const itemData = {
+                                name: clickRow.value.fileName,
+                                path: `${window.location.origin}/fileEdit?clickRowId=${clickRow.value.docId}&canEdit=0&canCopy=1&history=0&fileId=0`
+                            }
+
+                            sessionStorage.setItem('newTab',JSON.stringify(itemData))
                         }else{
-                        addFileTab(clickRow.value, 0,0); 
+                        const itemData = {
+                                name: clickRow.value.fileName,
+                                path: `${window.location.origin}/fileEdit?clickRowId=${clickRow.value.docId}&canEdit=0&canCopy=0&history=0&fileId=0`
+                            }
+                            sessionStorage.setItem('newTab',JSON.stringify(itemData))
                         }
                     }else{ // 编辑
                         //--------------------------
                             loadingPreview.value = false
                             if(thisFolderRole.value &&thisFolderRole.value.roles&& thisFolderRole.value.roles.l0800){
-                                    addFileTab(clickRow.value, 1,1);
+                                    const itemData = {
+                                        name: clickRow.value.fileName,
+                                        path: `${window.location.origin}/fileEdit?clickRowId=${clickRow.value.docId}&canEdit=1&canCopy=1&history=0&fileId=0`
+                                    }
+                                    sessionStorage.setItem('newTab',JSON.stringify(itemData))
                                 }else{
-                                addFileTab(clickRow.value, 1,0); 
+                                const itemData = {
+                                        name: clickRow.value.fileName,
+                                        path: `${window.location.origin}/fileEdit?clickRowId=${clickRow.value.docId}&canEdit=1&canCopy=0&history=0&fileId=0`
+                                    }
+                                    sessionStorage.setItem('newTab',JSON.stringify(itemData))
                                 }
                             cliCC.value = false
                             loadingPreview.value = false
@@ -2530,6 +2552,27 @@ export default {
                         refreshFile()
                     })
                 }
+                //查看是否有本地存储的文件夹信息
+               const json =  sessionStorage.getItem('openFolder')
+               const openFolder =json? JSON.parse(json):''
+                if(openFolder){
+                     const newRow = JSON.parse(openFolder.clickRowId)
+                    // console.log('newRow',newRow);
+                     myfile.getDir(newRow).then(res=>{
+                        // console.log('tores',res);
+                        thisFolder.value = res.data
+                        // 这里点的是一级目录 所以重新给pathLabelData赋值
+                        const labelItem = {
+                            name:res.data.dirName,
+                            dirId:res.data.dirId
+                        }      
+                        pathLabelData.value = [labelItem]
+                        //清楚该项本地存储
+                        sessionStorage.setItem('openFolder','')
+                        // openFolderPath()
+                        // refreshFile()
+                    })
+                }
             const hasMsg = localStorage.getItem('leftShowList')
             if(!hasMsg){
                 getConfigKey("dir.style.config").then(response => {

+ 21 - 0
src/views/myfile/MyFile.vue

@@ -2832,6 +2832,27 @@ export default {
                         refreshFile()
                     })
                 }
+                   //查看是否有本地存储的文件夹信息
+               const json =  sessionStorage.getItem('openFolder')
+               const openFolder =json? JSON.parse(json):''
+                if(openFolder){
+                     const newRow = JSON.parse(openFolder.clickRowId)
+                    // console.log('newRow',newRow);
+                     myfile.getDir(newRow).then(res=>{
+                        // console.log('tores',res);
+                        thisFolder.value = res.data
+                        // 这里点的是一级目录 所以重新给pathLabelData赋值
+                        const labelItem = {
+                            name:res.data.dirName,
+                            dirId:res.data.dirId
+                        }      
+                        pathLabelData.value = [labelItem]
+                        //清楚该项本地存储
+                        sessionStorage.setItem('openFolder','')
+                        // openFolderPath()
+                        // refreshFile()
+                    })
+                }
             const hasMsg = localStorage.getItem('leftShowList')
             if(!hasMsg){
                 getConfigKey("dir.style.config").then(response => {

+ 48 - 5
src/views/publicment/MyFile.vue

@@ -1013,7 +1013,12 @@ export default {
                 name:row.dirName,
                 clickRowId:toRaw(row)
             }
-            addFolderAdd(addData) //加了这句代码界面会渲染两次
+            // addFolderAdd(addData) //加了这句代码界面会渲染两次
+            const itemData = {
+                name: row.dirName,
+                path:'/publicment' + row.dirId
+            }
+            sessionStorage.setItem('newTab',JSON.stringify(itemData))
             thisFolder.value = row
             // console.log('row2',row);
             //  topPath.value = row.dirPath
@@ -1293,17 +1298,34 @@ export default {
                     if(clickRow.value.isFiled === "Y" || !canEditArr.includes(copyFileType.value) || !toRaw(thisRole.value).some(item=>item == "edit")){
                         //归档了或者不允许编辑的格式 就是预览
                         if(thisFolderRole.value &&thisFolderRole.value.roles&& thisFolderRole.value.roles.l0800){
-                            addFileTab(clickRow.value, 0,1);
+                            const itemData = {
+                                name: clickRow.value.fileName,
+                                path: `${window.location.origin}/fileEdit?clickRowId=${clickRow.value.docId}&canEdit=0&canCopy=1&history=0&fileId=0`
+                            }
+
+                            sessionStorage.setItem('newTab',JSON.stringify(itemData))
                         }else{
-                        addFileTab(clickRow.value, 0,0); 
+                        const itemData = {
+                                name: clickRow.value.fileName,
+                                path: `${window.location.origin}/fileEdit?clickRowId=${clickRow.value.docId}&canEdit=0&canCopy=0&history=0&fileId=0`
+                            }
+                            sessionStorage.setItem('newTab',JSON.stringify(itemData))
                         }
                     }else{ // 编辑
                         //--------------------------
                             loadingPreview.value = false
                             if(thisFolderRole.value &&thisFolderRole.value.roles&& thisFolderRole.value.roles.l0800){
-                                    addFileTab(clickRow.value, 1,1);
+                                    const itemData = {
+                                        name: clickRow.value.fileName,
+                                        path: `${window.location.origin}/fileEdit?clickRowId=${clickRow.value.docId}&canEdit=1&canCopy=1&history=0&fileId=0`
+                                    }
+                                    sessionStorage.setItem('newTab',JSON.stringify(itemData))
                                 }else{
-                                addFileTab(clickRow.value, 1,0); 
+                                const itemData = {
+                                        name: clickRow.value.fileName,
+                                        path: `${window.location.origin}/fileEdit?clickRowId=${clickRow.value.docId}&canEdit=1&canCopy=0&history=0&fileId=0`
+                                    }
+                                    sessionStorage.setItem('newTab',JSON.stringify(itemData))
                                 }
                             cliCC.value = false
                             loadingPreview.value = false
@@ -2516,6 +2538,27 @@ export default {
                         refreshFile()
                     })
                 }
+                //查看是否有本地存储的文件夹信息
+               const json =  sessionStorage.getItem('openFolder')
+               const openFolder =json? JSON.parse(json):''
+                if(openFolder){
+                     const newRow = JSON.parse(openFolder.clickRowId)
+                    // console.log('newRow',newRow);
+                     myfile.getDir(newRow).then(res=>{
+                        // console.log('tores',res);
+                        thisFolder.value = res.data
+                        // 这里点的是一级目录 所以重新给pathLabelData赋值
+                        const labelItem = {
+                            name:res.data.dirName,
+                            dirId:res.data.dirId
+                        }      
+                        pathLabelData.value = [labelItem]
+                        //清楚该项本地存储
+                        sessionStorage.setItem('openFolder','')
+                        // openFolderPath()
+                        // refreshFile()
+                    })
+                }
             const hasMsg = localStorage.getItem('leftShowList')
             if(!hasMsg){
                 getConfigKey("dir.style.config").then(response => {