This commit is contained in:
dengqichen 2025-01-10 17:17:40 +08:00
parent 08ddb6c625
commit d1bbd97d7f

View File

@ -155,7 +155,7 @@ const ProjectGroupList: React.FC = () => {
{ {
accessorKey: 'projectGroupCode', accessorKey: 'projectGroupCode',
header: '项目组编码', header: '项目组编码',
size: 120, size: 180,
}, },
{ {
accessorKey: 'projectGroupName', accessorKey: 'projectGroupName',
@ -168,21 +168,41 @@ const ProjectGroupList: React.FC = () => {
size: 200, size: 200,
}, },
{ {
accessorKey: 'type', id: 'type',
header: '项目组类型', header: '项目组类型',
size: 150, size: 120,
cell: ({row}) => { cell: ({row}) => {
const typeInfo = getProjectTypeInfo(row.original.type); const typeInfo = getProjectTypeInfo(row.original.type);
return ( return (
<Badge variant="outline"> <Badge variant="outline" className="flex items-center gap-1">
<span className="flex items-center gap-1"> {typeInfo.icon}
{typeInfo.icon} {typeInfo.label}
{typeInfo.label}
</span>
</Badge> </Badge>
); );
}, },
}, },
{
accessorKey: 'totalEnvironments',
header: '环境数量',
size: 100,
cell: ({row}) => (
<div className="flex items-center gap-1">
<EnvironmentOutlined/>
<span>{row.original.totalEnvironments}</span>
</div>
),
},
{
accessorKey: 'totalApplications',
header: '项目数量',
size: 100,
cell: ({row}) => (
<div className="flex items-center gap-1">
<TeamOutlined/>
<span>{row.original.totalApplications}</span>
</div>
),
},
{ {
accessorKey: 'enabled', accessorKey: 'enabled',
header: '状态', header: '状态',
@ -193,28 +213,6 @@ const ProjectGroupList: React.FC = () => {
</Badge> </Badge>
), ),
}, },
{
accessorKey: 'totalEnvironments',
header: '环境数量',
size: 100,
cell: ({row}) => (
<span className="flex items-center gap-1">
<EnvironmentOutlined/>
{row.original.totalEnvironments || 0}
</span>
),
},
{
accessorKey: 'totalApplications',
header: '项目数量',
size: 100,
cell: ({row}) => (
<span className="flex items-center gap-1">
<TeamOutlined/>
{row.original.totalApplications || 0}
</span>
),
},
{ {
accessorKey: 'sort', accessorKey: 'sort',
header: '排序', header: '排序',
@ -282,19 +280,19 @@ const ProjectGroupList: React.FC = () => {
<div className="flex items-center gap-4"> <div className="flex items-center gap-4">
<Input <Input
placeholder="项目组编码" placeholder="项目组编码"
value={form.getValues('projectGroupCode')} value={form.watch('projectGroupCode')}
onChange={(e) => form.setValue('projectGroupCode', e.target.value)} onChange={(e) => form.setValue('projectGroupCode', e.target.value)}
className="max-w-[200px]" className="max-w-[200px]"
/> />
<Input <Input
placeholder="项目组名称" placeholder="项目组名称"
value={form.getValues('projectGroupName')} value={form.watch('projectGroupName')}
onChange={(e) => form.setValue('projectGroupName', e.target.value)} onChange={(e) => form.setValue('projectGroupName', e.target.value)}
className="max-w-[200px]" className="max-w-[200px]"
/> />
<Select <Select
value={form.getValues('type')} value={form.watch('type')}
onValueChange={(value) => form.setValue('type', value)} onValueChange={(value) => form.setValue('type', value as ProjectGroupTypeEnum)}
> >
<SelectTrigger className="max-w-[200px]"> <SelectTrigger className="max-w-[200px]">
<SelectValue placeholder="项目组类型"/> <SelectValue placeholder="项目组类型"/>
@ -305,7 +303,7 @@ const ProjectGroupList: React.FC = () => {
</SelectContent> </SelectContent>
</Select> </Select>
<Select <Select
value={form.getValues('enabled')?.toString()} value={form.watch('enabled')?.toString()}
onValueChange={(value) => form.setValue('enabled', value === 'true')} onValueChange={(value) => form.setValue('enabled', value === 'true')}
> >
<SelectTrigger className="max-w-[200px]"> <SelectTrigger className="max-w-[200px]">
@ -319,8 +317,7 @@ const ProjectGroupList: React.FC = () => {
<Button variant="outline" onClick={() => form.reset()}> <Button variant="outline" onClick={() => form.reset()}>
</Button> </Button>
<Button variant="ghost" onClick={() => handleSearch(form.getValues())}> <Button onClick={() => loadData(form.getValues())}>
<SearchOutlined className="mr-1"/>
</Button> </Button>
</div> </div>