zhangzengfei
2022-07-20 4a800a8fc83c6bd1f86a8e847b079a51a7532c09
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<template>
  <div class="formNet">
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="网卡">
        <el-select
          v-model="form.netName"
          placeholder="请选择网卡"
          popper-class="formNet_select"
        >
          <el-option
            v-for="(item, index) in options"
            :key="index"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item>
 
      <el-form-item label="IP">
        <ipInput :ip="form.ip" @on-blur="form.ip = arguments[0]"></ipInput>
      </el-form-item>
 
      <el-form-item label="子网掩码">
        <ipInput
          :ip="form.subMask"
          @on-blur="form.subMask = arguments[0]"
        ></ipInput>
      </el-form-item>
 
      <el-form-item label="网关">
        <ipInput
          :ip="form.gateway"
          @on-blur="form.gateway = arguments[0]"
        ></ipInput>
      </el-form-item>
 
      <el-form-item label="DNS">
        <ipInput :ip="form.dns" @on-blur="form.dns = arguments[0]"></ipInput>
      </el-form-item>
    </el-form>
  </div>
</template>
 
<script>
import ipInput from "../components/IPInput";
import { networkList } from "../api";
 
export default {
  created() {
    this.networkList();
  },
  data() {
    return {
      form: { netName: "", ip: "", subMask: "", gateway: "", dns: "" },
 
      options: [],
    };
  },
  components: {
    ipInput,
  },
  methods: {
    getFormData() {
      return this.form;
    },
    async networkList() {
      const res = await networkList();
      res.data.forEach((item) => {
        this.options.push({
          value: item.name,
          label: item.name,
        });
      });
    },
  },
};
</script>
 
<style lang="scss" scoped>
.formNet {
  .el-form-item ::v-deep {
    label {
      font-size: 14px;
      color: #fff;
      text-align-last: left;
    }
 
    .el-form-item__content {
      margin-left: 110px !important;
    }
  }
 
  .ip-input-container ::v-deep {
    background-color: rgba(0, 0, 0, 0.1);
    border: none !important;
    height: 40px;
    max-width: none;
 
    .ip-segment-input {
      color: #fff;
    }
  }
 
  .el-select ::v-deep {
    width: 100%;
 
    input {
      background-color: rgba(0, 0, 0, 0.1);
      border: none !important;
      color: #fff;
    }
  }
}
</style>
 
<style lang="scss">
.el-select-dropdown.el-popper.formNet_select {
  background-color: rgb(60, 62, 99);
 
  border: none;
  margin: 0 0;
  z-index: 5;
 
  * {
    color: #fff;
  }
 
  li {
    z-index: 4;
  }
  .el-select-dropdown__item.hover {
    background-color: rgba(85, 82, 117) !important;
  }
 
  .popper__arrow::after,
  .popper__arrow {
    display: none;
  }
}
</style>