优化体检客户列表空数据展示

This commit is contained in:
xianyi
2025-12-18 11:41:34 +08:00
parent 32af1cc335
commit b72765695d
2 changed files with 103 additions and 98 deletions

View File

@@ -8,7 +8,7 @@ import { cls } from '../../utils/cls';
interface ExamSectionProps {
filteredClients: ExamClient[];
selectedExamClient: ExamClient;
selectedExamClient: ExamClient | undefined;
examFilterTag: (typeof EXAM_TAGS)[number];
onFilterChange: (tag: (typeof EXAM_TAGS)[number]) => void;
onOpenModal: (id: string, tab: ExamModalTab) => void;
@@ -76,6 +76,12 @@ export const ExamSection = ({
</div>
</CardHeader>
<CardContent>
{filteredClients.length === 0 ? (
<div className='text-center text-gray-500 py-8'>
<div className='text-sm'></div>
<div className='text-xs mt-1'></div>
</div>
) : (
<div className='grid grid-cols-3 gap-3 text-sm'>
{filteredClients.map((client) => {
// 检查操作记录:优先使用 localStorage 记录,如果没有则使用原有逻辑
@@ -95,7 +101,7 @@ export const ExamSection = ({
onClick={() => openModal('detail')}
className={cls(
'text-left p-3 rounded-2xl border bg-white hover:bg-gray-50 flex flex-col gap-1 cursor-pointer',
selectedExamClient.id === client.id && 'border-gray-900 bg-gray-50',
selectedExamClient?.id === client.id && 'border-gray-900 bg-gray-50',
)}
>
<div className='flex items-center justify-between mb-1'>
@@ -167,6 +173,7 @@ export const ExamSection = ({
);
})}
</div>
)}
</CardContent>
</Card>
</div>

View File

@@ -112,7 +112,6 @@ export const ExamPage = () => {
return (
<>
{selectedExamClient && (
<ExamSection
filteredClients={clients}
selectedExamClient={selectedExamClient}
@@ -120,9 +119,8 @@ export const ExamPage = () => {
onFilterChange={setExamFilterTag}
onOpenModal={handleOpenModal}
/>
)}
{examModalOpen && (
{examModalOpen && selectedExamClient && (
<ExamModal
client={selectedExamClient}
tab={examPanelTab}