he wei
2024-08-28 eae8e13756be83b51bd0eb233380b2e638e092f1
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
<script setup name="home">
import { ref, onMounted } from "vue";
import ycCard from "@/components/ycCard.vue";
import groupBar from "@/components/echarts/groupBar.vue";
import pie from "@/components/echarts/pie.vue";
import bar from "@/components/echarts/bar.vue";
import lineChart from "@/components/echarts/lineChart.vue";
import mapChart from "@/components/echarts/mapChart.vue";
import ledNum from "@/components/ledNum.vue";
 
const devBar = ref();
const alarmPie = ref();
const testBar = ref();
const jhTestBar = ref();
const testLine = ref();
const alarmType = ref(0);
const devType = ref(0);
const jhTestType = ref(0);
const ytjTestType = ref(0);
 
onMounted(() => {
  setTimeout(() => {
    devBar.value.updateChart(
      ["充放电一体机", "锂电池均衡仪"],
      [
        { name: "在线", data: [50, 3] },
        { name: "离线", data: [60, 8] },
      ]
    );
    alarmPie.value.updateChart([
      {
        name: "充放电一体机",
        value: 100,
      },
      {
        name: "锂电池均衡仪",
        value: 103,
      },
    ]);
    testBar.value.updateChart(["放电测试", "充电测试"], [243, 120]);
    jhTestBar.value.updateChart(
      ["放电测试", "充电测试", "循环测试"],
      [243, 50, 120]
    );
 
    testLine.value.updateChart(
      [
        "2024-08-15",
        "2024-08-16",
        "2024-08-17",
        "2024-08-18",
        "2024-08-19",
        "2024-08-20",
        "2024-08-21",
      ],
      [
        { name: "充电测试", data: [50, 0, 24, 5, 13, 22, 45] },
        { name: "放电测试", data: [60, 20, 55, 0, 75, 12, 8] },
      ]
    );
  }, 500);
});
</script>
 
<template>
  <div class="page-home grid">
    <yc-card class="item" title="设备状态统计">
      <group-bar ref="devBar" unit="台"></group-bar>
    </yc-card>
    <yc-card class="item">
      <div class="card-content">
        <div class="info">
          <div class="info-item">
            <div class="label">充放电一体机</div>
            <div class="value">
              <led-num :bits="4"></led-num>
            </div>
            <div class="unit">台</div>
          </div>
          <div class="info-item">
            <div class="label">锂电池均衡仪</div>
            <div class="value">
              <led-num :bits="4"></led-num>
            </div>
            <div class="unit">台</div>
          </div>
        </div>
        <div class="wrap-chart">
          <map-chart></map-chart>
        </div>
      </div>
    </yc-card>
    <yc-card class="item" title="设备历史告警统计">
      <template #tools>
        <el-radio-group v-model="alarmType" size="small" is-button>
          <el-radio-button :value="0">本月</el-radio-button>
          <el-radio-button :value="1">本年</el-radio-button>
        </el-radio-group>
      </template>
      <pie ref="alarmPie"></pie>
    </yc-card>
    <yc-card class="item" title="充放电一体机测试统计">
      <template #tools>
        <el-radio-group v-model="ytjTestType" size="small" is-button>
          <el-radio-button :value="0">本月</el-radio-button>
          <el-radio-button :value="1">本年</el-radio-button>
        </el-radio-group>
      </template>
      <bar ref="testBar" unit="次"></bar>
    </yc-card>
    <yc-card class="item" title="近一周电池测试趋势统计">
      <template #tools>
        <el-radio-group v-model="devType" size="small" is-button>
          <el-radio-button :value="0">充放电一体机</el-radio-button>
          <el-radio-button :value="1">锂电均衡仪</el-radio-button>
        </el-radio-group>
      </template>
      <line-chart ref="testLine" unit="次"></line-chart>
    </yc-card>
    <yc-card class="item" title="锂电均衡仪测试统计">
      <template #tools>
        <el-radio-group v-model="jhTestType" size="small" is-button>
          <el-radio-button :value="0">本月</el-radio-button>
          <el-radio-button :value="1">本年</el-radio-button>
        </el-radio-group>
      </template>
      <bar ref="jhTestBar" unit="次"></bar>
    </yc-card>
  </div>
</template>
 
<style scoped lang="less">
.page-home {
  height: 100%;
  padding: 6px;
}
.grid {
  display: grid;
  grid-template-rows: 1fr 1fr;
  grid-template-columns: 1fr 1.6fr 1fr;
  gap: 6px;
  .item {
    // background: gray;
  }
}
.card-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  .info {
    padding-top: 8px;
    display: flex;
    .info-item {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      .label {
        color: #0ff;
        font-size: 16px;
        margin-right: 0.4em;
        &::after {
          content: ":";
        }
      }
      .value {
        height: 38px;
      }
      .unit {
        font-size: 14px;
        align-self: flex-end;
        margin-left: 0.6em;
      }
    }
  }
  .wrap-chart {
    flex: 1;
    // position: relative;
  }
}
</style>