|
@@ -103,20 +103,19 @@ export function toPerception(raw) {
|
|
|
onlineCount: numberish(totals.raw.onlineCount),
|
|
onlineCount: numberish(totals.raw.onlineCount),
|
|
|
offlineCount: numberish(totals.raw.offlineCount),
|
|
offlineCount: numberish(totals.raw.offlineCount),
|
|
|
onlineRate: toRatio(totals.raw.onlineRate),
|
|
onlineRate: toRatio(totals.raw.onlineRate),
|
|
|
- // 类型卡:四项固定顺序由后端给;卡内小字 = `monitoringContent`。
|
|
|
|
|
- // 维护者 2026-10-23:供水/排水这两张卡下的小字「尽可能精简」——
|
|
|
|
|
- // 真实内容很长(供水 4 项、排水 8 项,如「排水瞬时流量监测 / 排水流速监测 / …」),
|
|
|
|
|
- // 所以展示层压缩成「最多两项 + 等」,**完整原文进 title 悬停可读**,不丢信息。
|
|
|
|
|
|
|
+ // 类型卡:四项固定顺序由后端给;卡内小字=一条**举例设备类型**(维护者 2026-12-01),
|
|
|
|
|
+ // 未登记行业回退到后端监测内容的压缩结果。完整监测内容仍进 title 悬停可读。
|
|
|
types: reader.optionalList('byType').map((item) => {
|
|
types: reader.optionalList('byType').map((item) => {
|
|
|
const row = fieldReader(item, 'overviewPerception.byType')
|
|
const row = fieldReader(item, 'overviewPerception.byType')
|
|
|
const monitoringContent = row.optionalStr('monitoringContent')
|
|
const monitoringContent = row.optionalStr('monitoringContent')
|
|
|
|
|
+ const label = row.optionalStr('name') || row.optionalStr('code')
|
|
|
return {
|
|
return {
|
|
|
code: row.optionalStr('code'),
|
|
code: row.optionalStr('code'),
|
|
|
- label: row.optionalStr('name') || row.optionalStr('code'),
|
|
|
|
|
|
|
+ label,
|
|
|
count: numberish(row.raw.deviceCount) ?? 0,
|
|
count: numberish(row.raw.deviceCount) ?? 0,
|
|
|
onlineCount: numberish(row.raw.onlineCount),
|
|
onlineCount: numberish(row.raw.onlineCount),
|
|
|
offlineCount: numberish(row.raw.offlineCount),
|
|
offlineCount: numberish(row.raw.offlineCount),
|
|
|
- note: conciseMonitoring(monitoringContent),
|
|
|
|
|
|
|
+ note: exampleDeviceType(label) || conciseMonitoring(monitoringContent),
|
|
|
noteTitle: monitoringContent,
|
|
noteTitle: monitoringContent,
|
|
|
}
|
|
}
|
|
|
}),
|
|
}),
|
|
@@ -384,6 +383,28 @@ function conciseMonitoring(text) {
|
|
|
return items.length > kept.length ? `${kept.join(' / ')} 等` : kept.join(' / ')
|
|
return items.length > kept.length ? `${kept.join(' / ')} 等` : kept.join(' / ')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 类型卡小字的**举例设备类型**(维护者 2026-12-01)。
|
|
|
|
|
+ *
|
|
|
|
|
+ * 原先把后端 `monitoringContent` 压成「压力 / 瞬时流量 等」——那是**监测因子**,
|
|
|
|
|
+ * 四项长短不一(燃气那张会换行),一排卡看起来参差。维护者要的是「一条设备类型举例」,
|
|
|
|
|
+ * 四种行业各给一个代表型号,统一以「等」收尾,卡内小字因此等长、不换行。
|
|
|
|
|
+ * 未登记的行业仍回退到后端的监测内容(压缩后),不画空小字、也不编造型号。
|
|
|
|
|
+ */
|
|
|
|
|
+const TYPE_DEVICE_EXAMPLE = {
|
|
|
|
|
+ 供水: '供水压力流量终端',
|
|
|
|
|
+ 排水: '环境监测终端',
|
|
|
|
|
+ 燃气: '可燃气体监测终端',
|
|
|
|
|
+ 窨井: '窨井监测终端',
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/** 卡名(如「供水设备」)→ 举例设备类型小字;认不出行业回空串。 */
|
|
|
|
|
+function exampleDeviceType(label) {
|
|
|
|
|
+ const name = String(label == null ? '' : label)
|
|
|
|
|
+ const industry = Object.keys(TYPE_DEVICE_EXAMPLE).find((prefix) => name.startsWith(prefix))
|
|
|
|
|
+ return industry ? `${TYPE_DEVICE_EXAMPLE[industry]} 等` : ''
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/** 折线点列 → 纯数值列表(多序列 API 只要值,日期标签共用主轴的 points)。 */
|
|
/** 折线点列 → 纯数值列表(多序列 API 只要值,日期标签共用主轴的 points)。 */
|
|
|
function trendOf(sevenDayTrend) {
|
|
function trendOf(sevenDayTrend) {
|
|
|
return (sevenDayTrend || []).map((point) => numberish(point.count) || 0)
|
|
return (sevenDayTrend || []).map((point) => numberish(point.count) || 0)
|