Эх сурвалжийг харах

树形节点刷新后定位

duy 2 жил өмнө
parent
commit
87d9ef4e74

+ 10 - 3
src/views/archives/appraisal.vue

@@ -12,7 +12,7 @@
             </div>
             <div class="hc-tree-box" v-loading="treeLoading" element-loading-text="加载中...">
                 <el-scrollbar>
-                    <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="nodeElTreeClick" @nodeLoading="treeNodeLoading"/>
+                    <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="nodeElTreeClick" @nodeLoading="treeNodeLoading" @menuTap="ElTreeMenuClick" :autoExpandKeys="treeAutoExpandKeys"/>
                       <!--ProjectTree :datas="ElTreeData" :autoExpandKeys="TreeAutoExpandKeys" @nodeTap="nodeElTreeClick" :ischeck="false"/-->
                 </el-scrollbar>
             </div>
@@ -316,7 +316,7 @@ const getClassIfyList = async () => {
     console.log(ElTreeData.value,'ElTreeData');
 }
 //自动展开缓存
-const TreeAutoExpandKeys = ref(getStoreValue('scanningTreeExpandKeys') || [])
+const treeAutoExpandKeys = ref(getStoreValue('apprailExpandKeys') || [])
 
 //项目树被点击
 const treeNodeInfo = ref({})
@@ -331,7 +331,14 @@ const nodeElTreeClick = ({node, data, keys, key}) => {
     getTableData()
 
     //缓存展开的节点
-    setStoreValue('scanningTreeExpandKeys', keys)
+    setStoreValue('apprailExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
+}
+//树菜单被点击
+const ElTreeMenuClick = async ({key, node, data, keys}) => {
+    setStoreValue('apprailExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
+ 
 }
 </script>
 

+ 6 - 4
src/views/archives/bookmark.vue

@@ -12,7 +12,7 @@
             </div>
             <div class="hc-tree-box"  v-loading="treeLoading" element-loading-text="加载中...">
                 <el-scrollbar>
-                     <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="nodeElTreeClick" @nodeLoading="treeNodeLoading"/>
+                     <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="nodeElTreeClick" @nodeLoading="treeNodeLoading" :autoExpandKeys="treeAutoExpandKeys"/>
                 </el-scrollbar>
             </div>
             <!--左右拖动-->
@@ -240,16 +240,16 @@ const onmousedown = () => {
 
 
 //自动展开缓存
-const TreeAutoExpandKeys = ref(getStoreValue('scanningTreeExpandKeys') || [])
 
+const treeAutoExpandKeys = ref(getStoreValue('bookExpandKeys') || [])
 //项目树被点击
 const nodeElTreeClick = ({node, data, keys, key}) => {
     console.log('点击',data);
     // treeNodeInfo.value = node
    formInline.value=data
 
-    //缓存展开的节点
-    setStoreValue('scanningTreeExpandKeys', keys)
+   setStoreValue('bookExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
 }
 //设置树菜单数据
 const ElTreeMenu = ref([])
@@ -270,6 +270,8 @@ const ElTreeMenuClick = async ({key,node,data}) => {
     // nodeItemInfo.value = node
     // nodeDataInfo.value = data
     setTreeMenuDataClick({key,node,data})
+    setStoreValue('bookExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
 }
 //处理菜单被点击数据
 const setTreeMenuDataClick = ({key,node,data}) => {

+ 12 - 2
src/views/archives/meta-data.vue

@@ -12,7 +12,7 @@
             </div>
             <div class="hc-tree-box" v-loading="treeLoading" element-loading-text="加载中...">
                 <el-scrollbar>
-                  <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="nodeElTreeClick" @nodeLoading="treeNodeLoading"/>
+                  <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="nodeElTreeClick" @nodeLoading="treeNodeLoading"  @menuTap="ElTreeMenuClick" :autoExpandKeys="treeAutoExpandKeys"/>
                    <!--ProjectTree :datas="ElTreeData" :autoExpandKeys="TreeAutoExpandKeys" @nodeTap="nodeElTreeClick" :ischeck="false"/-->
                 </el-scrollbar>
             </div>
@@ -378,9 +378,19 @@ const treeDataInfo = ref({})
 const nodeIds = ref('')
 const isStorageNode = ref(0)
 const isBuiltDrawing = ref(0)
+//自动展开缓存
+const treeAutoExpandKeys = ref(getStoreValue('metaExpandKeys') || [])
 const nodeElTreeClick = ({node, data, keys, key}) => {
     console.log('点击',data);
-    setStoreValue('scanningTreeExpandKeys', keys)
+    //缓存展开的节点
+    setStoreValue('metaExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
+}
+//树菜单被点击
+const ElTreeMenuClick = async ({key, node, data, keys}) => {
+    setStoreValue('metaExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
+ 
 }
 </script>
 

+ 10 - 2
src/views/archives/rolling.vue

@@ -12,7 +12,7 @@
             </div>
             <div class="hc-tree-box"  v-loading="treeLoading" element-loading-text="加载中...">
                 <el-scrollbar>
-                    <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="nodeElTreeClick"  @nodeLoading="treeNodeLoading"/>
+                    <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="nodeElTreeClick"  @nodeLoading="treeNodeLoading" :autoExpandKeys="treeAutoExpandKeys" @menuTap="ElTreeMenuClick"/>
                     <!--ProjectTree :datas="ElTreeData" :autoExpandKeys="TreeAutoExpandKeys" @nodeTap="nodeElTreeClick" :ischeck="false"/-->
                 </el-scrollbar>
             </div>
@@ -201,6 +201,7 @@ const getClassIfyList = async () => {
 const TreeAutoExpandKeys = ref(getStoreValue('scanningTreeExpandKeys') || [])
 
 //项目树被点击
+const treeAutoExpandKeys = ref(getStoreValue('rollingExpandKeys') || [])
 const nodeElTreeClick = ({node, data, keys, key}) => {
     console.log('点击',data);
     searchForm.value.total = 0
@@ -209,7 +210,14 @@ const nodeElTreeClick = ({node, data, keys, key}) => {
     searchForm.value.nodeIds = data.id || '';
     getTableData()
     //缓存展开的节点
-    setStoreValue('scanningTreeExpandKeys', keys)
+    setStoreValue('rollingExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
+}
+//树菜单被点击
+const ElTreeMenuClick = async ({key, node, data, keys}) => {
+    setStoreValue('rollingExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
+ 
 }
 //预览pdf
 const viewPdf=async(id)=>{

+ 11 - 1
src/views/archives/tuning.vue

@@ -12,7 +12,7 @@
             </div>
             <div class="hc-tree-box" v-loading="treeLoading" element-loading-text="加载中...">
                 <el-scrollbar>
-                    <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="nodeElTreeClick"
+                    <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="nodeElTreeClick" @menuTap="ElTreeMenuClick" :autoExpandKeys="treeAutoExpandKeys"
                             @nodeLoading="treeNodeLoading"/>
                 </el-scrollbar>
             </div>
@@ -301,7 +301,12 @@ const treeNodeLoading = () => {
 const nodeIds = ref('')
 const isStorageNode = ref(0)
 // const isBuiltDrawing = ref(0)
+//自动展开缓存
+const treeAutoExpandKeys = ref(getStoreValue('turningExpandKeys') || [])
 const nodeElTreeClick = ({node, data, keys, key}) => {
+     //缓存展开的节点
+     setStoreValue('turningExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
     console.log('点击', data);
     searchForm.value.total = 0
     searchForm.value.current = 1
@@ -309,6 +314,11 @@ const nodeElTreeClick = ({node, data, keys, key}) => {
     searchForm.value.nodeIds = data.id || '';
     getTableData()
 }
+//树菜单被点击
+const ElTreeMenuClick = async ({key, node, data, keys}) => {
+    setStoreValue('turningExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
+}
 const nodeRadio = ({node, data, keys, key}) => {
     console.log(data, 'data33333');
     chnodeId.value = data.id || '';

+ 13 - 3
src/views/custody/early.vue

@@ -39,7 +39,7 @@
                 </div>
                 <div class="hc-tree-box" v-loading="treeLoading" element-loading-text="加载中...">
                     <el-scrollbar>
-                        <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="projectTreeClick" @nodeLoading="treeNodeLoading"/>
+                        <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="projectTreeClick" @nodeLoading="treeNodeLoading" @menuTap="ElTreeMenuClick" :autoExpandKeys="treeAutoExpandKeys"/>
                     </el-scrollbar>
                 </div>
                 <!--左右拖动-->
@@ -70,6 +70,7 @@ import HcTree from "~src/components/tree/hc-tree.vue"
 import TabReform from "./components/tab-reform.vue"
 import TabExpire from "./components/tab-expire.vue"
 import TabSpite from "./components/tab-spite.vue"
+import {getStoreValue, setStoreValue} from '~src/utils/storage'
 
 //变量
 const useAppState = useAppStore()
@@ -109,10 +110,19 @@ const sbTableClick = (key) => {
 
 //树操作
 const nodeDataInfo = ref({})
-const projectTreeClick = ({data}) => {
+//自动展开缓存
+const treeAutoExpandKeys = ref(getStoreValue('earlyExpandKeys') || [])
+const projectTreeClick = ({key, node, data, keys}) => {
     console.log(data)
+      //缓存展开的节点
+      setStoreValue('earlyExpandKeys', keys)
+        treeAutoExpandKeys.value = keys || []
+}
+//树菜单被点击
+const ElTreeMenuClick = async ({key, node, data, keys}) => {
+    setStoreValue('earlyExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
 }
-
 
 //左右拖动,改变树形结构宽度
 const leftWidth = ref(382);

+ 11 - 2
src/views/file/records.vue

@@ -12,7 +12,7 @@
             </div>
             <div class="hc-tree-box" v-loading="treeLoading" element-loading-text="加载中...">
                 <el-scrollbar>
-                    <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="projectTreeClick" @nodeLoading="treeNodeLoading"/>
+                    <HcTree :projectId="projectId" :contractId="contractId" :autoExpandKeys="treeAutoExpandKeys" @nodeTap="projectTreeClick" @nodeLoading="treeNodeLoading"  @menuTap="ElTreeMenuClick"/>
                 </el-scrollbar>
             </div>
             <!--左右拖动-->
@@ -270,6 +270,7 @@ import {getArrValue, deepClone, downloadBlob, getObjVal} from "js-fast-way"
 import tasksApi from '~api/tasks/data';
 import ossApi from "~api/oss";
 import archiveFileApi from "~api/archiveFile/archiveFileAuto.js";
+import {getStoreValue, setStoreValue} from '~src/utils/storage'
 
 //变量
 const useAppState = useAppStore()
@@ -360,7 +361,10 @@ const primaryKeyId = ref('')
 const isBuiltDrawing = ref(0)
 const isStorageNode = ref(0)
 const nodeIds = ref('')
+const treeAutoExpandKeys = ref(getStoreValue('wbsTreeExpandKeys') || [])
 const projectTreeClick = ({node, data, keys, key}) => {
+    setStoreValue('wbsTreeExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
     nodeIds.value = data.id || '';
     isStorageNode.value = data['isStorageNode'] || 0;
 
@@ -372,7 +376,12 @@ const projectTreeClick = ({node, data, keys, key}) => {
 
     getTableData()
 }
-
+//树菜单被点击
+const ElTreeMenuClick = async ({key, node, data, keys}) => {
+    setStoreValue('wbsTreeExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
+ 
+}
 //回车搜索
 const keyUpEvent = (e) => {
     if (e.key === "Enter") {

+ 13 - 2
src/views/transfer/inspects.vue

@@ -12,7 +12,7 @@
             </div>
             <div class="hc-tree-box" v-loading="treeLoading" element-loading-text="加载中...">
                 <el-scrollbar>
-                    <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="projectTreeClick" @nodeLoading="treeNodeLoading"/>
+                    <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="projectTreeClick" @nodeLoading="treeNodeLoading" :autoExpandKeys="treeAutoExpandKeys" @menuTap="ElTreeMenuClick"/>
                 </el-scrollbar>
             </div>
             <!--左右拖动-->
@@ -154,6 +154,7 @@ import {useAppStore} from "~src/store";
 //import HcTree from "./components/hc-tree.vue"
 import HcTree from "~src/components/tree/hc-tree.vue"
 import MetaTable from "./components/meta-table.vue"
+import {getStoreValue, setStoreValue} from '~src/utils/storage'
 
 //变量
 const useAppState = useAppStore()
@@ -190,10 +191,20 @@ const searchForm = ref({
 
 //树相关的变量
 const primaryKeyId = ref('')
-const projectTreeClick = ({data}) => {
+
+//自动展开缓存
+const treeAutoExpandKeys = ref(getStoreValue('inspectExpandKeys') || [])
+const projectTreeClick = ({node, data, keys, key}) => {
     console.log(data)
+    //缓存展开的节点
+    setStoreValue('inspectExpandKeys', keys)
+    treeAutoExpandKeys.value = keys || []
 }
+//树菜单被点击
+const ElTreeMenuClick = async ({key,node,data}) => {
 
+    setStoreValue('inspectExpandKeys', keys)
+}
 //分页被点击
 const pageChange = ({current, size}) => {
     searchForm.value.current = current