diff --git a/src/domain/battery.ts b/src/domain/battery.ts index 7499b74..041f5fd 100644 --- a/src/domain/battery.ts +++ b/src/domain/battery.ts @@ -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} 台充电中或低电量设备` diff --git a/src/routes/batteries.tsx b/src/routes/batteries.tsx index 3535ad3..cfadf39 100644 --- a/src/routes/batteries.tsx +++ b/src/routes/batteries.tsx @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/react-query' import { createFileRoute, Link, useNavigate } from '@tanstack/react-router' import { createColumnHelper, flexRender, getCoreRowModel, useReactTable } from '@tanstack/react-table' -import { ArrowLeft, Battery, BatteryCharging, BatteryLow, Database, FilterX, Search, Zap } from 'lucide-react' +import { ArrowLeft, Battery, BatteryCharging, BatteryLow, FilterX, Search, Zap } from 'lucide-react' import { useEffect, useMemo, useState } from 'react' import { z } from 'zod' import { orpc } from '@/client/orpc' @@ -77,6 +77,8 @@ function parseSort(value: string): BatteryListSort { } function parsePowerStatus(value: string): PowerStatus | undefined { + if (value === '') return undefined + const parsed = Number(value) return POWER_STATUS_VALUES.find((option) => option === parsed) @@ -242,11 +244,11 @@ function BatteriesPage() {
- 只展示 ls_battery_info 最新采集记录,筛选、排序和分页均通过 ORPC 服务端查询完成。 + 查看最新设备状态,快速定位低电量、充电中和长期未更新的设备。
{data ? `更新于 ${new Date(data.updatedAt).toLocaleString('zh-CN')}` : '加载中…'}
@@ -257,7 +259,7 @@ function BatteriesPage() {
to="/"
className="inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-zinc-300 transition-colors hover:border-teal-400/30 hover:text-teal-300"
>
-