From 07217336e7c25c503b6cab57b4ae256abc68a212 Mon Sep 17 00:00:00 2001 From: iven Date: Sat, 9 May 2026 02:27:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E8=BF=90=E8=90=A5=E4=BB=AA?= =?UTF-8?q?=E8=A1=A8=E7=9B=98=E6=95=B0=E6=8D=AE=E6=98=A0=E5=B0=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E5=92=8C=E6=B5=AE=E7=82=B9=E7=B2=BE=E5=BA=A6=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 命令,使用函数式获取文件名列表 --- .lintstagedrc.js | 6 ++---- apps/web/src/pages/Home.tsx | 4 +--- .../health/components/workbench/OperatorWorkbench.tsx | 9 ++++++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.lintstagedrc.js b/.lintstagedrc.js index a2b0825..77606ff 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -3,10 +3,8 @@ module.exports = { 'cargo fmt --check --', () => 'cargo clippy -p erp-health -p erp-server -- -D warnings', ], - 'apps/web/src/**/*.{ts,tsx}': () => - process.platform === 'win32' - ? 'pushd apps/web && npx eslint --fix src/ & popd' - : 'cd apps/web && npx eslint --fix src/', + 'apps/web/src/**/*.{ts,tsx}': (filenames) => + `npx eslint --fix ${filenames.join(' ')}`, 'apps/web/src/**/*.test.{ts,tsx}': [ 'cd apps/web && npx vitest run --reporter=verbose', ], diff --git a/apps/web/src/pages/Home.tsx b/apps/web/src/pages/Home.tsx index 1b7cc69..db243d0 100644 --- a/apps/web/src/pages/Home.tsx +++ b/apps/web/src/pages/Home.tsx @@ -30,8 +30,6 @@ import { listPendingTasks, type TaskInfo } from '../api/workflowTasks'; import { pointsApi, type PersonalStats } from '../api/health/points'; import { useStatsData } from './health/StatisticsDashboard/useStatsData'; import { useCountUp } from '../hooks/useCountUp'; -import TodoList from './health/components/workbench/TodoList'; -import AiInsightPanel from './health/components/workbench/AiInsightPanel'; import ActionDetailDrawer from './health/components/workbench/ActionDetailDrawer'; import TaskQueue from './health/components/workbench/TaskQueue'; import TaskDetail from './health/components/workbench/TaskDetail'; @@ -140,7 +138,7 @@ const ROLE_STATS: Record = { { key: 'issued', title: '积分发放', getValue: (_p, s) => s.pointsStats?.total_issued ?? 0, icon: , path: '/health/points' }, { key: 'spent', title: '积分消费', getValue: (_p, s) => s.pointsStats?.total_spent ?? 0, icon: , path: '/health/mall' }, { key: 'active', title: '活跃账户', getValue: (_p, s) => s.pointsStats?.active_accounts ?? 0, icon: , path: '/health/points' }, - { key: 'articles', title: '内容发布', getValue: (_p, s) => s.pointsStats?.total_issued ?? 0, icon: , path: '/health/content' }, + { key: 'articles', title: '内容发布', getValue: (_p, s) => s.patientStats?.total_patients ?? 0, icon: , path: '/health/content' }, ], }; diff --git a/apps/web/src/pages/health/components/workbench/OperatorWorkbench.tsx b/apps/web/src/pages/health/components/workbench/OperatorWorkbench.tsx index 855021b..21b9177 100644 --- a/apps/web/src/pages/health/components/workbench/OperatorWorkbench.tsx +++ b/apps/web/src/pages/health/components/workbench/OperatorWorkbench.tsx @@ -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() {
{stats?.total_pending ?? 0} 个运营洞察需要关注
1. 积分兑换活动数据 — 今日发放 {statsData.pointsStats?.total_issued ?? 0} 积分,消费 {statsData.pointsStats?.total_spent ?? 0}。
- 2. 患者活跃度 — 体征上报率 {statsData.healthDataStats?.vital_signs_report_rate?.report_rate ?? 0}%,持续关注沉默用户。
+ 2. 患者活跃度 — 体征上报率 {formattedVitalRate}%,持续关注沉默用户。
3. 待处理任务 — {stats?.total_pending ?? 0} 项任务待处理,其中 {stats?.urgent_alerts ?? 0} 项需优先关注。