fix(ui): 修复充电状态筛选重置

This commit is contained in:
2026-05-12 00:18:00 +08:00
parent 4571cee2a1
commit 50e8e32bac
3 changed files with 46 additions and 46 deletions
+10 -10
View File
@@ -251,10 +251,10 @@ function toFleetUnit(item: BatteryInfo, prediction?: BatteryPrediction): FleetUn
if (item.isLowPower || item.power <= SOH_THRESHOLDS.LOW_POWER) riskFactors.push('低电量')
if (item.powerStatus === POWER_STATUS.CHARGING) riskFactors.push('充电中')
if (!hasPrediction) riskFactors.push('SoH预测不可用')
if (!hasPrediction) riskFactors.push('健康预测不可用')
if (prediction && status === DEVICE_STATUS.WARNING) riskFactors.push('衰减加速')
if (item.remark?.includes('v3.7')) riskFactors.push('旧固件')
if (prediction?.riskLevel) riskFactors.push(`AI风险:${prediction.riskLevel}`)
if (prediction?.riskLevel) riskFactors.push(`预测风险:${prediction.riskLevel}`)
const soh30d = prediction ? round1(clamp(prediction.monthSoh, 0, 100)) : null
const soh90d = prediction ? round1(clamp(prediction.trmonthSoh, 0, 100)) : null
@@ -392,8 +392,8 @@ function createSummary(devices: FleetUnit[], now: Date) {
updatedAt: formatDateTime(now),
executiveSummary:
avgSoh === null
? '当前 AI SoH 预测不可用,页面仅展示 MySQL 采集电量、充电状态与低电量风险。请检查预测服务配置或历史数据量。'
: `当前共有 ${predictedDevices} 台设备返回 SoH 预测,${missingPredictionDevices} 台设备暂无预测重点关注 ${weakestModel} 型号与 ${weakestRemark} 备注设备,优先处理低电量和充电中的设备,并在下次同步后复查缺失预测与未来 30/90 天模型预测`,
? '当前健康预测不可用,系统仍会展示设备电量、充电状态与低电量风险。请稍后复查或联系管理员。'
: `当前共有 ${predictedDevices} 台设备具备健康预测,${missingPredictionDevices} 台设备暂无预测结果。建议重点关注 ${weakestModel} 型号与 ${weakestRemark} 备注设备,优先处理低电量和充电中的设备,并在下次同步后复查未来 30/90 天健康趋势`,
}
}
@@ -408,7 +408,7 @@ function createEvents(devices: FleetUnit[], now: Date) {
{
time: formatDateTime(now),
title: '风险快照',
detail: `本次快照包含 ${devices.length} 台设备,其中 ${predictedDevices.length}返回真实 SoH 预测,${warningDevices.length} 台处于预警状态。`,
detail: `本次概览包含 ${devices.length} 台设备,其中 ${predictedDevices.length}具备健康预测,${warningDevices.length} 台处于预警状态。`,
severity: warningDevices.length > 0 ? EVENT_SEVERITY.HIGH : EVENT_SEVERITY.LOW,
},
{
@@ -416,8 +416,8 @@ function createEvents(devices: FleetUnit[], now: Date) {
title: '预测可用性快照',
detail:
missingPredictionDevices > 0
? `当前有 ${missingPredictionDevices} 台设备暂无 SoH 预测,对应图表与卡片保留为空值`
: '当前所有设备均已返回 SoH 预测,图表仅展示真实预测点。',
? `当前有 ${missingPredictionDevices} 台设备暂无健康预测,相关趋势将暂不展示`
: '当前所有设备均已具备健康预测,可继续观察趋势变化。',
severity: missingPredictionDevices > 0 ? EVENT_SEVERITY.MEDIUM : EVENT_SEVERITY.LOW,
},
] satisfies DashboardSnapshot['events']
@@ -440,11 +440,11 @@ function createStrategies(devices: FleetUnit[]) {
eta: '本次巡检周期内',
},
{
name: '补齐预测覆盖',
name: '提升预测覆盖',
impact:
missingPredictionDevices.length > 0
? `当前有 ${missingPredictionDevices.length} 台设备暂无 SoH 预测,建议在下次同步后复查。`
: `当前已有 ${devices.length} 台设备返回预测结果,可继续观察真实变化。`,
? `当前有 ${missingPredictionDevices.length} 台设备暂无健康预测,建议在下次同步后复查。`
: `当前已有 ${devices.length} 台设备具备预测结果,可继续观察健康变化。`,
scope:
powerAttentionDevices.length > 0
? `${powerAttentionDevices.length} 台充电中或低电量设备`