From 994e5e08cba4e6b9ce321b7cf5cb1ec8d19dfa22 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期二, 12 四月 2022 17:50:21 +0800
Subject: [PATCH] 摄像机管理

---
 src/views/hashrate/CameraManage/index.vue |   40 +++++++++++++++++++++-------------------
 1 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/src/views/hashrate/CameraManage/index.vue b/src/views/hashrate/CameraManage/index.vue
index c8ab02e..9fba6ac 100644
--- a/src/views/hashrate/CameraManage/index.vue
+++ b/src/views/hashrate/CameraManage/index.vue
@@ -66,6 +66,7 @@
       activeTab: "淇℃伅缁存姢",
       clusterArr: [],
       cluster: "",
+      clusterData: [],
       intervalTimer: null,
       leftWith: 0,
       screenHeight: 0,
@@ -77,11 +78,8 @@
   },
 
   watch: {
-    "TreeDataPool.selectedNode": function (node) {
-      if (this.TreeDataPool.multiple) {
-        return;
-      }
-
+    "TreeDataPool.activeNode": function (node) {
+      console.log("cclickaaa");
       if (this.activeTab == "淇℃伅缁存姢") {
         if (this.TreeDataPool.treeActiveName == "camera") {
           this.$refs.cameraInfo.selectCamera(node);
@@ -93,6 +91,7 @@
     "TreeDataPool.selectedNodes": {
       handler(nodes) {
         if (this.activeTab == "鍦烘櫙閰嶇疆") {
+          console.log(this.TreeDataPool.multiple);
           //  this.$refs.sepRule.initCameraData(nodes[nodes.length - 1]);
           let CameraArr = [];
 
@@ -102,6 +101,7 @@
           });
 
           this.$refs.sepRule.Carmeras = CameraArr;
+          console.log(CameraArr);
         }
       },
       deep: true,
@@ -124,7 +124,6 @@
   },
   created() {
     this.getCluster();
-    this.PollData.statistics();
     this.TreeDataPool.readonly = false;
 
     //  this.TreeDataPool.readonly = true;
@@ -132,7 +131,6 @@
     this.TreeDataPool.multiple = false;
     this.TreeDataPool.selectedNode = "";
     this.selectedNodes = [];
-    this.VideoManageData.init();
   },
   beforeDestroy() {
     clearInterval(this.intervalTimer);
@@ -148,12 +146,6 @@
       });
       this.TreeDataPool.clean();
     });
-
-    let _this = this;
-    _this.PollData.statisticTaskInfo();
-    this.intervalTimer = setInterval(() => {
-      _this.PollData.statisticTaskInfo();
-    }, 10000);
   },
   methods: {
     handAddDevice(node) {
@@ -190,8 +182,8 @@
     },
     async getCluster() {
       const res = await getClusterDevList();
-      console.log(res);
       if (res && res.success) {
+        this.clusterData = res.data.clusterList;
         res.data.clusterList.forEach((item) => {
           this.clusterArr.push({
             label: item.cluster_name,
@@ -207,20 +199,30 @@
         });
 
         this.cluster = this.clusterArr[0].value;
+        this.selectCluster(this.clusterArr[0].value);
       }
     },
     selectCluster(val) {
       const arr = val.split("$$");
-      console.log(arr);
       if (arr[0] == "0") {
-        this.TreeDataPool.clusterId = arr[1];
-        this.TreeDataPool.devId = "";
+        sessionStorage.setItem("clusterId", arr[1]);
+        sessionStorage.setItem("devId", "");
+        console.log(this.clusterData);
+        this.clusterData.forEach((item) => {
+          if (arr[1] == item.cluster_id) {
+            sessionStorage.setItem("nodeId", item.nodeList[0].devId);
+          }
+        });
       }
       if (arr[0] == "1") {
-        this.TreeDataPool.devId = arr[1];
-        this.TreeDataPool.clusterId = "";
+        sessionStorage.setItem("clusterId", "");
+        sessionStorage.setItem("devId", arr[1]);
+        sessionStorage.setItem("nodeId", arr[1]);
       }
       this.TreeDataPool.fetchTreeData();
+      this.PollData.statisticTaskInfo();
+      this.VideoManageData.init();
+      this.PollData.statistics();
     },
   },
 };

--
Gitblit v1.8.0