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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
| <template>
| <div class="dashboard-container">
| <!-- 统计卡片 -->
| <el-row :gutter="20">
| <el-col :span="6">
| <el-card class="statistics-card" shadow="hover">
| <div class="card-content">
| <div class="card-title">设备在线率</div>
| <div class="card-value">{{ onlineRate }}%</div>
| <div class="card-desc">
| 当前在线设备数:{{ onlineCount }} / {{ totalDevices }}
| </div>
| </div>
| </el-card>
| </el-col>
| <el-col :span="6">
| <el-card class="statistics-card" shadow="hover">
| <div class="card-content">
| <div class="card-title">故障预警数</div>
| <div class="card-value">{{ warningCount }}</div>
| <div class="card-desc">
| 高风险:{{ highRiskCount }} | 中风险:{{ mediumRiskCount }} |
| 低风险:{{ lowRiskCount }}
| </div>
| </div>
| </el-card>
| </el-col>
| <el-col :span="6">
| <el-card class="statistics-card" shadow="hover">
| <div class="card-content">
| <div class="card-title">待处理维修单</div>
| <div class="card-value">{{ pendingOrders }}</div>
| <div class="card-desc">
| 处理中:{{ processingOrders }} | 已完成:{{ completedOrders }}
| </div>
| </div>
| </el-card>
| </el-col>
| <el-col :span="6">
| <el-card class="statistics-card" shadow="hover">
| <div class="card-content">
| <div class="card-title">重点设备运行状态</div>
| <div class="card-value">{{ normalDevices }} 正常</div>
| <div class="card-desc">
| 异常:{{ abnormalDevices }} | 故障:{{ faultDevices }}
| </div>
| </div>
| </el-card>
| </el-col>
| </el-row>
|
| <!-- 图表区域 -->
| <el-row :gutter="20" style="margin-top: 20px">
| <!-- 设备健康度趋势图 -->
| <el-col :span="12">
| <el-card shadow="hover">
| <template #header>
| <div class="card-header">
| <span>设备健康度趋势图</span>
| </div>
| </template>
| <div ref="healthChartRef" class="chart-container"></div>
| </el-card>
| </el-col>
| <!-- 近7日故障类型统计 -->
| <el-col :span="12">
| <el-card shadow="hover">
| <template #header>
| <div class="card-header">
| <span>近7日故障类型统计</span>
| </div>
| </template>
| <div ref="faultChartRef" class="chart-container"></div>
| </el-card>
| </el-col>
| </el-row>
|
| <!-- 重点设备运行状态卡片 -->
| <el-card shadow="hover" style="margin-top: 20px">
| <template #header>
| <div class="card-header">
| <span>重点设备运行状态</span>
| </div>
| </template>
| <el-table :data="keyDevices" stripe style="width: 100%">
| <el-table-column
| prop="name"
| label="设备名称"
| width="180"
| ></el-table-column>
| <el-table-column
| prop="model"
| label="型号"
| width="120"
| ></el-table-column>
| <el-table-column prop="ip" label="IP地址" width="150"></el-table-column>
| <el-table-column prop="status" label="状态" width="100">
| <template #default="scope">
| <el-tag
| :type="
| scope.row.status === 'online'
| ? 'success'
| : scope.row.status === 'warning'
| ? 'warning'
| : 'danger'
| "
| >
| {{
| scope.row.status === "online"
| ? "在线"
| : scope.row.status === "warning"
| ? "预警"
| : "故障"
| }}
| </el-tag>
| </template>
| </el-table-column>
| <el-table-column
| prop="temperature"
| label="温度(℃)"
| width="100"
| ></el-table-column>
| <el-table-column
| prop="pressure"
| label="压力(MPa)"
| width="100"
| ></el-table-column>
| <el-table-column
| prop="speed"
| label="转速(rpm)"
| width="100"
| ></el-table-column>
| <el-table-column prop="health" label="健康度" width="120">
| <template #default="scope">
| <el-progress
| :percentage="scope.row.health"
| :stroke-width="10"
| ></el-progress>
| </template>
| </el-table-column>
| </el-table>
| </el-card>
| </div>
| </template>
|
| <script setup>
| import { ref, onMounted, onUnmounted } from "vue";
| import * as echarts from "echarts";
|
| // 统计数据
| const onlineRate = ref(85);
| const onlineCount = ref(170);
| const totalDevices = ref(200);
| const warningCount = ref(23);
| const highRiskCount = ref(5);
| const mediumRiskCount = ref(12);
| const lowRiskCount = ref(6);
| const pendingOrders = ref(15);
| const processingOrders = ref(8);
| const completedOrders = ref(45);
| const normalDevices = ref(162);
| const abnormalDevices = ref(18);
| const faultDevices = ref(10);
|
| // 重点设备列表
| const keyDevices = ref([
| {
| name: "空压机A-001",
| model: "KA-200",
| ip: "192.168.1.101",
| status: "online",
| temperature: 42,
| pressure: 0.8,
| speed: 1450,
| health: 92,
| },
| {
| name: "冷却塔B-002",
| model: "CT-300",
| ip: "192.168.1.102",
| status: "warning",
| temperature: 58,
| pressure: 0.6,
| speed: 980,
| health: 75,
| },
| {
| name: "水泵C-003",
| model: "WP-150",
| ip: "192.168.1.103",
| status: "online",
| temperature: 38,
| pressure: 1.2,
| speed: 1200,
| health: 88,
| },
| {
| name: "发电机D-004",
| model: "GE-500",
| ip: "192.168.1.104",
| status: "danger",
| temperature: 75,
| pressure: 0.5,
| speed: 1500,
| health: 60,
| },
| {
| name: "变压器E-005",
| model: "TR-1000",
| ip: "192.168.1.105",
| status: "online",
| temperature: 45,
| pressure: 0,
| speed: 0,
| health: 95,
| },
| ]);
|
| // 图表引用
| const healthChartRef = ref(null);
| const faultChartRef = ref(null);
| let healthChart = null;
| let faultChart = null;
|
| // 健康度趋势数据
| const healthTrendData = {
| dates: ["12-10", "12-11", "12-12", "12-13", "12-14", "12-15", "12-16"],
| values: [88, 90, 85, 87, 92, 91, 93],
| };
|
| // 故障类型统计数据
| const faultTypeData = {
| types: ["温度异常", "压力超标", "转速异常", "振动过大", "其他"],
| values: [15, 8, 12, 6, 3],
| };
|
| // 初始化健康度趋势图
| const initHealthChart = () => {
| if (healthChartRef.value) {
| healthChart = echarts.init(healthChartRef.value);
| const option = {
| tooltip: {
| trigger: "axis",
| axisPointer: {
| type: "cross",
| label: {
| backgroundColor: "#6a7985",
| },
| },
| },
| grid: {
| left: "3%",
| right: "4%",
| bottom: "3%",
| containLabel: true,
| },
| xAxis: {
| type: "category",
| boundaryGap: false,
| data: healthTrendData.dates,
| },
| yAxis: {
| type: "value",
| min: 70,
| max: 100,
| name: "健康度(%)",
| },
| series: [
| {
| name: "健康度",
| type: "line",
| stack: "总量",
| areaStyle: {},
| emphasis: {
| focus: "series",
| },
| data: healthTrendData.values,
| itemStyle: {
| color: "#67c23a",
| },
| lineStyle: {
| width: 3,
| },
| },
| ],
| };
| healthChart.setOption(option);
| }
| };
|
| // 初始化故障类型统计饼图
| const initFaultChart = () => {
| if (faultChartRef.value) {
| faultChart = echarts.init(faultChartRef.value);
| const option = {
| tooltip: {
| trigger: "item",
| },
| legend: {
| orient: "vertical",
| left: "left",
| },
| series: [
| {
| name: "故障类型",
| type: "pie",
| radius: "50%",
| data: faultTypeData.types.map((type, index) => ({
| name: type,
| value: faultTypeData.values[index],
| })),
| emphasis: {
| itemStyle: {
| shadowBlur: 10,
| shadowOffsetX: 0,
| shadowColor: "rgba(0, 0, 0, 0.5)",
| },
| },
| },
| ],
| };
| faultChart.setOption(option);
| }
| };
|
| // 监听窗口大小变化,调整图表大小
| const handleResize = () => {
| healthChart?.resize();
| faultChart?.resize();
| };
|
| onMounted(() => {
| initHealthChart();
| initFaultChart();
| window.addEventListener("resize", handleResize);
| });
|
| onUnmounted(() => {
| window.removeEventListener("resize", handleResize);
| healthChart?.dispose();
| faultChart?.dispose();
| });
| </script>
|
| <style scoped>
| .dashboard-container {
| padding: 20px;
| background-color: #f5f7fa;
| min-height: 100vh;
| }
|
| .statistics-card {
| height: 180px;
| }
|
| .card-content {
| display: flex;
| flex-direction: column;
| height: 100%;
| justify-content: center;
| align-items: center;
| }
|
| .card-title {
| font-size: 16px;
| color: #606266;
| margin-bottom: 10px;
| }
|
| .card-value {
| font-size: 32px;
| font-weight: bold;
| color: #303133;
| margin-bottom: 8px;
| }
|
| .card-desc {
| font-size: 14px;
| color: #909399;
| }
|
| .card-header {
| display: flex;
| justify-content: space-between;
| align-items: center;
| }
|
| .chart-container {
| width: 100%;
| height: 350px;
| }
| </style>
|
|