From 19d871dc4f3bd48e0906868ba5b35a457b128964 Mon Sep 17 00:00:00 2001
From: hanbaoshan <hanbaoshan@aiotlink.com>
Date: 星期一, 14 九月 2020 19:11:43 +0800
Subject: [PATCH] 漂移ip接口联调,摄像机信息初始化系统信息

---
 src/pages/ai/index/App.vue                          |    7 ++
 src/pages/settings/components/ClusterManagement.vue |   90 +++++++++++++++++++++++++-----
 src/api/clusterManage.ts                            |   17 +++++
 vue.config.js                                       |    7 +
 src/pages/cameraAccess/index/VideoManage.vue        |    3 
 5 files changed, 105 insertions(+), 19 deletions(-)

diff --git a/src/api/clusterManage.ts b/src/api/clusterManage.ts
index f13dfbd..bbeb747 100644
--- a/src/api/clusterManage.ts
+++ b/src/api/clusterManage.ts
@@ -84,3 +84,20 @@
     data: query
   })
 };
+
+// 鑾峰彇婕傜Щip璁剧疆
+export const getVrrp = () => {
+  return request({
+    url: "/vrrp",
+    method: "get"
+  })
+};
+
+// 璁剧疆婕傜Щip璁剧疆
+export const setVrrp = (data: any) => {
+  return request({
+    url: "/vrrp",
+    method: "post",
+    data
+  })
+}
\ No newline at end of file
diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue
index 0c1a640..22e9e89 100644
--- a/src/pages/ai/index/App.vue
+++ b/src/pages/ai/index/App.vue
@@ -1250,7 +1250,12 @@
       height: 100%;
       box-sizing: border-box;
       // float: left;
-
+      .el-drawer__header{
+        border-bottom: 2px solid #eee;
+        padding-bottom: 10px;
+        font-size: 16px;
+        margin-bottom: 0px;
+      }  
       .action-bar {
         margin-bottom: 30px;
         .el-input {
diff --git a/src/pages/cameraAccess/index/VideoManage.vue b/src/pages/cameraAccess/index/VideoManage.vue
index 8e26bfc..7d6a031 100644
--- a/src/pages/cameraAccess/index/VideoManage.vue
+++ b/src/pages/cameraAccess/index/VideoManage.vue
@@ -170,7 +170,8 @@
       this.TreeDataPool.clean();
     });
 
-    let _this = this
+    let _this = this;
+    _this.PollData.statisticTaskInfo();
     this.intervalTimer = setInterval(() => {
       _this.PollData.statisticTaskInfo();
     }, 10000)
diff --git a/src/pages/settings/components/ClusterManagement.vue b/src/pages/settings/components/ClusterManagement.vue
index d6d5d65..cb07345 100644
--- a/src/pages/settings/components/ClusterManagement.vue
+++ b/src/pages/settings/components/ClusterManagement.vue
@@ -14,23 +14,23 @@
               <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:440px">
+              <el-form-item label="闆嗙兢瀵嗙爜" prop="clusterpwd" style="width:500px">
                 <el-input v-model="ruleForm.clusterpwd" placeholder="璇疯緭鍏�6-12浣嶅瘑鐮�,鎴栫偣鍑荤敓鎴�" size="small">
                   <el-button type="text" slot="suffix" @click="generatePassword">鐢熸垚瀵嗙爜</el-button>
                 </el-input>
               </el-form-item>
 
-              <el-form-item label="铏氭嫙IP" prop="virtualip">
+              <!-- <el-form-item label="铏氭嫙IP" prop="virtualip">
                 <ip-input :ip="ruleForm.virtualip" :on-blur="onIpBlur"></ip-input>
-              </el-form-item>
-              <el-form-item style="width:440px">
+              </el-form-item> -->
+              <el-form-item style="width:500px">
                 <el-button type="primary" size="small" @click="submitForm('ruleForm')">淇濆瓨</el-button>
               </el-form-item>
             </el-form>
           </el-tab-pane>
-
+          
           <!-- 鍔犲叆宸叉湁闆嗙兢 -->
-          <el-tab-pane label="鍔犲叆宸叉湁闆嗙兢" name="2" :disabled="isHasColony">
+          <el-tab-pane label="鍔犲叆宸叉湁闆嗙兢" name="3" :disabled="isHasColony">
             <el-form label-width="80px" :model="joinForm" :rules="joinRules" ref="joinForm">
               <el-form-item label="IP鍦板潃" style="width:440px">
                 <el-input v-model="joinForm.clusterip" placeholder="璇疯緭鍏ラ泦缇ゅ唴浠绘剰IP鍦板潃" size="small">
@@ -48,7 +48,7 @@
                 <!-- <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-form-item label="闆嗙兢瀵嗙爜" prop="clusterpwd" style="width:500px">
                 <el-input
                   v-model="joinForm.clusterpwd"
                   placeholder="璇疯緭鍏ラ泦缇ゅ瘑鐮�"
@@ -71,7 +71,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:440px">
+            <el-form-item label="闆嗙兢瀵嗙爜" prop="clusterpwd" style="width:500px">
               <el-input
                 v-model="ruleForm.clusterpwd"
                 disabled
@@ -80,9 +80,9 @@
               ></el-input>
             </el-form-item>
 
-            <el-form-item label="铏氭嫙IP" prop="virtualip">
+            <!-- <el-form-item label="铏氭嫙IP" prop="virtualip">
               <ip-input :ip="ruleForm.virtualip" :on-blur="onIpBlur"></ip-input>
-            </el-form-item>
+            </el-form-item> -->
             <el-form-item style="width:440px;text-align: right;">
               <el-button size="small" type="danger" @click="leave">閫�鍑洪泦缇�</el-button>
               <el-button
@@ -103,6 +103,22 @@
           v-loading="loading"
           @selected-node="joinNode"
         ></serfDiagram>
+      </el-col>
+    </el-row>
+    <div class="ui-top-view">
+      <div class="ui-top-title">婕傜ЩIP</div>
+    </div>
+    <el-row>
+      <el-col :span="12">
+        <el-form :model="vrIpForm" ref="vrIpForm" :rules="vrIpRules" style="padding:20px 40px;">
+          <el-form-item label="铏氭嫙IP" prop="virtual_ip">
+            <ip-input :ip="vrIpForm.virtual_ip" :on-blur="onIpBlur"></ip-input>
+            <el-switch v-model="vrIpForm.enable" style="margin-left:30px;"></el-switch>
+          </el-form-item>
+          <el-form-item style="width:500px">
+            <el-button type="primary" size="small" @click="saveForm('vrIpForm')">淇濆瓨</el-button>
+          </el-form-item>
+        </el-form>
       </el-col>
     </el-row>
     <div class="ui-top-view">
@@ -160,7 +176,9 @@
   findCluster,
   updateClusterName,
   joinCluster,
-  leave
+  leave,
+  getVrrp,
+  setVrrp
 } from "@/api/clusterManage";
 import serfDiagram from "@/components/serfDiagram";
 import ipInput from "@/components/subComponents/IPInput";
@@ -193,7 +211,13 @@
       ruleForm: {
         clustername: "",
         clusterpwd: "",
-        virtualip: ""
+        //virtualip: ""
+      },
+      vrIpForm: {
+        enable: true,
+        //serve_port: "",
+        serve_port: null,
+        virtual_ip: ""
       },
       manageForm: {
         clustername: "娴嬭瘯闆嗙兢1",
@@ -209,6 +233,11 @@
           { required: true, message: "璇疯緭鍏ラ泦缇ゅ悕绉�", trigger: "change" }
         ],
         clusterpwd: [{ validator: checkPwd, trigger: "change" }],
+        // virtualip: [
+        //   { required: true, message: "璇疯緭鍏ヨ櫄鎷烮P", trigger: "change" }
+        // ]
+      },
+      vrIpRules: {
         virtualip: [
           { required: true, message: "璇疯緭鍏ヨ櫄鎷烮P", trigger: "change" }
         ]
@@ -265,10 +294,30 @@
             clusterId: this.clusterid,
             clusterName: this.ruleForm.clustername,
             password: this.ruleForm.clusterpwd,
-            virtualip: this.ruleForm.virtualip
+            //virtualip: this.ruleForm.virtualip
           };
           this.createColony(json).then(() => {
             this.findCluster();
+          });
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+    saveForm(formName) {
+      debugger
+      this.$refs[formName].validate(valid => {
+        if (valid) {
+          alert("submit!");
+          let json = {
+            enable: this.vrIpForm.enable,
+            serve_port: this.vrIpForm.serve_port,
+            virtual_ip: this.vrIpForm.virtual_ip,
+            
+          };
+          setVrrp(json).then(() => {
+            this.getVrrpInfo();
           });
         } else {
           console.log("error submit!!");
@@ -419,7 +468,7 @@
           this.clusterid = res.data.clusterId;
           this.ruleForm.clustername = res.data.clusterName;
           this.ruleForm.clusterpwd = res.data.clusterpwd
-          this.ruleForm.virtualip = res.data.virtualip
+          //this.ruleForm.virtualip = res.data.virtualip
           let list = res.data.nodes.map(i => {
             let obj = {};
             obj.cluster_id = i.cluster_id;
@@ -439,6 +488,16 @@
           // this.activeName = '1'
         }
       }
+    },
+    getVrrpInfo(){
+      getVrrp().then(res=>{
+        if(res.success){
+          this.vrIpForm.virtual_ip = res.data.virtual_ip;
+          this.vrIpForm.enable = res.data.enable;
+        }
+      }).catch(e=>{
+        console.log(e)
+      })
     },
     async updateClusterName() {
       let res = await updateClusterName({
@@ -539,11 +598,12 @@
       this.ruleForm.clusterpwd = uuid.join("");
     },
     onIpBlur(ip) {
-      this.ruleForm.virtualip = ip;
+      this.vrIpForm.virtual_ip = ip;
     }
   },
   mounted() {
     this.findCluster();
+    this.getVrrpInfo();
   },
   created() { }
 };
diff --git a/vue.config.js b/vue.config.js
index 4c3e3e6..ec097d9 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -71,13 +71,16 @@
         // target: "http://222.128.87.51:7003",
         target: 'http://192.168.20.10:7003',
         changeOrigin: true, //寮�鍚唬鐞�
-      }
-      ,
+      },
       "/files": {
         //target: "http://bsic.asuscomm.com:7003",
         // target: "http://222.128.87.51:7003",
         target: 'http://192.168.20.10:7003',
         changeOrigin: true, //寮�鍚唬鐞�
+      },
+      "/vrrp": {
+        target: 'http://192.168.20.10:8889',
+        changeOrigin: true
       }
     }
   }

--
Gitblit v1.8.0