Files
hms/apps/web/src/components/EntityName.tsx
iven 1613e3cfe9
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled
fix(health): 修复 5 角色测试发现的 4 个共性问题
- 权限路由守卫:静默重定向改为显示 403 页面,使用 useLocation 替代
  window.location.hash,补全缺失路由权限条目
- 随访状态筛选:usePaginatedData hook 添加 filters 变化监听自动刷新
- 告警操作:后端 acknowledge/dismiss/resolve 改返回 AlertResponse
  (含 patient_name),前端增加 active 状态兼容和错误反馈
- 咨询患者名:后端 create/get/close_session 增加 patient_name 和
  doctor_name enrichment,前端 EntityName 空字符串处理
2026-05-07 07:23:41 +08:00

24 lines
622 B
TypeScript

import { Tooltip, Typography } from 'antd';
interface EntityNameProps {
name?: string | null;
id?: string;
fallbackLabel?: string;
}
export function EntityName({ name, id, fallbackLabel = '未知' }: EntityNameProps) {
if (name !== undefined && name !== null && name !== '') return <span>{name}</span>;
if (id) {
return (
<Tooltip title={`ID: ${id.slice(0, 8)}...`}>
<Typography.Text type="secondary" style={{ cursor: 'help' }}>
{fallbackLabel}
</Typography.Text>
</Tooltip>
);
}
return <Typography.Text type="secondary">{fallbackLabel}</Typography.Text>;
}