From f14f98a263141d2f8ec0079866a758cc7a1c38d1 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期一, 22 八月 2022 03:20:29 +0800
Subject: [PATCH] 添加用户删除功能

---
 src/views/search/index.vue |  120 +++++++++++++++++++++++++++---------------------------------
 1 files changed, 54 insertions(+), 66 deletions(-)

diff --git a/src/views/search/index.vue b/src/views/search/index.vue
index 756f2f8..9685086 100644
--- a/src/views/search/index.vue
+++ b/src/views/search/index.vue
@@ -1,18 +1,8 @@
 <template>
   <div class="column">
     <div class="search_cluster">
-      <el-select
-        v-model="cluster"
-        placeholder="璇烽�夋嫨闆嗙兢"
-        @change="selectCluster"
-      >
-        <el-option
-          v-for="item in clusterArr"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value"
-        >
-        </el-option>
+      <el-select v-model="cluster" placeholder="璇烽�夋嫨闆嗙兢" @change="selectCluster">
+        <el-option v-for="item in clusterArr" :key="item.value" :label="item.label" :value="item.value"> </el-option>
       </el-select>
     </div>
     <div class="column-left">
@@ -30,109 +20,108 @@
 </template>
 
 <script>
-import LeftNav from "@/components/CameraLeft";
-import RightSide from "./Searching";
-import CardWindow from "./components/CardWindow";
-import { getClusterDevList } from "@/api/clusterManage";
+import LeftNav from "@/components/CameraLeft"
+import RightSide from "./Searching"
+import CardWindow from "./components/CardWindow"
+import { getClusterDevList } from "@/api/clusterManage"
 
 export default {
   name: "SearchPage",
   components: {
     LeftNav,
     RightSide,
-    CardWindow,
+    CardWindow
   },
   data() {
     return {
       screenHeight: 0,
       clusterArr: [],
-      cluster: "",
-    };
+      cluster: ""
+    }
   },
   created() {
     // this.parseUrl();
-    this.getCluster();
+    this.getCluster()
   },
   mounted() {
-    this.screenHeight = document.documentElement.clientHeight - 20;
+    this.screenHeight = document.documentElement.clientHeight - 20
     window.onresize = () => {
       return (() => {
-        this.screenHeight = document.documentElement.clientHeight - 20;
-      })();
-    };
+        this.screenHeight = document.documentElement.clientHeight - 20
+      })()
+    }
+  },
+  beforeDestroy() {
+    sessionStorage.removeItem("clusterId")
+    sessionStorage.removeItem("devId")
   },
   methods: {
     parseUrl() {},
     selectCluster(val) {
-      const arr = val.split("$$");
+      const arr = val.split("$$")
       if (arr[0] == "0") {
-        sessionStorage.setItem("clusterId", arr[1]);
-        sessionStorage.setItem("devId", "");
-        console.log(this.clusterData);
+        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);
+            sessionStorage.setItem("nodeId", item.nodeList[0].devId)
           }
-        });
+        })
       }
       if (arr[0] == "1") {
-        sessionStorage.setItem("clusterId", "");
-        sessionStorage.setItem("devId", arr[1]);
-        sessionStorage.setItem("nodeId", arr[1]);
+        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();
+      this.TreeDataPool.fetchTreeData()
+      this.PollData.statisticTaskInfo()
+      this.VideoManageData.init()
+      this.PollData.statistics()
     },
     async getCluster() {
-      const res = await getClusterDevList();
+      const res = await getClusterDevList()
       if (res && res.success) {
-        this.clusterData = res.data.clusterList;
+        this.clusterData = res.data.clusterList
         if (res.data.clusterList <= 0 && res.data.devList <= 0) {
-          this.$confirm(
-            "绯荤粺妫�娴嬪埌鎮ㄨ繕鏈坊鍔犺澶�, 璇峰湪璁惧绠$悊椤甸潰缁存姢",
-            "鎻愮ず",
-            {
-              confirmButtonText: "璺宠浆",
-              cancelButtonText: "鍙栨秷",
-              type: "warning",
-            }
-          )
+          this.$confirm("绯荤粺妫�娴嬪埌鎮ㄨ繕鏈坊鍔犺澶�, 璇峰湪璁惧绠$悊椤甸潰缁存姢", "鎻愮ず", {
+            confirmButtonText: "璺宠浆",
+            cancelButtonText: "鍙栨秷",
+            type: "warning"
+          })
             .then(() => {
-              this.$router.push("/manageCenter");
+              this.$router.push("/manageCenter")
             })
-            .catch(() => {});
+            .catch(() => {})
         }
 
         res.data.clusterList.forEach((item) => {
           this.clusterArr.push({
             label: item.cluster_name,
-            value: "0$$" + item.cluster_id,
-          });
-        });
+            value: "0$$" + item.cluster_id
+          })
+        })
 
         res.data.devList.forEach((item) => {
           this.clusterArr.push({
             label: item.devName,
-            value: "1$$" + item.devId,
-          });
-        });
+            value: "1$$" + item.devId
+          })
+        })
 
-        this.cluster = this.clusterArr[0].value;
-        this.selectCluster(this.clusterArr[0].value);
+        this.cluster = this.clusterArr[0].value
+        this.selectCluster(this.clusterArr[0].value)
       }
-    },
-  },
-};
+    }
+  }
+}
 </script>
 
-<style lang="scss" >
+<style lang="scss" scoped>
 .left-tree-box .local-vedio-area .dev-vedio-list {
   height: calc(100vh - 130px);
 }
 .left-tree-box .el-tabs--border-card .el-tabs__header {
-  display: block;
   margin-bottom: 10px;
 }
 .column {
@@ -187,7 +176,6 @@
   bottom: 0;
   border-right: 2px solid #efefef;
   border-left: 1px solid #e0e0e0;
-  pointer-events: none;
 }
 .resize-bar:hover ~ .resize-line,
 .resize-bar:active ~ .resize-line {
@@ -199,11 +187,11 @@
 }
 
 .search_cluster {
-  top: 12px;
+  top: 18px;
   left: 172px;
   position: fixed;
   width: 135px;
-  z-index: 4;
+  z-index: -1;
 }
 
 /* Firefox鍙湁涓嬮潰涓�灏忓潡鍖哄煙鍙互鎷変几 */

--
Gitblit v1.8.0