fix(web): 运营仪表盘数据映射错误和浮点精度修复
- OperatorWorkbench: "今日活跃用户" 错误使用体征上报率数据源,改为 pointsStats.active_accounts - OperatorWorkbench: AI 摘要体征上报率显示原始浮点数(22.413793...),改为保留两位小数 - OperatorWorkbench: "科普阅读量" fallback 错误回退到积分发放数据,移除错误 fallback - Home.tsx: 运营角色 ROLE_STATS "内容发布" 数据源错误,修正为 patientStats - Home.tsx: 移除未使用的 TodoList/AiInsightPanel import - .lintstagedrc.js: 修复 Windows 平台 eslint 命令,使用函数式获取文件名列表
This commit is contained in:
@@ -51,9 +51,12 @@ export default function OperatorWorkbench() {
|
||||
const now = new Date();
|
||||
const greeting = now.getHours() < 12 ? '早上好' : now.getHours() < 18 ? '下午好' : '晚上好';
|
||||
|
||||
const vitalRate = statsData.healthDataStats?.vital_signs_report_rate?.report_rate;
|
||||
const formattedVitalRate = vitalRate != null ? Math.round(vitalRate * 100) / 100 : 0;
|
||||
|
||||
const statCards = [
|
||||
{ label: '今日活跃用户', value: statsData.healthDataStats?.vital_signs_report_rate?.report_rate ?? 0, color: '#2563EB', trend: '', trendDir: '' },
|
||||
{ label: '科普阅读量', value: articleStats?.total_views ?? statsData.pointsStats?.total_issued ?? 0, color: '#16A34A', trend: '', trendDir: 'up' },
|
||||
{ label: '今日活跃用户', value: statsData.pointsStats?.active_accounts ?? 0, color: '#2563EB', trend: '', trendDir: '' },
|
||||
{ label: '科普阅读量', value: articleStats?.total_views ?? 0, color: '#16A34A', trend: '', trendDir: 'up' },
|
||||
{ label: '积分发放', value: statsData.pointsStats?.total_issued ?? 0, color: '#EA580C', trend: '', trendDir: 'down' },
|
||||
{ label: '待审核订单', value: stats?.total_pending ?? 0, color: '#E11D48', trend: '', trendDir: 'down' },
|
||||
];
|
||||
@@ -77,7 +80,7 @@ export default function OperatorWorkbench() {
|
||||
<div style={{ fontSize: 20, fontWeight: 700, marginBottom: 14, position: 'relative', zIndex: 1 }}>{stats?.total_pending ?? 0} 个运营洞察需要关注</div>
|
||||
<div style={{ fontSize: 13, lineHeight: 2, opacity: 0.92, position: 'relative', zIndex: 1 }}>
|
||||
<b style={{ color: '#FED7AA', fontWeight: 600 }}>1. 积分兑换活动数据</b> — 今日发放 {statsData.pointsStats?.total_issued ?? 0} 积分,消费 {statsData.pointsStats?.total_spent ?? 0}。<br />
|
||||
<b style={{ color: '#FED7AA', fontWeight: 600 }}>2. 患者活跃度</b> — 体征上报率 {statsData.healthDataStats?.vital_signs_report_rate?.report_rate ?? 0}%,持续关注沉默用户。<br />
|
||||
<b style={{ color: '#FED7AA', fontWeight: 600 }}>2. 患者活跃度</b> — 体征上报率 {formattedVitalRate}%,持续关注沉默用户。<br />
|
||||
<b style={{ color: '#FED7AA', fontWeight: 600 }}>3. 待处理任务</b> — {stats?.total_pending ?? 0} 项任务待处理,其中 {stats?.urgent_alerts ?? 0} 项需优先关注。
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 8, marginTop: 16, position: 'relative', zIndex: 1, flexWrap: 'wrap' as const }}>
|
||||
|
||||
Reference in New Issue
Block a user