From 0daac085e308ab5dd5557048bbcb28473ae1b7df Mon Sep 17 00:00:00 2001
From: ZZJ <10913410+zzj2100@user.noreply.gitee.com>
Date: 星期三, 27 七月 2022 17:13:32 +0800
Subject: [PATCH] gb18186

---
 src/views/GB28181/components/DevList.vue |  122 +++++++++++++++++++---------------------
 1 files changed, 57 insertions(+), 65 deletions(-)

diff --git a/src/views/GB28181/components/DevList.vue b/src/views/GB28181/components/DevList.vue
index 396f565..83ae5ea 100644
--- a/src/views/GB28181/components/DevList.vue
+++ b/src/views/GB28181/components/DevList.vue
@@ -4,25 +4,45 @@
     <div class="empty" v-if="devList.length === 0">
       <img src="/images/search/1.png" alt="" />
       <div class="des">鎮ㄨ繕鏈坊鍔犻泦缇ゆ垨璁惧锛岃鍦ㄨ澶囩鐞嗕腑娣诲姞</div>
-      <div class="button add">绔嬪嵆娣诲姞</div>
+      <div class="button add" @click="$router.push('/equipmentList')">
+        绔嬪嵆娣诲姞
+      </div>
     </div>
     <div class="list scroll">
-      <div class="devItem" v-for="(item, index) in devList" :key="index">
+      <div class="devItem" v-for="(item, index) in clusterList" :key="index">
         <div class="mainInfo">
-          <img
-            v-if="item.type == 1"
-            src="/images/hashrate/cluster.png"
-            alt=""
-          />
-          <img v-else src="/images/hashrate/equipment.png" alt="" />
+          <img src="/images/hashrate/cluster.png" alt="" />
 
           <div class="right">
-            <div class="name">闆嗙兢123</div>
-            <div class="ip">192.168.1.1</div>
-            <div class="number">璁惧鎬婚噺:7</div>
+            <div class="name">{{ item.cluster_name }}</div>
+            <div class="ip">{{ item.virtual_ip }}</div>
+            <div class="number">璁惧鎬婚噺:{{ item.nodeNum }}</div>
           </div>
 
-          <div class="button set" @click="showSettingBox = true">閰嶇疆</div>
+          <div
+            class="button set"
+            @click="setting({ clusterId: item.cluster_id }, item.nodeList)"
+          >
+            閰嶇疆
+          </div>
+        </div>
+      </div>
+      <div
+        class="devItem"
+        v-for="(item, index) in devList"
+        :key="index + 'dev'"
+      >
+        <div class="mainInfo">
+          <img src="/images/hashrate/equipment.png" alt="" />
+
+          <div class="right">
+            <div class="name">{{ item.devName }}</div>
+            <div class="ip">{{ item.devIp }}</div>
+          </div>
+
+          <div class="button set" @click="setting({ devId: item.devId })">
+            閰嶇疆
+          </div>
         </div>
       </div>
     </div>
@@ -30,73 +50,45 @@
     <SettingBox
       v-if="showSettingBox"
       @close="showSettingBox = false"
+      :id="idObj"
+      :nodeList="nodeList"
     ></SettingBox>
   </div>
 </template>
 
 <script>
 import SettingBox from "@/views/GB28181/components/SettingBox";
+import { getClusterDevList } from "@/api/clusterManage";
 
 export default {
   components: {
     SettingBox,
   },
+  created() {
+    this.getClusterDevList();
+  },
   data() {
     return {
-      devList: [
-        {
-          type: 1,
-        },
-        {
-          type: 1,
-        },
-
-        {
-          type: 1,
-        },
-        {
-          type: 1,
-        },
-        {
-          type: 1,
-        },
-        {
-          type: 1,
-        },
-
-        {
-          type: 1,
-        },
-        {
-          type: 1,
-        },
-        {
-          type: 1,
-        },
-        {
-          type: 1,
-        },
-        {
-          type: 1,
-        },
-        {
-          type: 1,
-        },
-        {
-          type: 1,
-        },
-        {
-          type: 1,
-        },
-        {
-          type: 0,
-        },
-        {
-          type: 0,
-        },
-      ],
+      clusterList: [],
+      devList: [],
       showSettingBox: false,
+      idObj: {},
+      nodeList: [],
     };
+  },
+  methods: {
+    async getClusterDevList() {
+      const res = await getClusterDevList();
+      if (res && res.success) {
+        this.clusterList = res.data.clusterList;
+        this.devList = res.data.devList;
+      }
+    },
+    setting(id, nodeList) {
+      this.idObj = id;
+      this.nodeList = nodeList ? nodeList : [];
+      this.showSettingBox = true;
+    },
   },
 };
 </script>
@@ -213,4 +205,4 @@
     }
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0