he wei
2024-10-08 96ee251c889b4a7cd65134658ac5c2d4d5fa1798
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<script setup>
import IconArrowRight from "@/components/icons/IconArrowRight.vue";
import { ref, computed } from "vue";
 
const props = defineProps({
  devIdcode: {
    type: [String, Number],
  },
  onLine: {
    type: Boolean,
    default: false,
  },
  devType: {
    type: Number,
  },
});
</script>
 
<template>
  <div :class="['dev-card', { pointer: onLine }]">
    <!-- 编号 -->
    <div class="header">
      <div class="dev-id">{{ devIdcode }}</div>
    </div>
    <!-- 测试中的需要显示实时数据 -->
    <div :class="['content', { offLine: !onLine }]">
      <!-- 左侧图片 -->
      <div
        :class="[
          'img',
          {
            ytgOn: 1 == props.devType && onLine,
            ytgOff: 1 == props.devType && !onLine,
            jhyOn: 2 == props.devType && onLine,
            jhyOff: 2 == props.devType && !onLine,
          },
        ]"
      >
        <!-- 右侧数据 -->
        <div class="info">
          <template v-if="1 == props.devType">
            <div class="item">
              49.5V
              <div class="link"></div>
            </div>
            <div class="item">
              0A
              <div class="link"></div>
            </div>
            <div class="item">
              33AH
              <div class="link"></div>
            </div>
            <div class="item">
              00:06:04
              <div class="link"></div>
            </div>
          </template>
          <template v-else>
            <div class="item index">
              #1
              <div class="link"></div>
            </div>
            <div class="item">
              均衡中
              <div class="link"></div>
            </div>
            <div class="item index">
              #2
              <div class="link"></div>
            </div>
            <div class="item">
              均衡暂停
              <div class="link"></div>
            </div>
          </template>
        </div>
      </div>
    </div>
    <div class="footer">
      <div
        v-if="!onLine"
        :class="['state', { onLine: onLine, offLine: !onLine }]"
      >
        {{ onLine ? "在线" : "离线" }}
      </div>
      <div class="wrap" v-else>
        <div class="workstate">充电测试</div>
        <icon-arrow-right class="icon"></icon-arrow-right>
      </div>
    </div>
  </div>
</template>
 
<style scoped lang="less">
.dev-card {
  background: #08819a;
  border-radius: 6px;
  width: 230px;
  height: 230px;
  display: flex;
  flex-direction: column;
  // align-items: center;
  .header {
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .content {
    flex: 1;
    background: #008080;
    position: relative;
    z-index: 0;
    padding: 12px;
    // display: flex;
    // justify-content: center;
 
    // align-items: center;
    // &::before {
    //   content: "";
    //   position: absolute;
    //   left: 20px;
    //   top: 20px;
    //   bottom: 20px;
    //   right: 20px;
    //   border: 1px #0ff solid;
    // }
    overflow: hidden;
    &.offLine {
      .img {
        margin-right: 0;
        .info {
          opacity: 0;
        }
      }
    }
    .img {
      height: 100%;
      margin-right: 104px;
      // flex: 1;
      // width: 100%;
      // height: 100%;
      border: 1px solid #0ff;
      transition: margin 0.3s linear;
      // margin-right: 20px;
      position: relative;
      &.ytgOn {
        background: url("@/assets/images/ytj-online.png") center center / auto
          88% no-repeat;
      }
      &.ytgOff {
        background: url("@/assets/images/ytj-offline.png") center center / auto
          88% no-repeat;
      }
      &.jhyOn {
        background: url("@/assets/images/jhy-online.png") center center / auto
          88% no-repeat;
      }
      &.jhyOff {
        background: url("@/assets/images/jhy-offline.png") center center / auto
          88% no-repeat;
      }
    }
    .info {
      position: absolute;
      left: 100%;
      height: 100%;
      transform: translateX(20px);
      display: flex;
      flex-direction: column;
      // align-self: stretch;
      justify-content: space-evenly;
      opacity: 1;
      width: 5.6em;
      transition: opacity 0.3s 0.2s linear;
      // width: 84px;
      .item {
        border: 1px solid #0ff;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        background: #333333;
        color: #f2ff1a;
        font-size: 14px;
        font-weight: bold;
        &.index {
          background: #999;
        }
        .link {
          position: absolute;
          background: url('data:image/svg+xml,%3csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 60" stroke-width="6" stroke="%230ff" fill="none"%3e%3cpath d="M0,10h40,q10,0,10,10v20q0,10,-10,10h-40"%3e%3c/path%3e%3cpath d="M50,30h100"%3e%3c/path%3e%3cpath d="M200,10h-40,q-10,0,-10,10v20q0,10,10,10h40"%3e%3c/path%3e%3c/svg%3e')
            center center / 100% 100% no-repeat;
          width: 20px;
          height: 6px;
          right: 100%;
          transform: translateX(-1px);
        }
      }
    }
    // background: #000;
  }
  &.offline {
    background: #ccc;
  }
  .footer {
    padding: 8px 16px;
    .wrap {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .icon {
        font-size: 24px;
      }
    }
  }
  .center {
    text-align: center;
  }
  .state {
    font-size: 16px;
    font-weight: bold;
    &.onLine {
      color: #0f0;
    }
    &.offLine {
      color: #ccc;
    }
  }
}
</style>