Merge remote-tracking branch 'origin/boardTest' into boardTest

boardTest
夜笙歌 3 weeks ago
commit 477f133b1d

@ -25,6 +25,7 @@ export default {
return {
// WebSocket
websocket: null,
// websocketUrl: 'ws://10.42.0.1:7181/ws',
websocketUrl: 'ws://119.45.202.115:7181/ws',
isWebSocketConnected: false,
reconnectTimer: null,

@ -30,20 +30,21 @@
</span>
</el-tooltip>
<!-- WebSocket连接状态指示器 -->
<!-- WebSocket连接状态指示器 - 已注释改用全局管理 -->
<!--
<el-tooltip :content="websocketStatusText" effect="dark" placement="bottom">
<span class="websocket-status right-menu-item">
<i :class="websocketStatusIcon" :style="{ color: websocketStatusColor }"></i>
</span>
</el-tooltip>
<!-- 告警队列状态指示器 -->
<el-tooltip :content="alarmQueueStatusText" effect="dark" placement="bottom">
<span class="alarm-queue-status right-menu-item" @click="showQueueStatus">
<i class="el-icon-collection" :style="{ color: queueStatusColor }"></i>
<span v-if="alarmQueueLength > 0" class="queue-count">{{ alarmQueueLength }}</span>
</span>
</el-tooltip>
-->
<screenfull id="screenfull" class="right-menu-item hover-effect"/>
@ -209,7 +210,8 @@
</div>
</el-dialog>
<!-- 实时告警弹窗 -->
<!-- 实时告警弹窗 - 已注释使用全局弹窗代替 -->
<!--
<el-dialog
title="⚠️ 实时告警通知"
:visible.sync="realtimeAlarmDialog"
@ -220,10 +222,8 @@
class="realtime-alarm-dialog"
>
<el-tabs v-model="realtimeActiveTab" type="card">
<!-- 告警详情标签页 -->
<el-tab-pane label="告警详情" name="alarmDetail">
<div v-if="currentRealtimeAlarm" class="alarm-content">
<!-- 设备信息 -->
<div class="alarm-section">
<h3 class="section-title">📟 设备信息</h3>
<el-row :gutter="16">
@ -242,7 +242,6 @@
</el-row>
</div>
<!-- 设备当前数据 -->
<div class="alarm-section" v-if="currentRealtimeAlarm.deviceParam">
<h3 class="section-title">📊 设备当前数据</h3>
<el-row :gutter="16">
@ -314,7 +313,6 @@
</el-row>
</div>
<!-- 触发的告警规则 -->
<div class="alarm-section"
v-if="currentRealtimeAlarm.alarmRules && currentRealtimeAlarm.alarmRules.length > 0">
<h3 class="section-title">🚨 触发的告警规则</h3>
@ -339,7 +337,6 @@
</div>
</div>
<!-- 告警内容详情 -->
<div class="alarm-section"
v-if="currentRealtimeAlarm.alarmContents && currentRealtimeAlarm.alarmContents.length > 0">
<h3 class="section-title">📋 告警内容详情</h3>
@ -361,7 +358,6 @@
</div>
</el-tab-pane>
<!-- 处置措施标签页 -->
<el-tab-pane label="处置措施" name="realtimeActionSteps">
<div v-if="currentRealtimeAlarm">
<el-alert
@ -391,12 +387,10 @@
<span class="step-title">{{ step.stepSequence }}</span>
</div>
<!-- 步骤描述 -->
<div class="step-description">
<p>{{ step.description }}</p>
</div>
<!-- 步骤图片 -->
<div v-if="step.stepImages && step.stepImages.length > 0" class="step-images">
<div class="images-title">参考图片</div>
<div class="image-gallery">
@ -412,7 +406,6 @@
</div>
</div>
<!-- 步骤备注 -->
<div v-if="step.remark" class="step-remark">
<el-tag type="info" size="small">备注{{ step.remark }}</el-tag>
</div>
@ -441,6 +434,7 @@
</el-button>
</div>
</el-dialog>
-->
</div>
</template>
@ -458,7 +452,7 @@ import RuoYiDoc from '@/components/RuoYi/Doc'
import settings from '@/settings'
import {handleExceptions, listRecordAlarmData} from '@/api/ems/record/recordAlarmData'
import {getEmsAlarmActionStepsByRuleId, getEmsAlarmActionStepsByAlarmInfo} from '@/api/ems/base/emsAlarmActionStep'
import {saveWebSocketAlarmData} from '@/api/ems/record/recordAlarmData'
// import {saveWebSocketAlarmData} from '@/api/ems/record/recordAlarmData' //
export default {
dicts: ['alarm_type', 'alarm_status'],
@ -492,61 +486,61 @@ export default {
imagePreviewVisible: false,
previewImageUrl: '',
// WebSocket
realtimeAlarmDialog: false,
currentRealtimeAlarm: null,
alarmProcessing: false,
currentAlarmId: null,
alarmProcessedCallback: null,
alarmTimeoutCallback: null,
websocketStatusText: '',
websocketStatusIcon: '',
websocketStatusColor: '',
alarmQueueStatusText: '',
queueStatusColor: '',
alarmQueueLength: 0,
queueStatusTimer: null,
// WebSocket -
// realtimeAlarmDialog: false,
// currentRealtimeAlarm: null,
// alarmProcessing: false,
// currentAlarmId: null,
// alarmProcessedCallback: null,
// alarmTimeoutCallback: null,
// websocketStatusText: '',
// websocketStatusIcon: '',
// websocketStatusColor: '',
// alarmQueueStatusText: '',
// queueStatusColor: '',
// alarmQueueLength: 0,
// queueStatusTimer: null //
//
realtimeActiveTab: 'alarmDetail',
realtimeActionSteps: [],
realtimeActionStepsLoading: false
// -
// realtimeActiveTab: 'alarmDetail',
// realtimeActionSteps: [],
// realtimeActionStepsLoading: false
}
},
created() {
localStorage.setItem('this.alarmDataTotal', 0)
// WebSocket
this.$bus.$on('websocket-alarm-with-callback', this.handleQueuedRealtimeAlarm)
//
this.$bus.$on('websocket-alarm-auto-save', this.handleAutoSaveAlarm)
// WebSocket
this.$bus.$on('websocket-connected', this.onWebSocketConnected)
this.$bus.$on('websocket-disconnected', this.onWebSocketDisconnected)
this.$bus.$on('websocket-max-retries-reached', this.onWebSocketMaxRetriesReached)
// WebSocket -
// this.$bus.$on('websocket-alarm-with-callback', this.handleQueuedRealtimeAlarm)
// -
// this.$bus.$on('websocket-alarm-auto-save', this.handleAutoSaveAlarm)
// WebSocket -
// this.$bus.$on('websocket-connected', this.onWebSocketConnected)
// this.$bus.$on('websocket-disconnected', this.onWebSocketDisconnected)
// this.$bus.$on('websocket-max-retries-reached', this.onWebSocketMaxRetriesReached)
},
beforeDestroy() {
//
this.$bus.$off('websocket-alarm-with-callback', this.handleQueuedRealtimeAlarm)
this.$bus.$off('websocket-alarm-auto-save', this.handleAutoSaveAlarm)
this.$bus.$off('websocket-connected', this.onWebSocketConnected)
this.$bus.$off('websocket-disconnected', this.onWebSocketDisconnected)
this.$bus.$off('websocket-max-retries-reached', this.onWebSocketMaxRetriesReached)
// -
// this.$bus.$off('websocket-alarm-with-callback', this.handleQueuedRealtimeAlarm)
// this.$bus.$off('websocket-alarm-auto-save', this.handleAutoSaveAlarm)
// this.$bus.$off('websocket-connected', this.onWebSocketConnected)
// this.$bus.$off('websocket-disconnected', this.onWebSocketDisconnected)
// this.$bus.$off('websocket-max-retries-reached', this.onWebSocketMaxRetriesReached)
//
if (this.queueStatusTimer) {
clearInterval(this.queueStatusTimer)
this.queueStatusTimer = null
}
// -
// if (this.queueStatusTimer) {
// clearInterval(this.queueStatusTimer)
// this.queueStatusTimer = null
// }
},
mounted() {
// WebSocket
this.getAlarmData()
//
this.queueStatusTimer = setInterval(() => {
this.updateQueueStatus()
}, 2000) // 2
// -
// this.queueStatusTimer = setInterval(() => {
// this.updateQueueStatus()
// }, 2000) // 2
},
components: {
Breadcrumb,
@ -692,7 +686,8 @@ export default {
const baseURL = process.env.VUE_APP_BASE_API || '';
return baseURL + relativePath;
},
// WebSocket
// WebSocket -
/*
handleQueuedRealtimeAlarm(data) {
console.log('收到队列化实时告警:', data)
@ -729,7 +724,9 @@ export default {
console.error('播放提示音失败:', error)
}
},
// WebSocket
*/
// WebSocket -
/*
async saveRealtimeAlarmData(alarmData, alarmStatus = 1) {
try {
// EmsRecordAlarmData
@ -848,7 +845,9 @@ export default {
return null
}
},
//
*/
// -
/*
async closeRealtimeAlarmDialog() {
if (this.currentRealtimeAlarm) {
this.alarmProcessing = true
@ -911,7 +910,9 @@ export default {
this.realtimeActionSteps = []
this.realtimeActionStepsLoading = false
},
//
*/
// -
/*
formatAlarmTime(time) {
if (!time) return '--'
try {
@ -921,6 +922,7 @@ export default {
return time
}
},
*/
//
getFieldName(fieldCode) {
const fieldMap = {
@ -936,7 +938,8 @@ export default {
}
return fieldMap[fieldCode] || '未知字段'
},
// WebSocket
// WebSocket -
/*
onWebSocketConnected() {
console.log('WebSocket连接成功')
this.websocketStatusText = 'WebSocket连接成功'
@ -971,6 +974,9 @@ export default {
}
})
},
*/
// -
/*
showQueueStatus() {
//
if (this.$root.getAlarmQueueStatus) {
@ -992,6 +998,9 @@ export default {
this.$message.info('无法获取队列状态信息')
}
},
*/
// -
/*
updateQueueStatus() {
// App.vue
if (this.$root.getAlarmQueueStatus) {
@ -1048,6 +1057,7 @@ export default {
this.realtimeActionStepsLoading = false
}
}
*/
}
}
</script>
@ -1236,7 +1246,8 @@ export default {
text-align: center;
}
//
// -
/*
.realtime-alarm-dialog {
.el-dialog__header {
background: linear-gradient(135deg, #ff4757, #ff6b7a);
@ -1358,7 +1369,7 @@ export default {
}
}
// WebSocket
// WebSocket -
.websocket-status {
display: inline-flex;
align-items: center;
@ -1403,6 +1414,7 @@ export default {
animation: pulse 2s infinite;
}
}
*/
@keyframes pulse {
0% {

@ -130,22 +130,6 @@
</div>
</div>
<div class="data-row" v-if="device.illuminance !== null && device.illuminance !== undefined">
<div class="data-item">
<i class="data-icon el-icon-sunny"></i>
<span class="data-label">照度</span>
<span class="data-value">{{ formatValue(device.illuminance, 'lx') }}</span>
</div>
</div>
<div class="data-row" v-if="device.concentration !== null && device.concentration !== undefined">
<div class="data-item">
<i class="data-icon el-icon-warning-outline"></i>
<span class="data-label">硫化氢</span>
<span class="data-value">{{ formatValue(device.concentration, 'ppm') }}</span>
</div>
</div>
<div class="data-row" v-if="device.vibrationSpeed !== null && device.vibrationSpeed !== undefined">
<div class="data-item">
<i class="data-icon el-icon-s-operation"></i>
@ -154,6 +138,30 @@
</div>
</div>
<div class="data-row" v-if="device.vibrationDisplacement !== null && device.vibrationDisplacement !== undefined">
<div class="data-item">
<i class="data-icon el-icon-s-operation"></i>
<span class="data-label">振动位移</span>
<span class="data-value">{{ formatValue(device.vibrationDisplacement, 'um') }}</span>
</div>
</div>
<div class="data-row" v-if="device.vibrationAcceleration !== null && device.vibrationAcceleration !== undefined">
<div class="data-item">
<i class="data-icon el-icon-s-operation"></i>
<span class="data-label">振动加速度</span>
<span class="data-value">{{ formatValue(device.vibrationAcceleration, 'g') }}</span>
</div>
</div>
<div class="data-row" v-if="device.vibrationTemp !== null && device.vibrationTemp !== undefined">
<div class="data-item">
<i class="data-icon el-icon-s-operation"></i>
<span class="data-label">振动温度</span>
<span class="data-value">{{ formatValue(device.vibrationTemp, '℃') }}</span>
</div>
</div>
<!-- 无数据提示 -->
<div v-if="!hasData(device)" class="no-data">
<i class="el-icon-warning-outline"></i>

Loading…
Cancel
Save