优化体检客户列表空数据展示
This commit is contained in:
@@ -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,97 +76,104 @@ export const ExamSection = ({
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className='grid grid-cols-3 gap-3 text-sm'>
|
||||
{filteredClients.map((client) => {
|
||||
// 检查操作记录:优先使用 localStorage 记录,如果没有则使用原有逻辑
|
||||
const idCardSignInDone = isExamActionDone(client.id, 'idCardSignIn');
|
||||
const printSignDone = isExamActionDone(client.id, 'printSign');
|
||||
{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 记录,如果没有则使用原有逻辑
|
||||
const idCardSignInDone = isExamActionDone(client.id, 'idCardSignIn');
|
||||
const printSignDone = isExamActionDone(client.id, 'printSign');
|
||||
|
||||
const signDone = idCardSignInDone || client.signStatus === '已登记' || client.checkedItems.includes('签到');
|
||||
const addonCount = client.addonCount || 0;
|
||||
const printDone = printSignDone || !!client.guidePrinted;
|
||||
const openModal = (tab: ExamModalTab) => onOpenModal(client.id, tab);
|
||||
const signDone = idCardSignInDone || client.signStatus === '已登记' || client.checkedItems.includes('签到');
|
||||
const addonCount = client.addonCount || 0;
|
||||
const printDone = printSignDone || !!client.guidePrinted;
|
||||
const openModal = (tab: ExamModalTab) => onOpenModal(client.id, tab);
|
||||
|
||||
return (
|
||||
<div
|
||||
key={client.id}
|
||||
role='button'
|
||||
tabIndex={0}
|
||||
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',
|
||||
)}
|
||||
>
|
||||
<div className='flex items-center justify-between mb-1'>
|
||||
<span className='font-medium'>{client.name}</span>
|
||||
<Badge>{client.level}</Badge>
|
||||
</div>
|
||||
<div className='text-xs text-gray-500 truncate'>套餐:{client.packageName}</div>
|
||||
<div className='flex items-center justify-between text-xs text-gray-500 mt-1'>
|
||||
<span>状态:{client.status}</span>
|
||||
<span>已耗时:{client.elapsed}</span>
|
||||
</div>
|
||||
<div className='mt-2 flex flex-wrap gap-1 text-[11px]'>
|
||||
<button
|
||||
type='button'
|
||||
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openModal('detail');
|
||||
}}
|
||||
>
|
||||
<span>详情</span>
|
||||
</button>
|
||||
<button
|
||||
type='button'
|
||||
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openModal('sign');
|
||||
}}
|
||||
>
|
||||
<span>签到</span>
|
||||
{signDone && <span>✅</span>}
|
||||
</button>
|
||||
<button
|
||||
type='button'
|
||||
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openModal('addon');
|
||||
}}
|
||||
>
|
||||
<span>加项</span>
|
||||
{addonCount > 0 && <span className='opacity-80'>({addonCount})</span>}
|
||||
</button>
|
||||
<button
|
||||
type='button'
|
||||
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openModal('print');
|
||||
}}
|
||||
>
|
||||
<span>打印导检单</span>
|
||||
{printDone && <span>✅</span>}
|
||||
</button>
|
||||
<button
|
||||
type='button'
|
||||
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openModal('delivery');
|
||||
}}
|
||||
>
|
||||
<span>报告寄送</span>
|
||||
</button>
|
||||
return (
|
||||
<div
|
||||
key={client.id}
|
||||
role='button'
|
||||
tabIndex={0}
|
||||
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',
|
||||
)}
|
||||
>
|
||||
<div className='flex items-center justify-between mb-1'>
|
||||
<span className='font-medium'>{client.name}</span>
|
||||
<Badge>{client.level}</Badge>
|
||||
</div>
|
||||
<div className='text-xs text-gray-500 truncate'>套餐:{client.packageName}</div>
|
||||
<div className='flex items-center justify-between text-xs text-gray-500 mt-1'>
|
||||
<span>状态:{client.status}</span>
|
||||
<span>已耗时:{client.elapsed}</span>
|
||||
</div>
|
||||
<div className='mt-2 flex flex-wrap gap-1 text-[11px]'>
|
||||
<button
|
||||
type='button'
|
||||
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openModal('detail');
|
||||
}}
|
||||
>
|
||||
<span>详情</span>
|
||||
</button>
|
||||
<button
|
||||
type='button'
|
||||
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openModal('sign');
|
||||
}}
|
||||
>
|
||||
<span>签到</span>
|
||||
{signDone && <span>✅</span>}
|
||||
</button>
|
||||
<button
|
||||
type='button'
|
||||
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openModal('addon');
|
||||
}}
|
||||
>
|
||||
<span>加项</span>
|
||||
{addonCount > 0 && <span className='opacity-80'>({addonCount})</span>}
|
||||
</button>
|
||||
<button
|
||||
type='button'
|
||||
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openModal('print');
|
||||
}}
|
||||
>
|
||||
<span>打印导检单</span>
|
||||
{printDone && <span>✅</span>}
|
||||
</button>
|
||||
<button
|
||||
type='button'
|
||||
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openModal('delivery');
|
||||
}}
|
||||
>
|
||||
<span>报告寄送</span>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user