From 52ad37fba37a1ae72f124106627227a09836be5b Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期五, 25 三月 2022 15:36:31 +0800
Subject: [PATCH] 初稿

---
 src/views/hashrate/CameraManage/index.vue |  103 ++++++++++++++-------------------------------------
 1 files changed, 28 insertions(+), 75 deletions(-)

diff --git a/src/views/hashrate/components/CameraManage.vue b/src/views/hashrate/CameraManage/index.vue
similarity index 64%
rename from src/views/hashrate/components/CameraManage.vue
rename to src/views/hashrate/CameraManage/index.vue
index 397955c..8d6b11b 100644
--- a/src/views/hashrate/components/CameraManage.vue
+++ b/src/views/hashrate/CameraManage/index.vue
@@ -19,14 +19,14 @@
           <div
             class="tab"
             :class="{ active: activeTab === '淇℃伅缁存姢' }"
-            @click="activeTab = '淇℃伅缁存姢'"
+            @click="handleClick('淇℃伅缁存姢')"
           >
             淇℃伅缁存姢
           </div>
           <div
             class="tab"
             :class="{ active: activeTab === '鍦烘櫙閰嶇疆' }"
-            @click="activeTab = '鍦烘櫙閰嶇疆'"
+            @click="handleClick('鍦烘櫙閰嶇疆')"
           >
             鍦烘櫙閰嶇疆
           </div>
@@ -34,22 +34,28 @@
 
         <CameraInfo
           ref="cameraInfo"
-          v-if="activeTab === '淇℃伅缁存姢'"
+          v-show="activeTab === '淇℃伅缁存姢'"
         ></CameraInfo>
+        <CameraRules
+          v-show="activeTab === '鍦烘櫙閰嶇疆'"
+          ref="sepRule"
+        ></CameraRules>
       </div>
     </div>
   </div>
 </template>
 
 <script>
-import CameraLeft from "@/views/hashrate/components/CameraLeft";
-import CameraInfo from "@/views/hashrate/components/CameraInfo";
+import CameraLeft from "@/components/CameraLeft";
+import CameraInfo from "./CameraInfo";
+import CameraRules from "./CameraRules";
 
 import bus from "@/plugin/bus";
 export default {
   components: {
     CameraLeft,
     CameraInfo,
+    CameraRules,
   },
 
   data() {
@@ -66,58 +72,30 @@
         },
       ],
       cluster: "",
-      activeName: "camera-info",
-      buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [],
       intervalTimer: null,
       leftWith: 0,
       screenHeight: 0,
     };
   },
+
   destroyed() {
     this.TreeDataPool.readonly = true;
   },
-  computed: {
-    isAdmin() {
-      if (
-        sessionStorage.getItem("userInfo") &&
-        sessionStorage.getItem("userInfo") !== ""
-      ) {
-        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
-        return loginName === "superadmin" || loginName === "basic";
-      }
 
-      return false;
-    },
-    firstLabeName() {
-      return this.TreeDataPool.treeActiveName === "camera"
-        ? "鎽勫儚鏈轰俊鎭�"
-        : "鏁版嵁鏍堜俊鎭�";
-    },
-  },
   watch: {
-    // 鏁版嵁鏍堜笉鏄剧ず鑱斿姩瑙勫垯锛岄槻姝㈠湪閫変腑鑱斿姩瑙勫垯tab涓垏鎹㈠埌鏁版嵁鏍�
-    "TreeDataPool.treeActiveName": function (val) {
-      if (val === "dataStack" && this.activeName === "linkage-rule") {
-        this.activeName = "camera-info";
-      }
-    },
     "TreeDataPool.selectedNode": function (node) {
-      console.log("00000000000000");
-      if (this.activeName == "camera-info") {
-        console.log("111111111111111");
+      if (this.activeTab == "淇℃伅缁存姢") {
         if (this.TreeDataPool.treeActiveName == "camera") {
-          console.log("2222222222222");
           this.$refs.cameraInfo.selectCamera(node);
         }
-      } else if (this.activeName === "separate-rule") {
-        this.$refs.sepRule.Camera = {};
+      } else if (this.activeTab === "鍦烘櫙閰嶇疆") {
         this.$refs.sepRule.initCameraData(node.id);
       }
     },
     "TreeDataPool.selectedNodes": {
       handler(nodes) {
-        if (this.activeName == "linkage-rule") {
-          this.$refs.linkRule.initCameraData();
+        if (this.activeTab == "鍦烘櫙閰嶇疆") {
+          // this.$refs.sepRule.initCameraData();
         }
       },
       deep: true,
@@ -128,9 +106,9 @@
           return;
         }
         this.$nextTick(() => {
-          if (this.activeName == "camera-info") {
-            this.$refs.dataStackInfo.selectDir(node);
-          } else if (this.activeName == "separate-rule" && node.length !== 0) {
+          if (this.activeTab == "淇℃伅缁存姢") {
+            //   this.$refs.dataStackInfo.selectDir(node);
+          } else if (this.activeTab == "鍦烘櫙閰嶇疆" && node.length !== 0) {
             this.$refs.sepRule.initCameraData(node.id);
           }
         });
@@ -141,22 +119,6 @@
   created() {
     this.PollData.statistics();
     this.TreeDataPool.readonly = false;
-
-    if (this.TreeDataPool.treeActiveName == "camera") {
-      if (this.isShow("cameraAccess:cameraInfo")) {
-        this.activeName = "camera-info";
-      } else if (this.isShow("cameraAccess:selfRule")) {
-        this.activeName = "separate-rule";
-      } else if (this.isShow("cameraAccess:linkRule")) {
-        this.activeName = "linkage-rule";
-      }
-    } else {
-      if (this.isShow("dataStack:cameraInfo")) {
-        this.activeName = "camera-info";
-      } else if (this.isShow("dataStack:selfRule")) {
-        this.activeName = "separate-rule";
-      }
-    }
 
     //  this.TreeDataPool.readonly = true;
     //this.TreeDataPool.gbReadonly = true;
@@ -187,46 +149,36 @@
     }, 10000);
   },
   methods: {
-    isShow(authority) {
-      return (
-        this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1
-      );
-    },
     handAddDevice(node) {
       let _this = this;
       setTimeout(() => {
         _this.$refs.cameraInfo.addDevice(node);
-        _this.activeName = "camera-info";
+        _this.activeTab = "淇℃伅缁存姢";
       }, 100);
     },
     handAddDIr(node) {
       let _this = this;
       setTimeout(() => {
         _this.$refs.dataStackInfo.addDir(node);
-        _this.activeName = "camera-info";
+        _this.activeTab = "淇℃伅缁存姢";
       }, 100);
     },
-    handleClick(tab, event) {
-      console.log(this.TreeDataPool);
-      this.TreeDataPool.multiple = tab.name === "linkage-rule";
-      if (tab.name === "camera-info") {
+    handleClick(tab) {
+      //杩欎釜鎺у埗鏄惁澶氶��
+      //    this.TreeDataPool.multiple = tab.name === "鍦烘櫙閰嶇疆";
+      this.activeTab = tab;
+      if (tab === "淇℃伅缁存姢") {
         if (this.TreeDataPool.treeActiveName == "camera") {
           this.$refs.cameraInfo.selectCamera(this.TreeDataPool.selectedNode);
         } else if (this.TreeDataPool.treeActiveName == "dataStack") {
           this.$refs.dataStackInfo.selectDir(this.DataStackPool.selectedDir);
         }
-      } else if (tab.name === "separate-rule") {
+      } else if (tab === "鍦烘櫙閰嶇疆") {
         if (this.TreeDataPool.treeActiveName == "camera") {
           this.$refs.sepRule.initCameraData(this.TreeDataPool.selectedNode.id);
         } else if (this.TreeDataPool.treeActiveName == "dataStack") {
           this.$refs.sepRule.initCameraData(this.DataStackPool.selectedDir.id);
         }
-      } else if (this.activeName == "linkage-rule") {
-        this.$refs.linkRule.initCameraData();
-      } else if (this.activeName == "poll-setting") {
-        this.$nextTick(() => {
-          this.$refs.pullSetting.initLineChart();
-        });
       }
     },
   },
@@ -279,6 +231,7 @@
   }
 
   .content {
+    box-sizing: border-box;
     margin-bottom: 60px;
     display: flex;
     align-items: stretch;

--
Gitblit v1.8.0