zouyu
6 天以前 09f49269f00a1fa70bbf9d52476b01bf917c948e
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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
<template>
  <div class="fault-diagnosis-container">
    <el-row :gutter="20">
      <!-- 左侧:故障预警列表 -->
      <el-col :span="12">
        <el-card shadow="hover">
          <template #header>
            <div class="card-header">
              <span>故障预警列表</span>
            </div>
          </template>
          <el-table :data="warningList" stripe style="width: 100%" @row-click="handleWarningClick">
            <el-table-column prop="deviceName" label="设备名称" width="180"></el-table-column>
            <el-table-column prop="warningType" label="预警类型" width="120"></el-table-column>
            <el-table-column prop="riskLevel" label="风险等级" width="100">
              <template #default="scope">
                <el-tag :type="scope.row.riskLevel === 'high' ? 'danger' : scope.row.riskLevel === 'medium' ? 'warning' : 'info'">
                  {{ scope.row.riskLevel === 'high' ? '高' : scope.row.riskLevel === 'medium' ? '中' : '低' }}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column prop="occurTime" label="发生时间" width="180"></el-table-column>
            <el-table-column prop="status" label="处理状态" width="100">
              <template #default="scope">
                <el-tag :type="scope.row.status === 'pending' ? 'warning' : 'success'">
                  {{ scope.row.status === 'pending' ? '待处理' : '已处理' }}
                </el-tag>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
 
        <!-- 故障历史记录查询 -->
        <el-card shadow="hover" style="margin-top: 20px;">
          <template #header>
            <div class="card-header">
              <span>故障历史记录</span>
            </div>
          </template>
          <el-form :inline="true" :model="historyFilterForm" class="history-filter-form">
            <el-form-item label="设备">
              <el-select v-model="historyFilterForm.deviceId" placeholder="请选择设备" clearable>
                <el-option
                  v-for="device in devices"
                  :key="device.id"
                  :label="device.name"
                  :value="device.id"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="时间范围">
              <el-date-picker
                v-model="historyTimeRange"
                type="daterange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              ></el-date-picker>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="handleHistorySearch">查询</el-button>
            </el-form-item>
          </el-form>
          <el-table :data="historyList" stripe style="width: 100%" size="small">
            <el-table-column prop="deviceName" label="设备名称" width="150"></el-table-column>
            <el-table-column prop="faultType" label="故障类型" width="120"></el-table-column>
            <el-table-column prop="occurTime" label="发生时间" width="150"></el-table-column>
            <el-table-column prop="dealTime" label="处理时间" width="150"></el-table-column>
            <el-table-column prop="status" label="状态" width="100">
              <template #default="scope">
                <el-tag type="success">{{ scope.row.status }}</el-tag>
              </template>
            </el-table-column>
          </el-table>
          <div class="pagination-container">
            <el-pagination
              background
              layout="total, prev, pager, next"
              :total="historyList.length"
              :page-size="5"
              size="small"
            ></el-pagination>
          </div>
        </el-card>
      </el-col>
 
      <!-- 右侧:故障诊断结果 -->
      <el-col :span="12">
        <!-- 故障诊断结果 -->
        <el-card shadow="hover">
          <template #header>
            <div class="card-header">
              <span>故障诊断结果</span>
              <el-button type="primary" size="small" @click="handleDiagnosis">重新诊断</el-button>
            </div>
          </template>
          <div v-if="currentWarning" class="diagnosis-result">
            <h3>{{ currentWarning.deviceName }} - {{ currentWarning.warningType }}</h3>
            <el-descriptions :column="1" border>
              <el-descriptions-item label="风险等级">
                <el-tag :type="currentWarning.riskLevel === 'high' ? 'danger' : currentWarning.riskLevel === 'medium' ? 'warning' : 'info'">
                  {{ currentWarning.riskLevel === 'high' ? '高' : currentWarning.riskLevel === 'medium' ? '中' : '低' }}
                </el-tag>
              </el-descriptions-item>
              <el-descriptions-item label="发生时间">{{ currentWarning.occurTime }}</el-descriptions-item>
              <el-descriptions-item label="原因推测">{{ diagnosisResult.reason }}</el-descriptions-item>
              <el-descriptions-item label="影响范围">{{ diagnosisResult.impact }}</el-descriptions-item>
              <el-descriptions-item label="处理建议">{{ diagnosisResult.suggestion }}</el-descriptions-item>
            </el-descriptions>
          </div>
          <div v-else class="no-selection">
            <el-empty description="请选择一个预警项查看诊断结果"></el-empty>
          </div>
        </el-card>
 
        <!-- 预测性诊断结果 -->
        <el-card shadow="hover" style="margin-top: 20px;">
          <template #header>
            <div class="card-header">
              <span>预测性诊断结果(未来7日故障风险)</span>
            </div>
          </template>
          <div class="prediction-result">
            <el-timeline>
              <el-timeline-item
                v-for="item in predictionList"
                :key="item.date"
                :timestamp="item.date"
                :type="item.riskLevel === 'high' ? 'danger' : item.riskLevel === 'medium' ? 'warning' : 'success'"
              >
                <div class="timeline-content">
                  <h4>{{ item.deviceName }}</h4>
                  <p class="risk-level">
                    风险等级:
                    <el-tag :type="item.riskLevel === 'high' ? 'danger' : item.riskLevel === 'medium' ? 'warning' : 'success'">
                      {{ item.riskLevel === 'high' ? '高' : item.riskLevel === 'medium' ? '中' : '低' }}
                    </el-tag>
                  </p>
                  <p class="fault-type">可能故障类型:{{ item.possibleFault }}</p>
                  <p class="probability">发生概率:{{ item.probability }}%</p>
                </div>
              </el-timeline-item>
            </el-timeline>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>
 
<script setup>
import { ref, reactive } from 'vue'
 
// 设备列表
const devices = ref([
  { id: 'D001', name: '空压机A-001' },
  { id: 'D002', name: '冷却塔B-002' },
  { id: 'D003', name: '水泵C-003' },
  { id: 'D004', name: '发电机D-004' },
  { id: 'D005', name: '变压器E-005' }
])
 
// 故障预警列表
const warningList = ref([
  {
    id: 1,
    deviceName: '空压机A-001',
    warningType: '压力异常',
    riskLevel: 'high',
    occurTime: '2024-12-16 14:32:15',
    status: 'pending'
  },
  {
    id: 2,
    deviceName: '冷却塔B-002',
    warningType: '温度过高',
    riskLevel: 'medium',
    occurTime: '2024-12-16 14:30:45',
    status: 'pending'
  },
  {
    id: 3,
    deviceName: '水泵C-003',
    warningType: '振动过大',
    riskLevel: 'medium',
    occurTime: '2024-12-16 14:28:30',
    status: 'pending'
  },
  {
    id: 4,
    deviceName: '发电机D-004',
    warningType: '电流异常',
    riskLevel: 'high',
    occurTime: '2024-12-16 14:25:10',
    status: 'pending'
  },
  {
    id: 5,
    deviceName: '变压器E-005',
    warningType: '电压波动',
    riskLevel: 'low',
    occurTime: '2024-12-16 14:20:05',
    status: 'pending'
  }
])
 
// 当前选中的预警项
const currentWarning = ref(warningList.value[0])
 
// 故障诊断结果
const diagnosisResult = reactive({
  reason: '根据设备运行数据推测,故障原因可能是设备内部部件磨损导致的压力异常,需要进一步检查设备的活塞环和气缸套。',
  impact: '如果不及时处理,可能导致设备停机,影响生产线的正常运行,预计停机时间为4-6小时。',
  suggestion: '1. 立即安排维修人员进行设备检查;2. 检查设备的活塞环和气缸套;3. 更换磨损严重的部件;4. 检查设备的润滑系统,确保润滑正常。'
})
 
// 预测性诊断结果
const predictionList = ref([
  {
    date: '2024-12-17',
    deviceName: '空压机A-001',
    riskLevel: 'medium',
    possibleFault: '压力异常',
    probability: 65
  },
  {
    date: '2024-12-18',
    deviceName: '冷却塔B-002',
    riskLevel: 'high',
    possibleFault: '温度过高',
    probability: 85
  },
  {
    date: '2024-12-19',
    deviceName: '水泵C-003',
    riskLevel: 'medium',
    possibleFault: '振动过大',
    probability: 70
  },
  {
    date: '2024-12-20',
    deviceName: '发电机D-004',
    riskLevel: 'high',
    possibleFault: '电流异常',
    probability: 90
  },
  {
    date: '2024-12-21',
    deviceName: '变压器E-005',
    riskLevel: 'low',
    possibleFault: '电压波动',
    probability: 45
  },
  {
    date: '2024-12-22',
    deviceName: '空压机A-001',
    riskLevel: 'high',
    possibleFault: '压力异常',
    probability: 80
  },
  {
    date: '2024-12-23',
    deviceName: '冷却塔B-002',
    riskLevel: 'medium',
    possibleFault: '温度过高',
    probability: 60
  }
])
 
// 故障历史记录查询表单
const historyFilterForm = ref({
  deviceId: ''
})
 
// 历史记录时间范围
const historyTimeRange = ref([])
 
// 故障历史记录
const historyList = ref([
  {
    id: 1,
    deviceName: '空压机A-001',
    faultType: '压力异常',
    occurTime: '2024-12-15 08:30:00',
    dealTime: '2024-12-15 10:45:00',
    status: '已处理'
  },
  {
    id: 2,
    deviceName: '冷却塔B-002',
    faultType: '温度过高',
    occurTime: '2024-12-14 14:20:00',
    dealTime: '2024-12-14 16:15:00',
    status: '已处理'
  },
  {
    id: 3,
    deviceName: '水泵C-003',
    faultType: '振动过大',
    occurTime: '2024-12-13 09:15:00',
    dealTime: '2024-12-13 11:30:00',
    status: '已处理'
  },
  {
    id: 4,
    deviceName: '发电机D-004',
    faultType: '电流异常',
    occurTime: '2024-12-12 16:45:00',
    dealTime: '2024-12-12 18:30:00',
    status: '已处理'
  },
  {
    id: 5,
    deviceName: '变压器E-005',
    faultType: '电压波动',
    occurTime: '2024-12-11 11:20:00',
    dealTime: '2024-12-11 13:15:00',
    status: '已处理'
  }
])
 
// 处理预警项点击
const handleWarningClick = (row) => {
  currentWarning.value = row
}
 
// 重新诊断
const handleDiagnosis = () => {
  // 模拟重新诊断
  ElMessage.success('重新诊断完成')
}
 
// 处理历史记录查询
const handleHistorySearch = () => {
  // 模拟查询历史记录
  ElMessage.success('历史记录查询成功')
}
</script>
 
<style scoped>
.fault-diagnosis-container {
  padding: 20px;
  background-color: #f5f7fa;
  min-height: 100vh;
}
 
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
 
.diagnosis-result h3 {
  margin-bottom: 20px;
  color: #303133;
}
 
.no-selection {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}
 
.prediction-result {
  padding: 10px 0;
}
 
.timeline-content {
  padding: 10px;
  background-color: #fafafa;
  border-radius: 4px;
}
 
.timeline-content h4 {
  margin-bottom: 10px;
  color: #303133;
}
 
.timeline-content p {
  margin: 5px 0;
  font-size: 14px;
  color: #606266;
}
 
.risk-level {
  display: flex;
  align-items: center;
  gap: 5px;
}
 
.fault-type {
  color: #606266;
}
 
.probability {
  color: #606266;
}
 
.history-filter-form {
  margin-bottom: 20px;
  padding: 10px 0;
  border-bottom: 1px solid #ebeef5;
}
 
.pagination-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
</style>