|
@@ -475,7 +475,7 @@ 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 // 点位图数据
|
|
|
|
|
|
+ const targetPoints = data?.tracker_targets || [] // 点位图数据
|
|
const breathRpm = data.health?.breath_rpm || 0 // 呼吸率数据
|
|
const breathRpm = data.health?.breath_rpm || 0 // 呼吸率数据
|
|
if (breathRpm) {
|
|
if (breathRpm) {
|
|
breathRpmList.value.push(Math.floor(breathRpm || 0))
|
|
breathRpmList.value.push(Math.floor(breathRpm || 0))
|
|
@@ -483,15 +483,19 @@ onMounted(() => {
|
|
breathRpmList.value = []
|
|
breathRpmList.value = []
|
|
}
|
|
}
|
|
console.log(`🚀 收到MQTT消息 ${formatDateTime(new Date())}`, {
|
|
console.log(`🚀 收到MQTT消息 ${formatDateTime(new Date())}`, {
|
|
- '🔴 目标人数': arr.length,
|
|
|
|
|
|
+ '🔴 目标人数': targetPoints.length,
|
|
'🟢 呼吸率': breathRpm,
|
|
'🟢 呼吸率': breathRpm,
|
|
- '🟡 点位图': arr,
|
|
|
|
|
|
+ '🟡 点位图': targetPoints,
|
|
'🔵 接口数据': data,
|
|
'🔵 接口数据': data,
|
|
})
|
|
})
|
|
- if (Array.isArray(arr) && arr.length > 0 && Array.isArray(arr[0])) {
|
|
|
|
|
|
+ if (
|
|
|
|
+ Array.isArray(targetPoints) &&
|
|
|
|
+ targetPoints.length > 0 &&
|
|
|
|
+ Array.isArray(targetPoints[0])
|
|
|
|
+ ) {
|
|
// 记录本次出现的所有id
|
|
// 记录本次出现的所有id
|
|
const currentIds = new Set<number>()
|
|
const currentIds = new Set<number>()
|
|
- arr.forEach((item: number[]) => {
|
|
|
|
|
|
+ targetPoints.forEach((item: number[]) => {
|
|
if (item.length < 4) return
|
|
if (item.length < 4) return
|
|
const [x, y, z, id] = item
|
|
const [x, y, z, id] = item
|
|
currentIds.add(id)
|
|
currentIds.add(id)
|