duy 1 год назад
Родитель
Сommit
d5f2fabb82
1 измененных файлов с 21 добавлено и 1 удалено
  1. 21 1
      src/views/measure/systemUnit.vue

+ 21 - 1
src/views/measure/systemUnit.vue

@@ -169,6 +169,7 @@ import ManualSorting from '@/components/WbsTree/ManualSorting'
 import { getLazyTree,add,getDetail,getChildList,updateNode,removeNode,getSameList,sortNode,getEngineeringTypeName,getNodeTypeList } from "@/api/measure/template.js";
 import { getDictionary } from "@/api/system/dict";
 import {isObjectEmpty} from "@/util/util";
+import { getStore, setStore } from "@/util/store";
 
  export default {
   components:{
@@ -201,6 +202,7 @@ import {isObjectEmpty} from "@/util/util";
         ]
         }],
         defaultExpandedKeys:[],
+        expandName: this.$route.fullPath,
         defaultProps: {
           children: 'children',
           label: 'nodeName',
@@ -247,6 +249,7 @@ import {isObjectEmpty} from "@/util/util";
     init(){
       const {id} = this.$route.query;
       this.id = id
+      this.defaultExpandedKeys = getStore({ name: this.expandName });
       // this.getNodeTypelist(id)
     },
     formatNodeType(row, column, cellValue) {
@@ -333,6 +336,8 @@ import {isObjectEmpty} from "@/util/util";
       })
     },
     menuClick(e,item,data,node){
+        //获取节点展开路径
+        this.getExpandedKeys(node);
        this.menuKey=''
         e.preventDefault();
         if(item.key==='add'){
@@ -455,7 +460,22 @@ import {isObjectEmpty} from "@/util/util";
       // this.updateNodeTable();
 
       //获取节点展开路径
-      // this.getExpandedKeys(node);
+      this.getExpandedKeys(node);
+    },
+          //获取节点展开路径
+   getExpandedKeys(node) {
+      //console.log(node)
+      let expandedKeys = [];
+      while (node.parent) {
+        expandedKeys.push(node.data.id);
+        node = node.parent;
+      }
+      setStore({
+        name: this.expandName,
+        content: expandedKeys,
+        type: true, //sessionStorage
+      });
+      //console.log(expandedKeys)
     },
     updateTreeNewNode () {
       let detail = (this.nodeDetail.parentId ? this.nodeDetail : this.curTreeData);