From a689af1348938afd3b4506aad9b6d5057193e25d Mon Sep 17 00:00:00 2001
From: ZZJ <10913410+zzj2100@user.noreply.gitee.com>
Date: 星期五, 27 五月 2022 09:59:00 +0800
Subject: [PATCH] bug修复

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

diff --git a/src/views/hashrate/CameraManage/index.vue b/src/views/hashrate/CameraManage/index.vue
index 9396978..ce7ff42 100644
--- a/src/views/hashrate/CameraManage/index.vue
+++ b/src/views/hashrate/CameraManage/index.vue
@@ -86,21 +86,36 @@
         }
       } else if (this.activeTab === "鍦烘櫙閰嶇疆") {
         this.$refs.sepRule.initCameraData(node.id);
+        if (!this.TreeDataPool.multiple) {
+          this.$refs.sepRule.showRules(node.id);
+        }
       }
     },
     "TreeDataPool.selectedNodes": {
-      handler(nodes) {
+      handler(nodes, oldVal) {
         if (this.activeTab == "鍦烘櫙閰嶇疆") {
-          console.log(this.TreeDataPool.multiple);
           //  this.$refs.sepRule.initCameraData(nodes[nodes.length - 1]);
           let CameraArr = [];
+          let CameraIds = [];
 
           nodes.forEach((id) => {
             let newCamera = new VideoRuleData(id);
             CameraArr.push(newCamera);
+            CameraIds.push(id);
           });
 
           this.$refs.sepRule.Carmeras = CameraArr;
+          if (
+            nodes.length == 1 &&
+            oldVal.length == 1 &&
+            nodes[0] == oldVal[0]
+          ) {
+            return;
+          }
+          if (this.TreeDataPool.multiple && oldVal[0]) {
+            this.$refs.sepRule.showRules(CameraIds);
+          }
+
           console.log(CameraArr);
         }
       },
@@ -123,7 +138,6 @@
     },
   },
   created() {
-    console.log("------------");
     this.getCluster();
     this.TreeDataPool.readonly = false;
 
@@ -178,6 +192,7 @@
       } else if (tab === "鍦烘櫙閰嶇疆") {
         if (this.TreeDataPool.treeActiveName == "camera") {
           this.$refs.sepRule.initCameraData(this.TreeDataPool.selectedNode.id);
+          this.$refs.sepRule.showRules(this.TreeDataPool.selectedNode.id);
         } else if (this.TreeDataPool.treeActiveName == "dataStack") {
           this.$refs.sepRule.initCameraData(this.DataStackPool.selectedDir.id);
         }

--
Gitblit v1.8.0