From d889eaf990af99c06970e51f2bc421ac0015489c Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期四, 05 五月 2022 13:30:31 +0800
Subject: [PATCH] bug修复

---
 src/views/equipmentManagement/equipmentList/components/FormList.vue |  116 +++++++++++++++++++++++++++++----------------------------
 1 files changed, 59 insertions(+), 57 deletions(-)

diff --git a/src/views/equipmentManagement/equipmentList/components/FormList.vue b/src/views/equipmentManagement/equipmentList/components/FormList.vue
index 347be27..d643815 100644
--- a/src/views/equipmentManagement/equipmentList/components/FormList.vue
+++ b/src/views/equipmentManagement/equipmentList/components/FormList.vue
@@ -114,14 +114,14 @@
         <el-table-column label="鎿嶄綔" min-width="180">
           <template slot-scope="scope">
             <!-- 鍔犲叆 -->
-            <span class="iconfont option" @click="joinCluster(scope.row)"
+            <span
+              class="iconfont option"
+              @click="joinCluster(scope.row)"
+              v-if="scope.row.clusterId"
               >&#xe640;</span
             >
             <!-- 閫�鍑� -->
-            <span
-              class="iconfont option"
-              @click="quitCluster(scope.row)"
-              v-if="false"
+            <span class="iconfont option" @click="quitCluster(scope.row)" v-else
               >&#xe63c;</span
             >
             <!-- 绠楁硶璇︽儏 -->
@@ -181,17 +181,23 @@
 </template>
 
 <script>
-import { findDevList } from "@/api/device";
+import { findDevList, findClustersBySearch } from "@/api/device";
 import AddBox from "@/views/equipmentManagement/equipmentList/components/AddBox";
 import UnbindBox from "@/views/equipmentManagement/equipmentDetail/components/UnbindBox";
 import QuitClusterBox from "@/views/equipmentManagement/equipmentList/components/QuitClusterBox";
 import JoinClusterBox from "@/views/equipmentManagement/equipmentList/components/JoinClusterBox";
+
+import bus from "@/plugin/bus";
+
 export default {
   components: {
     AddBox,
     UnbindBox,
     QuitClusterBox,
     JoinClusterBox,
+  },
+  created() {
+    this.getCluster();
   },
   data() {
     return {
@@ -207,16 +213,7 @@
       isShowAdd: false, //鏄惁灞曠ず鏂板寮圭獥
       isShowUnbind: false, //鏄惁灞曠ず瑙g粦寮圭獥
       unbindId: "",
-      clusterArr: [
-        {
-          value: 0,
-          label: "闆嗙兢1",
-        },
-        {
-          value: 1,
-          label: "闆嗙兢2",
-        },
-      ], //鎵�灞為泦缇や笅鎷夋
+      clusterArr: [], //鎵�灞為泦缇や笅鎷夋
       cluster: null, //閫変腑鐨勯泦缇ょ被鍨�
       showQuit: false, //灞曠ず閫�鍑洪泦缇ょ殑寮圭獥
       showJoin: false, //灞曠ず鍔犲叆闆嗙兢鐨勫脊绐�
@@ -224,15 +221,29 @@
     };
   },
   methods: {
+    async getCluster() {
+      const res = await findClustersBySearch({
+        InputText: "",
+        Page: 1,
+        Size: 10000,
+        userId: JSON.parse(sessionStorage.getItem("userInfo")).id,
+      });
+      if (res && res.success) {
+        res.data.list.forEach((item) => {
+          this.clusterArr.push({
+            label: item.clusterName,
+            value: item.clusterId,
+          });
+        });
+      }
+    },
+
     // 璺冲埌璁惧璇︽儏
     checkDetail(row) {
       this.$router.push({
         path: "/equipmentDetail",
         query: {
           id: row.devId,
-          ip: row.devIp,
-          port: row.serverPort,
-          ndid: row.id,
         },
       });
     },
@@ -243,8 +254,6 @@
         path: "/algorithmDetail",
         query: {
           id: row.devId,
-          ip: row.devIp,
-          port: row.serverPort,
         },
       });
     },
@@ -254,15 +263,15 @@
       let param = {
         page: this.page,
         size: this.size,
-        // startTime: this.searchTime[0],
-        // endTime: this.searchTime[1],
+        startTime: this.searchTime[0],
+        endTime: this.searchTime[1],
+        clusterId: this.cluster,
         inputText: this.inputText,
       };
       findDevList(param)
         .then((res) => {
           this.dataList = res.data.list;
           //鏃堕棿鍒嗚鏄剧ず
-
           this.dataList.forEach((item) => {
             item.installTime = item.installTime.split(" ");
             item.firstUseTime = item.firstUseTime.split(" ");
@@ -271,6 +280,8 @@
           if (res.data.total <= this.size) {
             this.page = 1;
           }
+
+          bus.$emit("refleshNode", this.dataList);
         })
         .catch((err) => {
           console.log(err);
@@ -290,40 +301,8 @@
 
     //瑙g粦鎸夐挳
     Untying(row) {
-      console.log(row);
-      this.unbindId = row.id;
+      this.unbindId = row.devId;
       this.isShowUnbind = true;
-      /*  this.$confirm(
-        "瑙g粦鍚庤璁惧灏嗕粠璁惧鍒楄〃涓Щ闄わ紝鏄惁纭鎿嶄綔?",
-        "瑙g粦鎻愮ず",
-        {
-          type: "warning",
-          center: true,
-        }
-      )
-        .then(() => {
-          unbind({ ids: [row.id] })
-            .then(() => {
-              this.$notify({
-                type: "success",
-                message: "瑙g粦鎴愬姛",
-                duration: 2500,
-                offset: 57,
-              });
-              this.searchingBtn();
-            })
-            .catch(() => {
-              this.$notify({
-                type: "error",
-                message: "瑙g粦澶辫触锛岃鑱旂郴瀹㈡湇",
-                duration: 2500,
-                offset: 57,
-              });
-            });
-        })
-        .catch((e) => {
-          console.log(e);
-        }); */
     },
 
     //鑾峰緱榛樿鏃堕棿
@@ -347,6 +326,7 @@
     //鍏抽棴鏂板寮圭獥
     closeAddBox() {
       this.isShowAdd = false;
+      this.searchingBtn();
     },
     // 鍏抽棴瑙g粦寮圭獥
     closeUnbindBox() {
@@ -355,6 +335,7 @@
 
     //瑙g粦鎴愬姛鍥炶皟
     reflash() {
+      console.log("1111");
       this.isShowUnbind = false;
       this.searchingBtn();
     },
@@ -392,6 +373,7 @@
     padding: 60px 0 30px 0;
     font-size: 14px;
     border-bottom: 1px solid #e9ebee;
+    background-color: #fff;
 
     .left,
     .right,
@@ -402,6 +384,26 @@
       align-items: center;
     }
 
+    .cluster {
+      .el-select {
+        width: 200px;
+        height: 40px;
+        line-height: 40px;
+
+        ::v-deep input {
+          height: 40px;
+        }
+
+        .el-icon-arrow-up {
+          line-height: 40px;
+        }
+
+        ::v-deep .el-icon-arrow-up {
+          height: 40px;
+        }
+      }
+    }
+
     .id .el-input ::v-deep {
       width: 180px;
     }

--
Gitblit v1.8.0