zhangym 2 anni fa
parent
commit
aa692f9130

+ 32 - 10
src/views/energyOperationSupport/components/securitys/pic2.vue

@@ -26,7 +26,7 @@
           </el-row>
         </div>
         <div class="canvaBox">
-            
+
           <div class="minimap">
           </div>
           <!-- 树图相关 -->
@@ -128,7 +128,7 @@ export default {
   data() {
     return {
       graph: null,
-      thereDataId : '',
+      thereDataId: '',
       crumbNavs: [],
       canvasWidth: 0, // 画布宽度
       canvasHeight: 0,// 画布高度
@@ -263,12 +263,18 @@ export default {
   },
   methods: {
     changeNode(node) {
-      console.log('casdasd', node)
+      if(node){
+        console.log('casdasd', node)
       if (node.tlevel === 1) {
-
+        this.crumbNavs = null;
       }
-      graph.changeData(JSON.parse(JSON.stringify(node)));
+      graph.changeData(node);
+      //graph.changeData(JSON.parse(JSON.stringify(node)));
       graph.fitView([140, 40, 20, 40]);
+      }else{
+        console.log("没有数据")
+      }
+    
     },
     treeData3() {
       //获取tree数据
@@ -578,12 +584,13 @@ export default {
         that.findNodesByModels([nodeModel]);
         that.crumbNavs = [];
         that.getParentNodes(that.treeData, nodeModel, nodeModel.id);
-    
-        if (nodeModel.tlevel >= 1) {
-          graph.changeData(JSON.parse(JSON.stringify(nodeModel))),
-            graph.fitView([230, 240, 390, 390]);
+        that.changeDat(nodeModel);
 
-        }
+        // if (nodeModel.tlevel > 1) {
+        //   graph.changeData(JSON.parse(JSON.stringify(nodeModel))),
+        //     graph.fitView([230, 240, 390, 390]);
+
+        // }
 
       });
       // 鼠标点击画布,显示所有节点和边 
@@ -673,6 +680,20 @@ export default {
           }
         })
     },
+    //changeDat
+    changeDat(node) {
+      if(node){
+        if (node.tlevel > 1) {
+        //graph.changeData(JSON.parse(JSON.stringify(node))),
+        graph.changeData(node)
+        graph.fitView([230, 240, 390, 390]);
+      }else{
+        console.log("没有数据")
+      }
+      }
+   
+    },
+
     // 获取节点结构数据
     getGxNameData3() {
       let that = this
@@ -1530,6 +1551,7 @@ export default {
   cursor: pointer;
   margin-left: 800px;
 }
+
 .text {
   margin-left: 550px;
   font-size: 50px;