From dc14fbf78c19bbe343a79547260ead1e4bd9d24e Mon Sep 17 00:00:00 2001
From: hanbaoshan <hanbaoshan@aiotlink.com>
Date: 星期三, 21 十月 2020 20:18:57 +0800
Subject: [PATCH] 集群管理,统计查询(集群)更新

---
 src/pages/ai/index/App.vue                          |    2 
 src/pages/settings/components/ClusterManagement.vue |  327 ++++++++++++++++++++++++++--------------------
 src/pages/searchForCluster/index/Searching.vue      |    5 
 public/index.html                                   |   14 ++
 src/components/LeftNav.vue                          |   15 ++
 src/Pool/TreeData.ts                                |   13 +
 src/components/serfDiagram/index.vue                |   26 +++
 src/components/subComponents/ModelCard.vue          |   11 
 src/Pool/VideoPhotoData.ts                          |    4 
 9 files changed, 259 insertions(+), 158 deletions(-)

diff --git a/public/index.html b/public/index.html
index 577320a..fac9533 100644
--- a/public/index.html
+++ b/public/index.html
@@ -354,6 +354,20 @@
     .el-input.is-disabled .el-input__suffix{
       visibility: hidden;
     }
+    .form-tip{
+      color: #999;
+      position: relative;
+      text-align: left;
+      padding-left: 10px;
+    }
+    .form-tip:before{
+      content:'*';
+      position: absolute;
+      top: 0;
+      left: 0;
+      color: #f90;
+      font-size: 14px;
+    }
     </style>
 
   </head>
diff --git a/src/Pool/TreeData.ts b/src/Pool/TreeData.ts
index 2008d98..02a52ec 100644
--- a/src/Pool/TreeData.ts
+++ b/src/Pool/TreeData.ts
@@ -31,6 +31,7 @@
   public readonly: boolean;
   public gbReadonly: boolean;
   public multiple: boolean;
+  public searchFrom: string = '';
   public showTreeBox: boolean;
   public selectedNodes: Array<string>;
   public selectedNode: any;
@@ -295,10 +296,16 @@
   }
 
   async fetchLocalTree() {
-    const rsp: any = await getLocalCameraTree({
+    let params:any = {
       searchType: this.searchCamType,
-      cameraName: this.searchInput
-    });
+      cameraName: this.searchInput,
+      //isPlatform: 1
+    };
+    debugger
+    if(this.searchFrom == 'cluster'){
+      params.isPlatform = 1
+    }
+    const rsp: any = await getLocalCameraTree(params);
 
     if (rsp && rsp.success) {
       this.treeData = rsp.data ? rsp.data : []
diff --git a/src/Pool/VideoPhotoData.ts b/src/Pool/VideoPhotoData.ts
index df9742e..cee90c3 100644
--- a/src/Pool/VideoPhotoData.ts
+++ b/src/Pool/VideoPhotoData.ts
@@ -8,7 +8,7 @@
   addToBase
 } from "@/api/search";
 export default class VideoPhotoData {
-  public searchForm: string = 'search';
+  public searchFrom: string = 'search';
   public preCards: Array<object> = [];
   public cards: Array<object> = [];
   public persons: Array<object> = [];
@@ -84,7 +84,7 @@
       tasks: this.queryTasks,
       treeNodes: this.treeNodes
     }
-    if(this.searchForm == 'cluster'){
+    if(this.searchFrom == 'cluster'){
       param.isAll = true
     }
     const rsp: any = await getSearchList(param);
diff --git a/src/components/LeftNav.vue b/src/components/LeftNav.vue
index 94dbe0d..421a4e1 100644
--- a/src/components/LeftNav.vue
+++ b/src/components/LeftNav.vue
@@ -190,6 +190,10 @@
                 </el-input>
               </div>
             </div>
+            <div class="top-menu" style="margin:0 0 10px;text-align:left;">
+              <span class="iconfont iconjiqun" style="font-size:20px;"></span>
+              <span style="font-size:14px; margin-left: 5px;font-weight: 600;">{{clusterName}}</span>
+            </div>
             <div class="cluster-list">
               <tree-menu
                 ref="tree"
@@ -312,6 +316,7 @@
 import LocalVedioList from '@/components/subComponents/LocalVedioList';
 import FileUpload from '@/components/subComponents/FileUpload/index';
 import XLSX from 'xlsx'
+import { findCluster } from "@/api/clusterManage";
 
 export default {
   components: {
@@ -442,7 +447,8 @@
       fileUploadBox: false,
       loadingGBTree: false,
       importAreaId: "",
-      menuLoading: false
+      menuLoading: false,
+      clusterName: ''
     };
   },
   created() {
@@ -460,6 +466,13 @@
     if (this.showCluster) {
       this.TreeDataPool.treeActiveName = "cluster"
       this.TreeDataPool.fetchClusterTree();
+      findCluster().then(res => {
+        if (res.success) {
+          debugger
+          this.clusterName = res.data.clusterName;
+        }
+
+      })
     }
   },
   methods: {
diff --git a/src/components/serfDiagram/index.vue b/src/components/serfDiagram/index.vue
index b87364c..b07b2bb 100644
--- a/src/components/serfDiagram/index.vue
+++ b/src/components/serfDiagram/index.vue
@@ -41,7 +41,8 @@
       toolTipStyle: {
         display: "none",
         height: "30px",
-        width: "150px"
+        width: "186px",
+        borderColor: "#ccc"
       }
     };
   },
@@ -130,9 +131,26 @@
         this.toolTipStyle.display = "block";
         this.toolTipStyle.top = node.y - 60 + "px";
         this.toolTipStyle.left = node.x + "px";
-        console.log(this.members[node.id])
+        console.log(this.members[node.id]);
+        let workName = '';
+        switch(this.members[node.id].workType){
+          case '01':
+            workName = '鍒嗘瀽'
+            break;
+          case '02':
+            workName = '瀛樺偍'
+            break;
+          case '03':
+            workName = '鍒嗘瀽+瀛樺偍'
+            break;
+          case '04':
+            workName = '搴旂敤'
+            break;
+          default:
+            return;
+        }
         this.toolTipNode = this.members[node.id].nodeName;
-        this.toolTipAddr = this.members[node.id].Address;
+        this.toolTipAddr = `${this.members[node.id].Address}(${workName})`;
       }
 
     },
@@ -263,7 +281,7 @@
   position: absolute;
   background: #fff;
   /* border: 1px solid #127862; */
-  border: 1px solid rgba(76, 78, 78, 0.7);
+  border: 1px solid #ccc;
   font-size: 11px;
   padding-left: 5px;
 }
diff --git a/src/components/subComponents/ModelCard.vue b/src/components/subComponents/ModelCard.vue
index 061737a..53946a4 100644
--- a/src/components/subComponents/ModelCard.vue
+++ b/src/components/subComponents/ModelCard.vue
@@ -38,13 +38,13 @@
               v-if="data.targetInfo == null || data.targetInfo[0].picSmUrl == ''"
             >
               <p>
-                <span class="fontStyleForModel">{{ data.picDate | formatTime }}</span>
+                <span class="fontStyleForModel" style="font-weight:normal">{{ data.picDate | formatTime }}</span>
               </p>
               <p>
-                <span class="fontStyleForModel">{{ data.cameraAddr }}</span>
+                <span class="fontStyleForModel">{{ data.cameraAddr }}</span> <span class="fontStyleForModel" style="margin-left:20px;">{{ data.analyServerName }}</span>
               </p>
               <p>
-                <span class="fontStyleForModel">{{ data.analyServerName }}</span>
+                
               </p>
               <p style="width:100%">
                 <span v-for="(item,index) in data.alarmRules" :key="index+'rule'">
@@ -490,10 +490,9 @@
             b {
               //color: #e43933;
             }
-            width: 40%;
             text-align: left;
-            float: left;
-            margin: 4px 0px;
+            margin: 4px 0;
+            
           }
         }
         .describeBigImage {
diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue
index 5a47303..d4117c9 100644
--- a/src/pages/ai/index/App.vue
+++ b/src/pages/ai/index/App.vue
@@ -475,7 +475,7 @@
     },
     installedList () {
       return this.TaskMange.list1.filter(sdk => {
-        return sdk.installed === true;
+        return sdk.installed === true && !sdk.isUpgrade;
       });
     },
     ungradeList () {
diff --git a/src/pages/searchForCluster/index/Searching.vue b/src/pages/searchForCluster/index/Searching.vue
index 9e7012d..d498a81 100644
--- a/src/pages/searchForCluster/index/Searching.vue
+++ b/src/pages/searchForCluster/index/Searching.vue
@@ -271,7 +271,9 @@
     this.TreeDataPool.readonly = true;
     this.TreeDataPool.gbReadonly = true;
     this.TreeDataPool.multiple = true;
+    this.TreeDataPool.searchFrom = 'cluster';
     this.TreeDataPool.clean();
+    
     this.TreeDataPool.fetchTreeData();
   },
   mounted() {
@@ -297,7 +299,8 @@
     this.searchTime = this.getDateInit();
     this.VideoPhotoData.searchTime = this.getDateInit();
     //璁剧疆鎼滅储鏉ユ簮(搴旂敤鍚嶇О)
-    this.VideoPhotoData.searchForm = 'cluster';
+    this.VideoPhotoData.searchFrom = 'cluster';
+    //this.TreeDataPool.searchFrom = 'cluster';
     // 鏆傛椂鍏抽棴璺宠浆 20200730
     // if (this.$route.query.showType === "findByPic") {
     if (this.getUrlKey("showType")) {
diff --git a/src/pages/settings/components/ClusterManagement.vue b/src/pages/settings/components/ClusterManagement.vue
index 9f07655..6cb3bec 100644
--- a/src/pages/settings/components/ClusterManagement.vue
+++ b/src/pages/settings/components/ClusterManagement.vue
@@ -14,15 +14,15 @@
               <el-form-item label="闆嗙兢ID">
                 <el-input v-model="clusterid" placeholder="涓嶅厑璁歌緭鍏�,淇濆瓨鍚庡洖鏄�" disabled size="small"></el-input>
               </el-form-item>
-              <el-form-item label="闆嗙兢瀵嗙爜" prop="clusterpwd" style="width:500px">
+              <el-form-item label="闆嗙兢瀵嗙爜" prop="clusterpwd">
                 <el-input v-model="ruleForm.clusterpwd" placeholder="璇疯緭鍏�6浣嶅瘑鐮�,鎴栫偣鍑荤敓鎴�" size="small">
                   <el-button type="text" slot="suffix" @click="generatePassword">鐢熸垚瀵嗙爜</el-button>
                 </el-input>
               </el-form-item>
-              <el-form-item label="铏氭嫙/澶栭儴IP" prop="virtualIp">
-                <ip-input :ip="ruleForm.virtualIp" :on-blur="onIpBlur"></ip-input>
+              <el-form-item label="闆嗙兢IP" prop="virtualIp">
+                <ip-input :ip="ruleForm.virtualIp" :on-blur="onIpBlur" class="ip-input-comp"></ip-input>
               </el-form-item>
-              <el-form-item style="width:500px">
+              <el-form-item>
                 <el-button type="primary" size="small" @click="submitForm('ruleForm')">淇濆瓨</el-button>
               </el-form-item>
             </el-form>
@@ -30,11 +30,33 @@
 
           <!-- 鍔犲叆宸叉湁闆嗙兢 -->
           <el-tab-pane label="鍔犲叆宸叉湁闆嗙兢" name="2" :disabled="isHasColony">
-            <el-form label-width="80px" :model="joinForm" :rules="joinRules" ref="joinForm" v-loading="joinLoading">
-              <el-form-item label="IP鍦板潃" style="width:440px">
+            <el-form
+              label-width="80px"
+              :model="joinForm"
+              :rules="joinRules"
+              ref="joinForm"
+              class="join-form"
+              v-loading="joinLoading"
+            >
+              <el-form-item label="闆嗙兢ID" style="width:440px" prop="clusterid">
+                <el-input v-model="joinForm.clusterid" placeholder size="small"></el-input>
+              </el-form-item>
+              <el-form-item label="IP鍦板潃" style="width:440px" prop="clusterip">
                 <el-input
                   v-model="joinForm.clusterip"
                   placeholder="璇疯緭鍏ラ泦缇ゅ唴浠绘剰IP鍦板潃"
+                  size="small"
+                  autocomplete="new-password"
+                ></el-input>
+
+                <!-- <el-button size="mini" :disabled="searchDis" @click="searchColony">鎼滅储闆嗙兢</el-button>
+                <el-button size="mini" @click="stopSearch">鍋滄鎼滅储</el-button>-->
+              </el-form-item>
+              <el-form-item label="闆嗙兢瀵嗙爜" prop="clusterpwd" style="width:440px">
+                <el-input
+                  v-model="joinForm.clusterpwd"
+                  placeholder="璇疯緭鍏ラ泦缇ゅ瘑鐮�"
+                  show-password
                   size="small"
                   autocomplete="new-password"
                 >
@@ -48,22 +70,11 @@
                     <i class="el-icon-loading"></i>鍋滄鎼滅储
                   </el-button>
                 </el-input>
-
-                <!-- <el-button size="mini" :disabled="searchDis" @click="searchColony">鎼滅储闆嗙兢</el-button>
-                <el-button size="mini" @click="stopSearch">鍋滄鎼滅储</el-button>-->
-              </el-form-item>
-              <el-form-item label="闆嗙兢瀵嗙爜" prop="clusterpwd" style="width:440px">
-                <el-input
-                  v-model="joinForm.clusterpwd"
-                  placeholder="璇疯緭鍏ラ泦缇ゅ瘑鐮�"
-                  show-password
-                  size="small"
-                  autocomplete="new-password"
-                ></el-input>
               </el-form-item>
               <el-form-item style="width:440px">
                 <el-button type="primary" @click="join('joinForm')" size="small">鍔犲叆闆嗙兢</el-button>
               </el-form-item>
+              <div class="form-tip">璇疯緭鍏ヤ互涓婁俊鎭姞鍏ラ泦缇�,鎴栬�呴�氳繃闆嗙兢瀵嗙爜鎼滅储鍚庤繘琛屽姞鍏�</div>
             </el-form>
           </el-tab-pane>
         </el-tabs>
@@ -76,7 +87,7 @@
             <el-form-item label="闆嗙兢ID">
               <el-input v-model="clusterid" placeholder="涓嶅厑璁歌緭鍏�,淇濆瓨鍚庡洖鏄�" disabled size="small"></el-input>
             </el-form-item>
-            <el-form-item label="闆嗙兢瀵嗙爜" prop="clusterpwd" style="width:500px">
+            <el-form-item label="闆嗙兢瀵嗙爜" prop="clusterpwd">
               <el-input
                 v-model="ruleForm.clusterpwd"
                 disabled
@@ -85,10 +96,10 @@
               ></el-input>
             </el-form-item>
 
-            <el-form-item label="铏氭嫙/澶栭儴IP" prop="virtualIp">
-              <ip-input :ip="ruleForm.virtualIp" :on-blur="onIpBlur"></ip-input>
+            <el-form-item label="闆嗙兢IP" prop="virtualIp">
+              <ip-input :ip="ruleForm.virtualIp" :on-blur="onIpBlur" class="ip-input-comp"></ip-input>
             </el-form-item>
-            <el-form-item style="width:440px;text-align: right;">
+            <el-form-item style="text-align: right;">
               <el-button size="small" type="danger" @click="leave">閫�鍑洪泦缇�</el-button>
               <el-button
                 style="margin-right:10px;"
@@ -176,7 +187,7 @@
           </el-tab-pane>
         </el-tabs>
       </el-col>
-    </el-row> -->
+    </el-row>-->
   </div>
 </template>
 
@@ -211,17 +222,12 @@
     ipInput,
     cloudNode
   },
-  data() {
+  data () {
     const checkPwd = (rule, value, callback) => {
       if (!value) {
         return callback(new Error("瀵嗙爜涓嶈兘涓虹┖"));
       }
       setTimeout(() => {
-        // if (value.length > 16 || value.length < 6) {
-        //   callback(new Error("瀵嗙爜搴斾负6-16浣�!"));
-        // } else {
-        //   callback();
-        // }
         if (value.length != 6) {
           callback(new Error("瀵嗙爜搴斾负6浣�!"));
         } else {
@@ -255,6 +261,7 @@
         virtualip: "192.168.1.188"
       },
       joinForm: {
+        clusterid: "",
         clusterip: "",
         clusterpwd: ""
       },
@@ -273,8 +280,13 @@
       //   ]
       // },
       joinRules: {
+        clusterid: [
+          { required: true, message: "璇疯緭鍏ラ泦缇D", trigger: "change" },
+        ],
+        clusterip: [
+          { required: true, validator: isIPv4, trigger: "change" }
+        ],
         clusterpwd: [
-          { required: true, message: "璇疯緭鍏ラ泦缇ゅ瘑鐮�", trigger: "change" },
           { validator: checkPwd, trigger: "change" }
         ]
       },
@@ -294,25 +306,28 @@
       showJoinConfirm: false
     };
   },
-  mounted() {
+  mounted () {
     this.findCluster();
     let _this = this;
-    this.intervalTimer = setInterval(()=>{
+    this.intervalTimer = setInterval(() => {
       _this.findCluster();
-    },30000);
-    this.getEsClusterNodes();
+    }, 30000);
+    //this.getEsClusterNodes();
   },
-  beforeDestroy(){
+  beforeDestroy () {
     clearInterval(this.intervalTimer);
   },
   methods: {
-    cleanValue() {
+    checkPsd (psd) {
+      return psd.trim().length === 6
+    },
+    cleanValue () {
       this.members = [];
     },
-    sHandleClick(tab, event) {
+    sHandleClick (tab, event) {
       console.log(tab, event);
     },
-    submitForm(formName) {
+    submitForm (formName) {
       this.$refs[formName].validate(valid => {
         if (valid) {
           //alert("submit!");
@@ -332,7 +347,7 @@
       });
     },
 
-    saveForm(formName) {
+    saveForm (formName) {
       this.$refs[formName].validate(valid => {
         if (valid) {
           alert("submit!");
@@ -352,32 +367,33 @@
       });
     },
 
-    join(formName) {
+    join (formName) {
       let _this = this;
       this.$refs[formName].validate(valid => {
         if (valid) {
           _this.joinLoading = true;
-          if (Object.keys(this.currentCluster).length === 0) {
-            this.$notify({
-              type: "info",
-              duration: 1000,
-              message: "璇峰厛閫夋嫨涓�涓泦缇よ妭鐐�"
-            });
-            _this.joinLoading = false;
-            return true;
-          }
+          // if (Object.keys(this.currentCluster).length === 0) {
+          //   this.$notify({
+          //     type: "info",
+          //     duration: 1000,
+          //     message: "璇峰厛閫夋嫨涓�涓泦缇よ妭鐐�"
+          //   });
+          //   _this.joinLoading = false;
+          //   return true;
+          // }
           let nodeIps = this.members.map(i => {
             return i.Address;
           });
           let json = {
-            clusterId: this.currentCluster.cluster_id,
+            //clusterId: this.currentCluster.cluster_id,
+            clusterId: this.joinForm.clusterid,
             password: this.joinForm.clusterpwd,
-            nodeIps: nodeIps
+            nodeIps: [this.joinForm.clusterip]
           };
           this.joinCluster(json).then(() => {
             _this.joinLoading = false;
             this.findCluster();
-          }).catch(e=>{
+          }).catch(e => {
             console.log(e);
             _this.joinLoading = false;
           });
@@ -387,7 +403,7 @@
         }
       });
     },
-    async createCluster(json) {
+    async createCluster (json) {
       let res = await createSerfCluster(json);
       console.log(res, "鍒涘缓闆嗙兢");
       this.$notify({
@@ -396,42 +412,43 @@
         type: res.success ? "success" : "error"
       });
     },
-    async randomPwd() {
+    async randomPwd () {
       let res = await randomPwd();
       if (res && res.success) {
         this.ruleForm.clusterpwd = res.data;
       }
     },
-    async searchColony() {
+    async searchColony () {
       this.isSearch = true;
-      this.$refs["joinForm"].validate(valid => {
-        if (valid) {
-          this.members = [];
-          let json = {
-            password: this.joinForm.clusterpwd,
-            ip: this.joinForm.clusterip
-          };
+      this.$refs["joinForm"].clearValidate();
+      this.$refs["joinForm"].validateField('clusterpwd');
+      if (this.checkPsd(this.joinForm.clusterpwd)) {
+        this.members = [];
+        let json = {
+          password: this.joinForm.clusterpwd,
+          //ip: this.joinForm.clusterip
+        };
 
-          this.search(json)
-            .then(() => {
-              this.setSchedule();
-              // this.searchDis = false;
-              // this.loading = false;
-            })
-            .catch(() => {
-              this.searchDis = false;
-              this.loading = false;
-              this.isSearch = false;
-            });
-        } else {
-          this.searchDis = false;
-          this.loading = false;
-          this.isSearch = false;
-          return false;
-        }
-      });
+        this.search(json)
+          .then(() => {
+            this.setSchedule();
+            // this.searchDis = false;
+            // this.loading = false;
+          })
+          .catch(() => {
+            this.searchDis = false;
+            this.loading = false;
+            this.isSearch = false;
+          });
+      } else {
+        this.searchDis = false;
+        this.loading = false;
+        this.isSearch = false;
+        return false;
+      }
+      //});
     },
-    async search(json) {
+    async search (json) {
       let res = await search(json);
       if (res && res.success) {
         console.log(res, "鎼滅储闆嗙兢");
@@ -444,7 +461,7 @@
       }, 10 * 1000);
     },
     //鎼滅储闆嗙兢
-    async getSearchNodes() {
+    async getSearchNodes () {
       let res = await getSearchNodes();
       if (res && res.success) {
         let list = res.data.map(i => {
@@ -468,12 +485,12 @@
         });
       }
     },
-    setSchedule() {
+    setSchedule () {
       this.scheduleId = window.setInterval(() => {
         this.getSearchNodes();
       }, 1000);
     },
-    async stopSearch() {
+    async stopSearch () {
       if (!this.loading) {
         return true;
       }
@@ -498,7 +515,7 @@
         // },2000)
       })
     },
-    async findCluster() {
+    async findCluster () {
       let res = await findCluster();
       if (res && res.success) {
         if (res.data && res.data.clusterId) {
@@ -506,7 +523,7 @@
           this.activeName = "3";
           this.clusterid = res.data.clusterId;
           this.ruleForm.clustername = res.data.clusterName;
-          this.ruleForm.clusterpwd = res.data.clusterpwd
+          this.ruleForm.clusterpwd = '******';
           this.ruleForm.virtualIp = res.data.virtualIp
           //let list = res.data.nodes.map(i => {
           this.isSearch = false;
@@ -535,7 +552,7 @@
         }
       }
     },
-    getVrrpInfo() {
+    getVrrpInfo () {
       getVrrp().then(res => {
         if (res.success) {
           this.vrIpForm.virtual_ip = res.data.virtual_ip;
@@ -545,7 +562,7 @@
         console.log(e)
       })
     },
-    async updateCluster() {
+    async updateCluster () {
       if (this.ruleForm.clustername === "") {
         this.$message({
           type: "error",
@@ -565,7 +582,7 @@
         type: res.success ? "success" : "error"
       });
     },
-    async joinCluster(json) {
+    async joinCluster (json) {
       let res = await joinCluster(json);
       if (res.success) {
         this.members = []
@@ -576,7 +593,7 @@
         type: res.success ? "success" : "error"
       });
     },
-    leave() {
+    leave () {
       this.$confirm(`纭畾閫�鍑洪泦缇ゅ悧?`, {
         center: true,
         cancelButtonClass: "comfirm-class-cancle",
@@ -600,7 +617,8 @@
       }).catch(() => { });
 
     },
-    joinNode(event, node) {
+    joinNode (event, node) {
+      console.log('join',node)
       let _this = this;
       this.currentCluster.cluster_id = node.cluster_id;
       if (this.activeName === "3") {
@@ -609,47 +627,64 @@
         return;
       }
       if (this.activeName === "2") {
-        this.$refs["joinForm"].validate(valid => {
-          if (valid) {
-            if(_this.showJoinConfirm) return;
+        debugger
+        if (_this.showJoinConfirm) return;
+
+        this.$confirm("鏄惁瑕佸姞鍏ヨ妭鐐� " + node.nodeName + "?", "鍔犲叆闆嗙兢", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "success"
+        })
+          .then(() => {
             _this.showJoinConfirm = true;
-            this.$confirm("鏄惁瑕佸姞鍏ヨ妭鐐� " + node.nodeName + "?", "鍔犲叆闆嗙兢", {
-              confirmButtonText: "纭畾",
-              cancelButtonText: "鍙栨秷",
-              type: "success"
-            })
-              .then(() => {
-                // this.agentName = 'node' + this.members.length
-                // this.members.push({
-                //   nodeName: this.agentName,
-                //   Address: '172.10.10.26',
-                //   role: 'pc'
-                // })
-                // this.$notify({
-                //   type: 'success',
-                //   duration: 1000,
-                //   message: '鍔犲叆鎴愬姛!'
-                // })
-                console.log(this.currentCluster, '閫夋嫨鐨勯泦缇よ妭鐐�')
-                this.join("joinForm");
-                _this.showJoinConfirm = false;
-              })
-              .catch(() => {
-                this.$notify({
-                  type: "info",
-                  duration: 1000,
-                  message: "宸插彇娑�"
-                });
-                _this.showJoinConfirm = false;
-              });
-          } else {
-            console.log("error submit!!");
-            return false;
-          }
-        });
+            let json = {
+              //clusterId: this.currentCluster.cluster_id,
+              clusterId: node.cluster_id,
+              password: this.joinForm.clusterpwd,
+              nodeIps: [node.Address]
+            };
+            this.joinCluster(json).then(() => {
+              _this.showJoinConfirm = false;
+              this.findCluster();
+            }).catch(e => {
+              console.log(e);
+              _this.showJoinConfirm = false;
+            });
+          }).catch(e => {
+            console.log(e)
+          });
+
+        // this.$refs["joinForm"].validate(valid => {
+        //   if (valid) {
+        //     if (_this.showJoinConfirm) return;
+        //     _this.showJoinConfirm = true;
+        //     this.$confirm("鏄惁瑕佸姞鍏ヨ妭鐐� " + node.nodeName + "?", "鍔犲叆闆嗙兢", {
+        //       confirmButtonText: "纭畾",
+        //       cancelButtonText: "鍙栨秷",
+        //       type: "success"
+        //     })
+        //       .then(() => {
+
+        //         console.log(this.currentCluster, '閫夋嫨鐨勯泦缇よ妭鐐�')
+        //         this.join("joinForm");
+        //         _this.showJoinConfirm = false;
+        //       })
+        //       .catch(() => {
+        //         this.$notify({
+        //           type: "info",
+        //           duration: 1000,
+        //           message: "宸插彇娑�"
+        //         });
+        //         _this.showJoinConfirm = false;
+        //       });
+        //   } else {
+        //     console.log("error submit!!");
+        //     return false;
+        //   }
+        // });
       }
     },
-    generatePassword() {
+    generatePassword () {
       var chars =
         "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
       var uuid = [];
@@ -661,7 +696,7 @@
       this.ruleForm.clusterpwd = uuid.join("");
     },
 
-    async getEsClusterNodes() {
+    async getEsClusterNodes () {
       let rsp = await getDevInfo();
       let hostIpAddr = "";
       if (rsp && rsp.success) {
@@ -687,7 +722,7 @@
         }
       }
     },
-    createEsCluster() {
+    createEsCluster () {
       createESNode().then(rsp => {
         if (rsp && rsp.success) {
           this.$message({
@@ -712,7 +747,7 @@
         });
       })
     },
-    joinESCluster() {
+    joinESCluster () {
       if (!this.esNodeIp.length) {
         this.$message({
           type: "error",
@@ -746,7 +781,7 @@
         });
       })
     },
-    onIpBlur(ip) {
+    onIpBlur (ip) {
       //this.vrIpForm.virtual_ip = ip;
       this.ruleForm.virtualIp = ip;
       console.log(this.ruleForm.virtualIp)
@@ -754,7 +789,7 @@
 
   },
 
-  created() { }
+  created () { }
 
 };
 </script>
@@ -763,14 +798,27 @@
   width: 100%;
   height: 100%;
   overflow: auto;
-
+  .el-form-item {
+    width: 500px;
+  }
+  .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label:before,
+  .el-form-item.is-required:not(.is-no-asterisk)
+    .el-form-item__label-wrap
+    > .el-form-item__label:before {
+    display: none;
+  }
+  .ip-input-comp {
+    width: 400px;
+    max-width: 400px;
+  }
   .el-button {
     float: right;
   }
   .el-form-item__content {
     text-align: left;
+
     input {
-      max-width: 360px;
+      max-width: 400px !important;
     }
   }
 
@@ -817,9 +865,9 @@
   #h-alaycluster {
     .el-form-item__content {
       text-align: left;
-      input {
-        max-width: 360px;
-      }
+      // input {
+      //   max-width: 360px;
+      // }
     }
   }
 }
@@ -827,5 +875,4 @@
   height: 30px;
   line-height: 30px;
 }
-
 </style>

--
Gitblit v1.8.0