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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
| <template>
| <div class="card flex-c">
| <div class="card-title">
| <div class="flex-r">
| <div class="i"></div>
| {{ title }}
| </div>
| <el-checkbox v-model="checked"></el-checkbox>
| </div>
| <div class="card-content">
| <div class="row">
| 实时:
| <div class="value">18</div>
| <div class="btn"></div>
| </div>
| <div class="row">
| 模拟:
| <ip-input
| class="input"
| :onChange="change"
| :onBlur="blur"
| :ip="ip"
| ></ip-input>
| <div class="btn">
| <gradient-btn
| :active="setFlag"
| size="xs"
| :disabled="!hasPermission"
| >{{ setFlag ? "设定中" : "设定" }}</gradient-btn
| >
| </div>
| </div>
| </div>
| </div>
| </template>
|
| <script>
| import gradientBtn from "@/components/gradientBtn.vue";
| import IpInput from "@/components/ipInput.vue";
| export default {
| name: "",
| props: {
| title: {
| type: String,
| default: "我是标题",
| },
| setFlag: {
| type: Boolean,
| default: false,
| },
| ip: {
| type: String,
| required: true,
| },
| },
| data() {
| return {
| checked: true,
| num: 0,
| };
| },
| components: {
| gradientBtn,
| IpInput,
| },
| computed: {
| hasPermission() {
| return this.$store.state.user.downloadFlag == 1;
| },
| },
| methods: {
| change(value) {
| // console.log(value, 'ip change', value.split('.'));
| let segments = value.split(".");
| if (!segments.some((v) => v == "")) {
| // console.log(value, 'ip', this.ip);
| this.$emit("update:ip", value);
| this.$emit("change", value);
| }
| },
| blur(value) {
| // console.log(value, 'blur', this.ip);
| this.$emit("update:ip", value);
| this.$emit("blur", value);
| },
| },
|
| mounted() {},
| };
| </script>
|
| <style scoped lang="less">
| .flex-r {
| display: flex;
| flex-direction: row;
| }
| .flex-c {
| display: flex;
| flex-direction: column;
| }
| .card {
| height: 110px;
| border: 1px solid #3e8d9d;
| border-radius: 4px;
| color: #fff;
| overflow: hidden;
| .card-title {
| background: #0c4d77;
| height: 30px;
| display: flex;
| justify-content: space-between;
| align-items: center;
| padding-right: 6px;
| }
| .i {
| margin-left: 4px;
| margin-right: 6px;
| width: 20px;
| height: 20px;
| border-radius: 50%;
| background: #77edf6 url("../../../assets/images/gantan.png") 50% 50% / auto
| 60% no-repeat;
| }
| .card-content {
| flex: 1;
| background: #011f39;
| display: flex;
| flex-direction: column;
| padding: 6px;
| }
| .value {
| flex: 1;
| background: #fff;
| color: #000;
| margin-left: 6px;
| margin-right: 6px;
| padding-left: 6px;
| height: 26px;
| line-height: 26px;
| border-radius: 6px;
| }
| .input {
| color: #000;
| flex: 1;
| border-radius: 6px;
| margin-left: 6px;
| margin-right: 6px;
| :deep(.el-input__inner) {
| color: inherit;
| }
| }
| .btn {
| width: 76px;
| }
| .row {
| flex: 1;
| display: flex;
| align-items: center;
| }
| }
| </style>
|
|