feat: 添加管理端前端 (HMS 基座 React 管理面板)
- 从 HMS 基座复制 apps/web/ (React + Ant Design + Vite + TypeScript) - 管理端自动代理 API 到 localhost:3000 (vite.config.ts) - 更新 scripts/dev.sh 支持三端启动: backend/admin/app - 登录验证通过, 用户管理/角色权限/审计日志等页面正常 - 添加 .gitignore 排除 node_modules/dist
This commit is contained in:
28
apps/web/src/components/Copilot/CopilotBadge.tsx
Normal file
28
apps/web/src/components/Copilot/CopilotBadge.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Tag, Tooltip } from 'antd';
|
||||
import type { RiskLevel } from '../../api/copilot';
|
||||
import { useCopilotRisk } from './useCopilotRisk';
|
||||
|
||||
const levelConfig: Record<RiskLevel, { color: string; label: string }> = {
|
||||
low: { color: 'green', label: '低风险' },
|
||||
medium: { color: 'orange', label: '中风险' },
|
||||
high: { color: 'red', label: '高风险' },
|
||||
critical: { color: '#cf1322', label: '危急' },
|
||||
};
|
||||
|
||||
interface CopilotBadgeProps {
|
||||
patientId: string | undefined;
|
||||
}
|
||||
|
||||
export function CopilotBadge({ patientId }: CopilotBadgeProps) {
|
||||
const { data, loading } = useCopilotRisk(patientId);
|
||||
|
||||
if (!data || loading) return null;
|
||||
|
||||
const config = levelConfig[data.level as RiskLevel] ?? levelConfig.low;
|
||||
|
||||
return (
|
||||
<Tooltip title={`Copilot 风险评分: ${data.score}/10 — ${config.label}`}>
|
||||
<Tag color={config.color}>{config.label} {data.score}/10</Tag>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user