1
This commit is contained in:
parent
d49794acf6
commit
59e7c3b1fb
@ -308,11 +308,7 @@ function generateListPage(options: GenerateOptions): string {
|
||||
|
||||
return `import React, { useState, useEffect } from 'react';
|
||||
import { PageContainer } from '@/components/ui/page-container';
|
||||
import {
|
||||
PlusOutlined,
|
||||
EditOutlined,
|
||||
DeleteOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { Plus, Pencil, Trash2, Loader2 } from 'lucide-react';
|
||||
import {
|
||||
Table,
|
||||
TableHeader,
|
||||
@ -509,7 +505,7 @@ const ${typeName}List: React.FC = () => {
|
||||
size="sm"
|
||||
onClick={() => handleEdit(row.original)}
|
||||
>
|
||||
<EditOutlined className="mr-1"/>
|
||||
<Pencil className="mr-2 h-4 w-4" />
|
||||
编辑
|
||||
</Button>
|
||||
<AlertDialog>
|
||||
@ -519,7 +515,7 @@ const ${typeName}List: React.FC = () => {
|
||||
size="sm"
|
||||
className="text-destructive"
|
||||
>
|
||||
<DeleteOutlined className="mr-1"/>
|
||||
<Trash2 className="mr-2 h-4 w-4" />
|
||||
删除
|
||||
</Button>
|
||||
</AlertDialogTrigger>
|
||||
@ -551,7 +547,7 @@ const ${typeName}List: React.FC = () => {
|
||||
<h2 className="text-3xl font-bold tracking-tight">${description}</h2>
|
||||
<div className="flex items-center gap-4">
|
||||
<Button onClick={handleAdd}>
|
||||
<PlusOutlined className="mr-1"/>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
新建
|
||||
</Button>
|
||||
</div>
|
||||
@ -607,7 +603,29 @@ const ${typeName}List: React.FC = () => {
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{list.map((item) => (
|
||||
{loading ? (
|
||||
<TableRow>
|
||||
<TableCell
|
||||
colSpan={columns.length}
|
||||
className="h-24 text-center"
|
||||
>
|
||||
<div className="flex justify-center items-center">
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||
加载中...
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : list.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell
|
||||
colSpan={columns.length}
|
||||
className="h-24 text-center"
|
||||
>
|
||||
暂无数据
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
list.map((item) => (
|
||||
<TableRow key={item.id}>
|
||||
{columns.map((column) => (
|
||||
<TableCell
|
||||
@ -619,7 +637,8 @@ const ${typeName}List: React.FC = () => {
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
))}
|
||||
))
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
<div className="flex justify-end border-t border-border bg-muted/40">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user