he wei
2025-02-15 b4edb3bb6e4a943884e991e8f5aecc7633c36452
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
<template>
  <div :class="['circle', 'type-' + type]">
    <!-- 数值 -->
    <div class="value">{{ value }}</div>
    <!-- 名称 -->
    <div class="name">
      {{ name }}
    </div>
  </div>
</template>
 
<script>
export default {
  name: "",
  props: {
    type: {
      type: Number,
      default: 0,
    },
    value: {
      type: Number,
      default: 0,
    },
  },
  computed: {
    name() {
      const type = this.type;
      let res = "";
      switch (type) {
        case 0:
          res = "内阻测试";
          break;
        case 1:
          res = "核容测试";
          break;
        case 2:
          res = "直连充电";
          break;
        case 3:
          res = "通信故障";
          break;
      }
      return res;
    },
  },
  data() {
    return {};
  },
  components: {},
  methods: {},
 
  mounted() {},
};
</script>
 
<style scoped lang="less">
.circle {
  cursor: pointer;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  &.type-0 {
    --bgcolor: #2f70da;
    --opacityColor: rgba(47,112,218,.3);
  }
  &.type-1 {
    --bgcolor: #70b603;
    --opacityColor: rgba(112,182,3,.3);
  }
  &.type-2 {
    --bgcolor: #d9001b;
    --opacityColor: rgba(217,0,27,.3);
  }
  &.type-3 {
    --bgcolor: #aaa;
    --opacityColor: rgba(170,170,170,.3);
  }
  .value {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    font-size: 22px;
    font-weight: bold;
    // background-color: var(--bgcolor);
    background: radial-gradient(circle closest-side at center, var(--opacityColor) 0, var(--opacityColor) 66%, var(--bgcolor) 69%, var(--bgcolor) 73%, transparent 74%, transparent 83%, var(--bgcolor) 88%, var(--bgcolor) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .name {
    font-size: 14px;
    align-self: stretch;
    margin-top: 10px;
    border-radius: 10px;
    padding: 2px 0;
    background-color: var(--bgcolor);
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
</style>