From 7cea2db9d57b24d98e42b5207fa6f9a703362e26 Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期四, 24 六月 2021 10:29:19 +0800
Subject: [PATCH] 朔黄和系统设置

---
 src/api/system.ts                                             |   31 ++++
 src/api/user.ts                                               |    7 +
 src/pages/systemSettings/index/App.vue                        |   92 +++++++++----
 src/pages/shuohuangMonitorAnalyze/components/leftNav.vue      |    2 
 src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue |   96 +++++++------
 src/pages/systemSettings/views/NetSettings.vue                |  132 +++++++++++++++---
 src/pages/shuohuangMonitorAnalyze/components/lkgManage.vue    |    2 
 7 files changed, 261 insertions(+), 101 deletions(-)

diff --git a/src/api/system.ts b/src/api/system.ts
index d5c56cb..868da6c 100644
--- a/src/api/system.ts
+++ b/src/api/system.ts
@@ -135,6 +135,37 @@
   });
 };
 
+export const setServerName = (query: any) => {
+  return request({
+    url: "/data/api-v/sysset/setSerName",
+    method: "post",
+    data: qs.stringify(query)
+  });
+};
+
+export const getWireList = (query: any) => {
+  return request({
+    url: "/data/api-v/sysset/getNetWorkCards",
+    method: "get",
+    data: (query)
+  });
+};
+export const setNetWorkCard = (query: any) => {
+  return request({
+    url: "/data/api-v/sysset/setNetWorkCard",
+    method: "post",
+    data: qs.stringify(query)
+  });
+};
+
+export const getNetWorkCardInfo = (query: any) => {
+  return request({
+    url: "/data/api-v/sysset/getNetWorkCardInfo",
+    method: "post",
+    data: qs.stringify(query)
+  });
+};
+
 export const deleteDate = (query: any) => {
   return request({
     url: "/data/api-v/clearData/deleteEsData",
diff --git a/src/api/user.ts b/src/api/user.ts
index 13afcab..58be30b 100644
--- a/src/api/user.ts
+++ b/src/api/user.ts
@@ -64,3 +64,10 @@
   });
 };
 
+export const deleteUser = (params: any) => {
+  return request({
+    url: "/data/api-u/users/delUser",
+    method: "post",
+    data: params
+  });
+};
diff --git a/src/pages/shuohuangMonitorAnalyze/components/leftNav.vue b/src/pages/shuohuangMonitorAnalyze/components/leftNav.vue
index afeeec2..e28a759 100644
--- a/src/pages/shuohuangMonitorAnalyze/components/leftNav.vue
+++ b/src/pages/shuohuangMonitorAnalyze/components/leftNav.vue
@@ -40,7 +40,7 @@
         </template>
         <el-menu-item index="transferMemo">瑙嗛杞偍璁板綍</el-menu-item>
         <el-menu-item index="transferDeviceManage">杞偍璁惧绠$悊</el-menu-item>
-        <el-menu-item index="lkgManage">LKG鏁版嵁绠$悊</el-menu-item>
+        <el-menu-item index="lkgManage">LKJ鏁版嵁绠$悊</el-menu-item>
       </el-submenu>
       <el-submenu index="7">
         <template slot="title">
diff --git a/src/pages/shuohuangMonitorAnalyze/components/lkgManage.vue b/src/pages/shuohuangMonitorAnalyze/components/lkgManage.vue
index d082523..d0da92f 100644
--- a/src/pages/shuohuangMonitorAnalyze/components/lkgManage.vue
+++ b/src/pages/shuohuangMonitorAnalyze/components/lkgManage.vue
@@ -1,7 +1,7 @@
 <template>
   <div class="lkg-manage">
     <div class="import-btn">
-      <label>涓婁紶LKG鏁版嵁鏂囦欢</label>
+      <label>涓婁紶LKJ鏁版嵁鏂囦欢</label>
       <el-button
         size="mini"
         type="primary"
diff --git a/src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue b/src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue
index 70c1652..538fad8 100644
--- a/src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue
+++ b/src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue
@@ -17,7 +17,8 @@
               v-for="(item, index) in popDownArr"
               :key="index"
               :command="item"
-            >{{ item.CameraPosition }}</el-dropdown-item>
+              >{{ item.CameraPosition }}</el-dropdown-item
+            >
           </el-dropdown-menu>
         </el-dropdown>
 
@@ -118,7 +119,11 @@
           </template>
           <div class="player-control">
             <div class="progress-bar">
-              <el-tooltip placement="top" v-for="(item, index) in eventMarks" :key="index">
+              <el-tooltip
+                placement="top"
+                v-for="(item, index) in eventMarks"
+                :key="index"
+              >
                 <div slot="content">
                   {{ getTimeStr(item.offset) }}
                   <br />
@@ -132,7 +137,11 @@
                   @click="dotJump(item.offset)"
                 ></div>
               </el-tooltip>
-              <el-tooltip placement="top" v-for="(item, index) in labelMarks" :key="index">
+              <el-tooltip
+                placement="top"
+                v-for="(item, index) in labelMarks"
+                :key="index"
+              >
                 <div slot="content">
                   {{ getTimeStr(item.offset) }}
                   <br />
@@ -201,16 +210,21 @@
                 v-show="isUnusual == 1"
                 type="primary"
                 @click="addLabel(curVideo)"
-              >娣诲姞鏍囨敞</el-button>
+                >娣诲姞鏍囨敞</el-button
+              >
             </div>
             <div class="flex-box fixed-height-box">
               <label v-if="!showTable">鏍囨敞淇℃伅:</label>
               <div class="mark-list" v-if="!showTable">
-                <div class="mark" v-for="mark in curVideo.LableLst" :key="mark.ID">
+                <div
+                  class="mark"
+                  v-for="mark in curVideo.LableLst"
+                  :key="mark.ID"
+                >
                   <div class="time">
                     <span>
                       {{ pad0(Math.floor(mark.Time / 60)) }}:{{
-                      pad0(mark.Time % 60)
+                        pad0(mark.Time % 60)
                       }}
                     </span>
                     <i class="el-icon-edit" @click="editCurLabel(mark)"></i>
@@ -269,12 +283,19 @@
       <div class="label-check">
         <p class="label">闅愭偅闂:</p>
         <el-checkbox-group v-model="labelCheckedList">
-          <el-checkbox v-for="item in labelOptions" :key="item.ID" :label="item.ID">{{ item.Name }}</el-checkbox>
+          <el-checkbox
+            v-for="item in labelOptions"
+            :key="item.ID"
+            :label="item.ID"
+            >{{ item.Name }}</el-checkbox
+          >
         </el-checkbox-group>
       </div>
       <div class="btns">
         <el-button @click="cancelLabelChecked" size="small">鍙栨秷</el-button>
-        <el-button @click="submitLabelChecked" size="small" type="primary">纭畾</el-button>
+        <el-button @click="submitLabelChecked" size="small" type="primary"
+          >纭畾</el-button
+        >
       </div>
     </el-dialog>
   </div>
@@ -332,11 +353,11 @@
   filters: {
     fixPath(str) {
       if (!str || str == undefined) {
-        return ""
+        return "";
       }
 
-      return str.replace("/opt/vasystem", "")
-    }
+      return str.replace("/opt/vasystem", "");
+    },
   },
   data() {
     return {
@@ -532,26 +553,6 @@
       _this.$nextTick(() => {
         _this.$refs[`player_${_this.curVideo.id}`][0].init();
       });
-      // let _this = this;
-      // console.log(cmd)
-      // getCarVideos({
-      //   TrainNumber: cmd.TrainNumber,
-      //   CarNumber: cmd.CarNumber,
-      //   Driver1: cmd.Driver1,
-      // }).then((res) => {
-      //   _this.allCurVideos = res.data;
-      //   _this.curCamera = cmd.CameraPosition;
-      //   _this.curRoomVideos = _this.allCurVideos.filter((item) => {
-      //     return item.CameraPosition == cmd.CameraPosition;
-      //   });
-      //   _this.curVideo = _this.curRoomVideos.find((item) => {
-      //     return item.ID == cmd.ID;
-      //   });
-      //   _this.$nextTick(() => {
-      //     _this.$refs[`player_${_this.curVideo.ID}`][0].init();
-      //   });
-      // });
-
     },
     pad0(val) {
       return val < 10 ? "0" + val : val;
@@ -569,7 +570,6 @@
         CarNumber: v.CarNumber,
         Driver1: v.Driver1,
       }).then((res) => {
- 
         res.data.forEach((item) => {
           item.marks = _this.mergeMarks(item);
         });
@@ -601,7 +601,8 @@
         _this.$nextTick(() => {
           _this.$refs[`player_${_this.curVideo.id}`][0].init();
           let arr = _this.maxVideoTime.split(":");
-          let min = +arr[1], sec = +arr[2];
+          let min = +arr[1],
+            sec = +arr[2];
           _this.maxSecond = min * 60 + sec;
         });
       });
@@ -617,7 +618,7 @@
           _this.curCamera = _this.popDownArr[0].CameraPosition;
         }
       });
-      _this.popDownArr
+      _this.popDownArr;
     },
     renderLabelOpts() {
       let _this = this;
@@ -627,7 +628,7 @@
     },
     refreshCurVideoLabel(video) {
       let _this = this;
-      _this.popDownArr = []
+      _this.popDownArr = [];
       getRelatedVideoInfo({ GroupID: video.GroupID }).then((res) => {
         res.data.forEach((item) => {
           _this.popDownArr.push(item);
@@ -635,17 +636,22 @@
             video.LableLst = item.LableLst;
           }
         });
-        // res.data.forEach((d) => {
-        //   if (item.ID === video.ID) {
-        //     video.LableLst = item.LableLst;
-        //   }
-        // });
       });
-      _this.popDownArr
+      _this.popDownArr;
     },
     checkVideo(video, index) {
       this.refreshCurVideoLabel(video);
       this.curVideo = video;
+      this.eventMarks = []
+      this.labelMarks = []
+      video.marks.forEach((item) => {
+         if (item.type == 0) {
+          this.eventMarks.push(item);
+        } else {
+          this.labelMarks.push(item);
+        }
+      })
+
       this.videoArrs = this.allCurVideos.filter(
         (item) => video.GroupID == item.GroupID
       );
@@ -740,10 +746,10 @@
     },
     removeCurLabel(mark) {
       let _this = this;
-      debugger
+      debugger;
       let obj = {
         ID: mark.ID,
-        VideoIds: mark.VideoIds
+        VideoIds: mark.VideoIds,
       };
       delLabel(obj).then((rsp) => {
         if (rsp && rsp.success) {
@@ -767,7 +773,7 @@
     },
     mergeMarks(videoInfo) {
       if (!videoInfo.EventLst || !videoInfo.LableLst) {
-        console.log("mergeMarks data null")
+        console.log("mergeMarks data null");
         return;
       }
 
@@ -906,7 +912,7 @@
               height: 8px;
               width: 6px;
               z-index: 1;
-              background-color:yellowgreen ;
+              background-color: yellowgreen;
               cursor: pointer;
               -webkit-transform: translateX(-50%);
               transform: translateX(-50%);
diff --git a/src/pages/systemSettings/index/App.vue b/src/pages/systemSettings/index/App.vue
index c78557c..c477954 100644
--- a/src/pages/systemSettings/index/App.vue
+++ b/src/pages/systemSettings/index/App.vue
@@ -153,28 +153,26 @@
         <div class="permission" v-if="inAccountDetail && isSetPermission">
           <div class="title">鏉冮檺绠$悊</div>
 
-          <div class="line">
-            <div class="name">瀹炴椂鐩戞帶</div>
-            <el-switch
-              v-model="isRealtime"
-              active-color="rgba(61, 104, 225, 1)"
-            >
-            </el-switch>
+          <div class="line-wrap" v-for="item in sysMenus" :key="item.id">
+            <div class="line">
+              <div class="name">{{ item.name }}</div>
+              <el-switch
+                v-model="item.selected"
+                active-color="rgba(61, 104, 225, 1)"
+              >
+              </el-switch>
+            </div>
+            <div v-if="item.children">
+                <div class="line" style="margin-left:55px;" v-for="x in item.children" :key="x.id">
+                  <div class="name">{{ x.name }}</div>
+                  <el-switch
+                    v-model="x.selected"
+                    active-color="rgba(61, 104, 225, 1)"
+                  >
+                  </el-switch>
+                </div>
+              </div>
           </div>
-          <div class="line">
-            <div class="name">缁熻鏌ヨ</div>
-            <el-switch v-model="isCount" active-color="rgba(61, 104, 225, 1)">
-            </el-switch>
-          </div>
-          <div class="line">
-            <div class="name">绠楀姏绠$悊</div>
-            <el-switch
-              v-model="isCalculate"
-              active-color="rgba(61, 104, 225, 1)"
-            >
-            </el-switch>
-          </div>
-
           <div class="btns">
             <div class="cancel" @click="cancelSet">鍙栨秷</div>
             <div class="ok">淇濆瓨</div>
@@ -451,6 +449,9 @@
   getUsers,
   updateUser,
   updatePassword,
+  deleteUser,
+  getUserMenus,
+  getSysMenus,
 } from "@/api/user";
 import switchBar from "../components/switchBar";
 import ipInput from "@/components/subComponents/IPInput";
@@ -541,7 +542,8 @@
       showYrsInput: false,
       showMonthInput: false,
       showDayInput: false,
-
+      cameraInfo: false,
+      dependentScene: false,
       timestamp: 0,
       inAccountDetail: false,
       isChangePw: false,
@@ -582,6 +584,7 @@
         confirmPassword: "",
       },
       activeAccountIndex: 0,
+      sysMenus: [],
       addForm: {
         userName: "",
         nickName: "",
@@ -622,6 +625,7 @@
     });
 
     this.fetchUserList();
+    this.fetchSysMenus();
   },
   methods: {
     fetchUserList() {
@@ -887,7 +891,6 @@
     syncBrowser(val) {
       this.isSyncBrowser = val;
       if (val == false) {
-        console.log(12121);
         clearInterval(this.browserTimer);
       } else {
         this.browserTimer = setInterval(() => {
@@ -899,7 +902,6 @@
         }, 1000);
       }
     },
-    openChangePw() {},
     showAddAccount() {
       this.inAccountDetail = false;
       this.isAddAccount = true;
@@ -911,6 +913,14 @@
     cancelChangePassword() {
       this.isChangePw = false;
       this.inAccountDetail = false;
+    },
+    fetchSysMenus() {
+      getSysMenus().then((rsp) => {
+        if (rsp && rsp.success) {
+          this.sysMenus = rsp.data;
+          console.log(this.sysMenus);
+        }
+      });
     },
     saveAddAccount(formName) {
       this.$refs[formName].validate((valid) => {
@@ -982,9 +992,19 @@
         cancelButtonText: "鍙栨秷",
       })
         .then(() => {
-          this.$message({
-            type: "success",
-            message: "鍒犻櫎鎴愬姛!",
+          debugger;
+          deleteUser({
+            ids: [this.activeAccountItem.id],
+          }).then((res) => {
+            if (res.success) {
+              this.fetchUserList();
+              this.$message({
+                type: "success",
+                message: "鍒犻櫎鎴愬姛!",
+              });
+            } else {
+              this.$message.warning("鍒犻櫎澶辫触");
+            }
           });
         })
         .catch(() => {});
@@ -992,9 +1012,25 @@
     openPermission() {
       this.inAccountDetail = true;
       this.isSetPermission = true;
+      getUserMenus({
+        userId: this.activeAccountItem.id,
+      }).then((res) => {
+        if (res && res.success) {
+          res.data.menus.forEach(e => {
+            
+          });
+        }
+      });
+
+      //  getUserMenus({ userId: row.id }).then(rsp => {
+      //   if (rsp && rsp.success) {
+      //     this.userMenus = rsp.data.menus.map(menu => {
+      //       return menu.id
+      //     })
+      //   }
+      // })
     },
   },
-
   watch: {
     isManual(v) {
       this.isNtp = !v;
diff --git a/src/pages/systemSettings/views/NetSettings.vue b/src/pages/systemSettings/views/NetSettings.vue
index 246006a..c82ce15 100644
--- a/src/pages/systemSettings/views/NetSettings.vue
+++ b/src/pages/systemSettings/views/NetSettings.vue
@@ -41,7 +41,7 @@
                 size="small"
               ></el-input>
             </el-form-item>
-            <div class="save-btn">淇濆瓨</div>
+            <div class="save-btn" @click="saveServerName">淇濆瓨</div>
           </el-form>
         </div>
 
@@ -240,12 +240,13 @@
 
         <div class="wire" v-if="activePage == 'wire' && !inWireDetail">
           <div
+            
             class="wire-bar"
             v-for="(item, i) in wireArr"
             :key="i"
-            @click="checkWire(item)"
+            @click.self="checkWire(item)"
           >
-            <div class="name">{{ item.name }}</div>
+            <div class="name">{{ "缃戠粶" + item.index }}</div>
 
             <div class="right">
               <span class="icon iconfont">&#xe676;</span>
@@ -260,18 +261,18 @@
           </div>
         </div>
         <div class="wire-detail" v-if="activePage == 'wire' && inWireDetail">
-            <div class="title">缃戠粶璁剧疆</div>
+          <div class="title">缃戠粶璁剧疆</div>
           <el-form
             :model="wireForm"
             :rules="wireFormRules"
             ref="wireForm"
             label-width="150px"
           >
-     <el-form-item label="缃戠粶鍚嶇О" prop="name">
-              <div class="wifi-name">{{ 12123 }}</div>
+            <el-form-item label="缃戠粶鍚嶇О" prop="name">
+              <div class="wifi-name">{{"缃戠粶" + activeWireItem.index }}</div>
             </el-form-item>
-            <el-form-item label="缃戝崱" prop="name">
-              <div class="wifi-name">{{ 12123 }}</div>
+            <el-form-item label="缃戝崱" prop="ifname">
+              <div class="wifi-name">{{ activeWireItem.name }}</div>
             </el-form-item>
             <el-form-item label="IP" prop="ip">
               <ip-input
@@ -288,23 +289,22 @@
 
             <el-form-item label="缃戝叧" prop="gateway">
               <ip-input
-                :ip="ipv4Form.gateway"
-                @on-blur="ipv4Form.gateway = arguments[0]"
+                :ip="wireForm.gateway"
+                @on-blur="wireForm.gateway = arguments[0]"
               ></ip-input>
             </el-form-item>
-            <el-form-item label="棣栭�塂NS" prop="dns">
+            <el-form-item label="DNS" prop="dns">
               <ip-input
-                :ip="ipv4Form.dns1"
-                @on-blur="ipv4Form.dns1 = arguments[0]"
-              ></ip-input>
-            </el-form-item>
-            <el-form-item label="澶囩敤DNS" prop="dns">
-              <ip-input
-                :ip="ipv4Form.dns2"
-                @on-blur="ipv4Form.dns2 = arguments[0]"
+                :ip="wireForm.dns"
+                @on-blur="wireForm.dns = arguments[0]"
               ></ip-input>
             </el-form-item>
           </el-form>
+
+          <div class="btns">
+            <div class="cancel" @click="cancelSaveWire">鍙栨秷</div>
+            <div class="ok" @click="saveWire">淇濆瓨</div>
+          </div>
         </div>
       </div>
     </div>
@@ -328,6 +328,8 @@
   addESNode,
   getEsClusterInfo,
 } from "@/api/clusterManage";
+import { setServerName, getWireList, setNetWorkCard,getNetWorkCardInfo } from "@/api/system";
+
 import cloudNode from "../components/CloudNode";
 import ipInput from "@/components/subComponents/IPInput";
 import { isIPv4 } from "@/scripts/validate";
@@ -358,18 +360,20 @@
         name: "",
         password: "",
       },
-      wireArr: [{ name: "鏈夌嚎缃戠粶1" }, { name: "鏈夌嚎缃戠粶2" }],
+      wireArr: [],
       inWifiDetail: false,
       wifiList: [{ name: "鏃犵嚎缃戠粶1" }, { name: "鏃犵嚎缃戠粶2" }],
       isOpenWifi: false,
       inWireDetail: false,
-      wireForm:{
-
+      wireForm: {
+        dns:"",
+        subMask:"",
+        gateway:"",
+        ip:"",
       },
-      wireFormRules:{
-
-      },
+      wireFormRules: {},
       activePage: "net",
+      activeWireItem: {},
       rules: {
         deviceName: [
           { required: true, message: "璇疯緭鍏ヨ澶囧悕绉�", trigger: "change" },
@@ -401,8 +405,50 @@
   beforeDestroy() {},
   props: ["barName"],
   methods: {
+    fetchWireList() {
+      getWireList().then((res) => {
+        if (res && res.success) {
+          console.log(res);
+          this.wireArr = res.data;
+        }
+      });
+    },
+    cancelSaveWire() {
+      this.inWireDetail = false;
+    },
+    saveServerName() {
+      setServerName({
+        server_name: this.ruleForm.deviceName,
+        server_port: this.ruleForm.port,
+      }).then((res) => {
+        console.log(res);
+        if (res && res.success) {
+          this.$message.success(res.data);
+        }
+      });
+    },
     openRight(typ) {
       this.activePage = typ;
+      if (typ == "wire") {
+        this.fetchWireList();
+      }
+    },
+    saveWire(ifname) {
+      debugger
+      let data ={
+        ip: this.wireForm.ip,
+        gateway: this.wireForm.gateway,
+        dns: this.wireForm.dns,
+        subMask: this.wireForm.subMask,
+        ifname: this.activeWireItem.name,
+      }
+      setNetWorkCard(data).then((res) => {
+        if (res&&res.success) {
+          this.$message.success(res.data)
+        }
+      },(err) => {
+        this.$message.error("淇濆瓨澶辫触锛�"+ err.msg)
+      });
     },
     wifiControl(val) {},
     checkWifi() {
@@ -410,6 +456,18 @@
     },
     checkWire(item) {
       this.inWireDetail = true;
+      this.activeWireItem = item;
+      getNetWorkCardInfo({
+        ifname:item.name
+      }).then((res) => {
+        if (res&&res.success) {
+          debugger
+          this.wireForm.ip = res.data.ip
+          this.wireForm.gateway = res.data.gateway
+          this.wireForm.dns = res.data.dns
+          this.wireForm.subMask = res.data.subMask
+        }
+      })
     },
   },
 };
@@ -417,6 +475,27 @@
 <style lang="scss">
 .all {
   width: 100%;
+}
+.wire-detail {
+  .btns {
+    display: flex;
+    justify-content: space-between;
+    .cancel {
+      background-color: rgba(240, 240, 240, 1);
+      height: 40px;
+      line-height: 40px;
+      width: 48%;
+      border-radius: 10px;
+    }
+    .ok {
+      background-color: rgba(61, 104, 225, 1);
+      height: 40px;
+      line-height: 40px;
+      width: 48%;
+      color: #fff;
+      border-radius: 10px;
+    }
+  }
 }
 
 .cluster-content {
@@ -432,7 +511,8 @@
     overflow: auto;
     box-sizing: border-box;
     flex-shrink: 0;
-    padding: 10px;    border-right: 5px solid #f8f8f8;
+    padding: 10px;
+    border-right: 5px solid #f8f8f8;
 
     // background-color: lavender;
     .menu-item {

--
Gitblit v1.8.0