From f20a554bdb24e9dfde9dc6a69d78595944f61d15 Mon Sep 17 00:00:00 2001
From: mark <mark18340872469@163.com>
Date: 星期二, 25 十月 2022 14:53:57 +0800
Subject: [PATCH] 设备管理 样式调整

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

diff --git a/src/views/hashrate/CameraManage/index.vue b/src/views/hashrate/CameraManage/index.vue
index 9fba6ac..b738df9 100644
--- a/src/views/hashrate/CameraManage/index.vue
+++ b/src/views/hashrate/CameraManage/index.vue
@@ -79,28 +79,43 @@
 
   watch: {
     "TreeDataPool.activeNode": function (node) {
-      console.log("cclickaaa");
+      sessionStorage.setItem("cameraDevId", node.devId);
       if (this.activeTab == "淇℃伅缁存姢") {
         if (this.TreeDataPool.treeActiveName == "camera") {
           this.$refs.cameraInfo.selectCamera(node);
         }
       } 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);
         }
       },
@@ -133,6 +148,8 @@
     this.selectedNodes = [];
   },
   beforeDestroy() {
+    sessionStorage.removeItem("devId");
+    sessionStorage.removeItem("clusterId");
     clearInterval(this.intervalTimer);
     //this.TreeDataPool.treeActiveName = "camera";
   },
@@ -175,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);
         }
@@ -184,6 +202,22 @@
       const res = await getClusterDevList();
       if (res && res.success) {
         this.clusterData = res.data.clusterList;
+        if (res.data.clusterList <= 0 && res.data.devList <= 0) {
+          this.$confirm(
+            "绯荤粺妫�娴嬪埌鎮ㄨ繕鏈坊鍔犺澶�, 璇峰湪璁惧绠$悊椤甸潰缁存姢",
+            "鎻愮ず",
+            {
+              confirmButtonText: "璺宠浆",
+              cancelButtonText: "鍙栨秷",
+              type: "warning",
+            }
+          )
+            .then(() => {
+              this.$router.push("/manageCenter");
+            })
+            .catch(() => {});
+        }
+
         res.data.clusterList.forEach((item) => {
           this.clusterArr.push({
             label: item.cluster_name,

--
Gitblit v1.8.0