|
@@ -175,6 +175,7 @@ import { deviceOnlineStateMap, deviceInstallPositionNameMap } from '@/const/devi
|
|
import deviceConfigDrawer from './components/deviceConfig/index.vue'
|
|
import deviceConfigDrawer from './components/deviceConfig/index.vue'
|
|
import deviceStatsDrawer from './components/deviceStatsDrawer/index.vue'
|
|
import deviceStatsDrawer from './components/deviceStatsDrawer/index.vue'
|
|
import BreathLineChart from './components/breathLineChart/index.vue'
|
|
import BreathLineChart from './components/breathLineChart/index.vue'
|
|
|
|
+import { formatDateTime } from '@/utils'
|
|
|
|
|
|
defineOptions({
|
|
defineOptions({
|
|
name: 'DeviceDetail',
|
|
name: 'DeviceDetail',
|
|
@@ -345,7 +346,7 @@ const resetMqttTimeout = () => {
|
|
mqttTimeout = window.setTimeout(() => {
|
|
mqttTimeout = window.setTimeout(() => {
|
|
Object.keys(targets).forEach((key) => delete targets[Number(key)])
|
|
Object.keys(targets).forEach((key) => delete targets[Number(key)])
|
|
breathRpmList.value = []
|
|
breathRpmList.value = []
|
|
- console.log('MQTT超时未收到新消息,隐藏所有红点')
|
|
|
|
|
|
+ console.log('MQTT超时未收到新消息,隐藏所有目标点')
|
|
}, MQTT_TIMEOUT_MS)
|
|
}, MQTT_TIMEOUT_MS)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -390,13 +391,17 @@ onMounted(() => {
|
|
if (msgDevId !== clientId.value) return // 只处理当前设备
|
|
if (msgDevId !== clientId.value) return // 只处理当前设备
|
|
try {
|
|
try {
|
|
const data = JSON.parse(message.toString())
|
|
const data = JSON.parse(message.toString())
|
|
- const arr = data.tracker_targets
|
|
|
|
- console.log('🚀 收到MQTT消息', data, {
|
|
|
|
- '🔴 目标人数': data.tracker_targets.length,
|
|
|
|
- '🟢 呼吸率': data.health.breath_rpm,
|
|
|
|
- '🟡 点位图': data.tracker_targets,
|
|
|
|
|
|
+ const arr = data?.tracker_targets // 点位图数据
|
|
|
|
+ const breathRpm = data.health?.breath_rpm || 0 // 呼吸率数据
|
|
|
|
+ if (breathRpm) {
|
|
|
|
+ breathRpmList.value.push(Math.floor(breathRpm || 0))
|
|
|
|
+ }
|
|
|
|
+ console.log(`🚀 收到MQTT消息 ${formatDateTime(new Date())}`, {
|
|
|
|
+ '🔴 目标人数': arr.length,
|
|
|
|
+ '🟢 呼吸率': breathRpm,
|
|
|
|
+ '🟡 点位图': arr,
|
|
|
|
+ '🔵 接口数据': data,
|
|
})
|
|
})
|
|
- breathRpmList.value.push(Math.floor(data.health.breath_rpm || 0))
|
|
|
|
if (Array.isArray(arr) && arr.length > 0 && Array.isArray(arr[0])) {
|
|
if (Array.isArray(arr) && arr.length > 0 && Array.isArray(arr[0])) {
|
|
// 记录本次出现的所有id
|
|
// 记录本次出现的所有id
|
|
const currentIds = new Set<number>()
|
|
const currentIds = new Set<number>()
|