From ccee429d379e0108b7445f72ade8d97c110a6fb3 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期二, 09 十一月 2021 18:01:59 +0800
Subject: [PATCH] 问题修复

---
 src/pages/systemSettings/views/NetSettings.vue |   71 +++++++++++++++++++++++++----------
 1 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/src/pages/systemSettings/views/NetSettings.vue b/src/pages/systemSettings/views/NetSettings.vue
index 600cf6e..c7444eb 100644
--- a/src/pages/systemSettings/views/NetSettings.vue
+++ b/src/pages/systemSettings/views/NetSettings.vue
@@ -57,9 +57,9 @@
 
             <div class="more-detail">
               <span class="icon iconfont">&#xe676;</span>
-              <span 
+              <span
                 class="icon iconfont"
-                style="margin-left:10px;cursor:pointer;"
+                style="margin-left: 10px; cursor: pointer"
                 @click="checkWifi(item)"
                 >&#xe640;</span
               >
@@ -233,12 +233,15 @@
               <span class="icon iconfont">&#xe676;</span>
 
               <el-switch
-                v-model="value"
+                v-model="item.active"
                 active-color="rgba(61, 104, 225, 1)"
-                @change="switchChange"
+                @change="switchNetCard"
               >
               </el-switch>
             </div>
+
+
+            
           </div>
         </div>
         <div
@@ -320,7 +323,7 @@
   getDevInfo,
 } from "@/api/system";
 
-import cloudNode from "../components/CloudNode";
+// import cloudNode from "../components/CloudNode";
 import ipInput from "@/components/subComponents/IPInput";
 import { isIPv4 } from "@/scripts/validate";
 import switchBar from "../components/switchBar";
@@ -389,10 +392,11 @@
         },
       ],
       value: "",
+      netCardValue: "",
     };
   },
   components: {
-    cloudNode,
+    // cloudNode,
     ipInput,
     switchBar,
   },
@@ -403,6 +407,13 @@
   beforeDestroy() {},
   props: ["barName"],
   methods: {
+    // parseFlags(flags) {
+    //   let arr = flags.split("|");
+    //   if (arr.length) {
+    //     return arr[0] == "up";
+    //   }
+    //   return false;
+    // },
     getCurServer() {
       getDevInfo().then((res) => {
         this.ruleForm.deviceName = res.data.server_name;
@@ -412,16 +423,32 @@
     fetchWireList() {
       getWireList().then((res) => {
         if (res && res.success) {
-          this.wireArr = res.data;
+          this.wireArr = res.data
+            .filter((x) => x.wireless == false)
+            .map((itm) => {
+              let arr = itm.flags.split("|");
+              let f = false;
+              if (arr.length) {
+                f = arr[0] == "up";
+              }
+              return {
+                flags: itm.flags,
+                index: itm.index,
+                mtu:itm.mtu,
+                name: itm.name,
+                wireless: itm.wireless,
+                active:f
+              }
+            });
         }
       });
     },
     cancelSaveWire() {
       this.inWireDetail = false;
-      this.wireForm.ip = '';
-          this.wireForm.gateway = '';
-          this.wireForm.dns = '';
-          this.wireForm.subMask = '';
+      this.wireForm.ip = "";
+      this.wireForm.gateway = "";
+      this.wireForm.dns = "";
+      this.wireForm.subMask = "";
     },
     saveServerName() {
       setServerName({
@@ -447,7 +474,6 @@
       this.$refs["leftbar"][i].style.color = "white";
     },
     saveWire(ifname) {
-      debugger;
       let data = {
         ip: this.wireForm.ip,
         gateway: this.wireForm.gateway,
@@ -475,16 +501,19 @@
       this.activeWireItem = item;
       getNetWorkCardInfo({
         ifname: item.name,
-      }).then((res) => {
-        if (res && res.success) {
-          this.wireForm.ip = res.data.ip;
-          this.wireForm.gateway = res.data.gateway;
-          this.wireForm.dns = res.data.dns;
-          this.wireForm.subMask = res.data.subMask;
+      }).then(
+        (res) => {
+          if (res && res.success) {
+            this.wireForm.ip = res.data.ip;
+            this.wireForm.gateway = res.data.gateway;
+            this.wireForm.dns = res.data.dns;
+            this.wireForm.subMask = res.data.subMask;
+          }
+        },
+        (err) => {
+          this.$message.error("鏌ユ壘涓嶅埌鏁版嵁: " + err.msg);
         }
-      },(err) => {
-        this.$message.error("鏌ユ壘涓嶅埌鏁版嵁: "+err.msg)
-      });
+      );
     },
   },
 };

--
Gitblit v1.8.0