|
|
@@ -254,46 +254,54 @@ const DisabilityPersonManagement: React.FC = () => {
|
|
|
</TableRow>
|
|
|
</TableHeader>
|
|
|
<TableBody>
|
|
|
- {data?.data?.map((person: any) => (
|
|
|
- <TableRow key={person.id}>
|
|
|
- <TableCell>{person.name}</TableCell>
|
|
|
- <TableCell>{person.gender}</TableCell>
|
|
|
- <TableCell>{person.idCard}</TableCell>
|
|
|
- <TableCell>{person.disabilityId}</TableCell>
|
|
|
- <TableCell>{person.disabilityType}</TableCell>
|
|
|
- <TableCell>{person.disabilityLevel}</TableCell>
|
|
|
- <TableCell>{person.phone}</TableCell>
|
|
|
- <TableCell>{format(new Date(person.createTime), 'yyyy-MM-dd HH:mm')}</TableCell>
|
|
|
- <TableCell className="text-right">
|
|
|
- <div className="flex justify-end space-x-2">
|
|
|
- <Button
|
|
|
- variant="ghost"
|
|
|
- size="sm"
|
|
|
- onClick={() => handleViewOpen(person.id)}
|
|
|
- data-testid={`view-person-${person.id}`}
|
|
|
- >
|
|
|
- <Eye className="h-4 w-4" />
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- variant="ghost"
|
|
|
- size="sm"
|
|
|
- onClick={() => handleEditOpen(person)}
|
|
|
- data-testid={`edit-person-${person.id}`}
|
|
|
- >
|
|
|
- <Edit className="h-4 w-4" />
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- variant="ghost"
|
|
|
- size="sm"
|
|
|
- onClick={() => handleDeleteOpen(person.id)}
|
|
|
- data-testid={`delete-person-${person.id}`}
|
|
|
- >
|
|
|
- <Trash2 className="h-4 w-4" />
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
+ {data?.data && data.data.length > 0 ? (
|
|
|
+ data.data.map((person: any) => (
|
|
|
+ <TableRow key={person.id}>
|
|
|
+ <TableCell>{person.name}</TableCell>
|
|
|
+ <TableCell>{person.gender}</TableCell>
|
|
|
+ <TableCell>{person.idCard}</TableCell>
|
|
|
+ <TableCell>{person.disabilityId}</TableCell>
|
|
|
+ <TableCell>{person.disabilityType}</TableCell>
|
|
|
+ <TableCell>{person.disabilityLevel}</TableCell>
|
|
|
+ <TableCell>{person.phone}</TableCell>
|
|
|
+ <TableCell>{format(new Date(person.createTime), 'yyyy-MM-dd HH:mm')}</TableCell>
|
|
|
+ <TableCell className="text-right">
|
|
|
+ <div className="flex justify-end space-x-2">
|
|
|
+ <Button
|
|
|
+ variant="ghost"
|
|
|
+ size="sm"
|
|
|
+ onClick={() => handleViewOpen(person.id)}
|
|
|
+ data-testid={`view-person-${person.id}`}
|
|
|
+ >
|
|
|
+ <Eye className="h-4 w-4" />
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ variant="ghost"
|
|
|
+ size="sm"
|
|
|
+ onClick={() => handleEditOpen(person)}
|
|
|
+ data-testid={`edit-person-${person.id}`}
|
|
|
+ >
|
|
|
+ <Edit className="h-4 w-4" />
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ variant="ghost"
|
|
|
+ size="sm"
|
|
|
+ onClick={() => handleDeleteOpen(person.id)}
|
|
|
+ data-testid={`delete-person-${person.id}`}
|
|
|
+ >
|
|
|
+ <Trash2 className="h-4 w-4" />
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ </TableCell>
|
|
|
+ </TableRow>
|
|
|
+ ))
|
|
|
+ ) : (
|
|
|
+ <TableRow>
|
|
|
+ <TableCell colSpan={9} className="text-center py-8">
|
|
|
+ <p className="text-muted-foreground">暂无数据</p>
|
|
|
</TableCell>
|
|
|
</TableRow>
|
|
|
- ))}
|
|
|
+ )}
|
|
|
</TableBody>
|
|
|
</Table>
|
|
|
|