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

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

View File

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