|
|
@@ -233,20 +233,24 @@ function columnLabelMap(p) {
|
|
|
;(p?.recordView?.columns || []).forEach((c) => { map[c.key] = c })
|
|
|
return map
|
|
|
}
|
|
|
+// 在线状态只决定状态标签;只要档案里有采集记录就展示最后一次采集值
|
|
|
function latestMetricsText(row) {
|
|
|
- if (!isOnline(row)) return '—' // 离线设备不展示实时数据
|
|
|
- const p = profileOf(row)
|
|
|
const first = latestRowOf(row)
|
|
|
if (!first) return '—'
|
|
|
- const colMap = columnLabelMap(p)
|
|
|
- return (first.cells || [])
|
|
|
+ const colMap = columnLabelMap(profileOf(row))
|
|
|
+ const text = (first.cells || [])
|
|
|
.filter((c) => c.key !== 'filepath')
|
|
|
.map((c) => {
|
|
|
- const label = colMap[c.key]?.label || c.key
|
|
|
- const v = c.value && c.value !== '' ? c.value : (c.display || '—')
|
|
|
+ const col = colMap[c.key]
|
|
|
+ const label = col?.label || c.key
|
|
|
+ // value 是纯值,单位在列定义里;display 已含单位,仅在无有效纯值时兜底,避免重复拼接
|
|
|
+ const v = c.value && c.value !== '' && c.value !== '—'
|
|
|
+ ? `${c.value}${col?.unit || ''}`
|
|
|
+ : (c.display || '—')
|
|
|
return `${label}:${v}`
|
|
|
})
|
|
|
.join(' ')
|
|
|
+ return text || '—'
|
|
|
}
|
|
|
function hasAlarmInLatest(row) {
|
|
|
const first = latestRowOf(row)
|
|
|
@@ -300,7 +304,10 @@ function loadList() {
|
|
|
list.value.map((d) =>
|
|
|
getEquipmentProfile(d.equipmentId)
|
|
|
.then((p) => { profileMap[d.equipmentId] = p.data || null })
|
|
|
- .catch(() => { profileMap[d.equipmentId] = null })
|
|
|
+ .catch((e) => {
|
|
|
+ console.warn('[remoteControl] 设备档案加载失败', d.equipmentId, e)
|
|
|
+ profileMap[d.equipmentId] = null
|
|
|
+ })
|
|
|
)
|
|
|
)
|
|
|
})
|