From 45faaf27722588e92050e2e3eace9b3704377048 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期六, 02 四月 2022 18:44:30 +0800
Subject: [PATCH] 首页接口

---
 src/views/hashrate/CameraManage/index.vue |   50 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/src/views/hashrate/CameraManage/index.vue b/src/views/hashrate/CameraManage/index.vue
index 61cc152..c8ab02e 100644
--- a/src/views/hashrate/CameraManage/index.vue
+++ b/src/views/hashrate/CameraManage/index.vue
@@ -2,7 +2,7 @@
   <div class="CameraManage">
     <div class="cluster">
       <div class="title">闆嗙兢閫夋嫨</div>
-      <el-select v-model="cluster" placeholder="璇烽�夋嫨">
+      <el-select v-model="cluster" placeholder="璇烽�夋嫨" @change="selectCluster">
         <el-option
           v-for="item in clusterArr"
           :key="item.value"
@@ -51,6 +51,8 @@
 import CameraRules from "./CameraRules";
 import VideoRuleData from "@/Pool/VideoRuleData";
 
+import { getClusterDevList } from "@/api/clusterManage";
+
 import bus from "@/plugin/bus";
 export default {
   components: {
@@ -62,16 +64,7 @@
   data() {
     return {
       activeTab: "淇℃伅缁存姢",
-      clusterArr: [
-        {
-          value: 0,
-          label: "闆嗙兢涓�",
-        },
-        {
-          value: 1,
-          label: "闆嗙兢浜�",
-        },
-      ],
+      clusterArr: [],
       cluster: "",
       intervalTimer: null,
       leftWith: 0,
@@ -130,6 +123,7 @@
     },
   },
   created() {
+    this.getCluster();
     this.PollData.statistics();
     this.TreeDataPool.readonly = false;
 
@@ -194,6 +188,40 @@
         }
       }
     },
+    async getCluster() {
+      const res = await getClusterDevList();
+      console.log(res);
+      if (res && res.success) {
+        res.data.clusterList.forEach((item) => {
+          this.clusterArr.push({
+            label: item.cluster_name,
+            value: "0$$" + item.cluster_id,
+          });
+        });
+
+        res.data.devList.forEach((item) => {
+          this.clusterArr.push({
+            label: item.devName,
+            value: "1$$" + item.devId,
+          });
+        });
+
+        this.cluster = 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 = "";
+      }
+      if (arr[0] == "1") {
+        this.TreeDataPool.devId = arr[1];
+        this.TreeDataPool.clusterId = "";
+      }
+      this.TreeDataPool.fetchTreeData();
+    },
   },
 };
 </script>

--
Gitblit v1.8.0