Przeglądaj źródła

修复终端设备远程测控-实时数据展示

zengy 4 dni temu
rodzic
commit
8734930aa3

+ 14 - 7
src/views/subSystem/pipeNetwork/pinteControl/remoteControl.vue

@@ -233,20 +233,24 @@ function columnLabelMap(p) {
   ;(p?.recordView?.columns || []).forEach((c) => { map[c.key] = c })
   ;(p?.recordView?.columns || []).forEach((c) => { map[c.key] = c })
   return map
   return map
 }
 }
+// 在线状态只决定状态标签;只要档案里有采集记录就展示最后一次采集值
 function latestMetricsText(row) {
 function latestMetricsText(row) {
-  if (!isOnline(row)) return '—' // 离线设备不展示实时数据
-  const p = profileOf(row)
   const first = latestRowOf(row)
   const first = latestRowOf(row)
   if (!first) return '—'
   if (!first) return '—'
-  const colMap = columnLabelMap(p)
-  return (first.cells || [])
+  const colMap = columnLabelMap(profileOf(row))
+  const text = (first.cells || [])
     .filter((c) => c.key !== 'filepath')
     .filter((c) => c.key !== 'filepath')
     .map((c) => {
     .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}`
       return `${label}:${v}`
     })
     })
     .join('  ')
     .join('  ')
+  return text || '—'
 }
 }
 function hasAlarmInLatest(row) {
 function hasAlarmInLatest(row) {
   const first = latestRowOf(row)
   const first = latestRowOf(row)
@@ -300,7 +304,10 @@ function loadList() {
         list.value.map((d) =>
         list.value.map((d) =>
           getEquipmentProfile(d.equipmentId)
           getEquipmentProfile(d.equipmentId)
             .then((p) => { profileMap[d.equipmentId] = p.data || null })
             .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
+            })
         )
         )
       )
       )
     })
     })