1
This commit is contained in:
parent
871dd32c91
commit
5eb44c62cb
27
frontend/src/components/ui/page-container.tsx
Normal file
27
frontend/src/components/ui/page-container.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import React from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
interface PageContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
const PageContainer = React.forwardRef<HTMLDivElement, PageContainerProps>(
|
||||
({ className, children, ...props }, ref) => {
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"flex w-full flex-col space-y-4 p-6",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
PageContainer.displayName = "PageContainer";
|
||||
|
||||
export { PageContainer };
|
||||
@ -1,5 +1,5 @@
|
||||
import React, {useState} from 'react';
|
||||
import {PageContainer} from '@ant-design/pro-layout';
|
||||
import {PageContainer} from '@/components/ui/page-container';
|
||||
import {
|
||||
PlusOutlined,
|
||||
EditOutlined,
|
||||
@ -269,77 +269,61 @@ const ProjectGroupList: React.FC = () => {
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<Card className="mb-4">
|
||||
<CardHeader>
|
||||
<CardTitle>搜索条件</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(handleSearch)} className="flex items-end gap-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="projectGroupCode"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>项目组编码</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="请输入项目组编码" {...field} />
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<div className="flex items-center justify-between">
|
||||
<h2 className="text-3xl font-bold tracking-tight">项目组管理</h2>
|
||||
<Button onClick={() => setModalVisible(true)}>
|
||||
新建
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="projectGroupName"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>项目组名称</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="请输入项目组名称" {...field} />
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
)}
|
||||
<Card>
|
||||
<div className="p-6">
|
||||
<div className="flex items-center gap-4">
|
||||
<Input
|
||||
placeholder="项目组编码"
|
||||
value={form.getValues('projectGroupCode')}
|
||||
onChange={(e) => form.setValue('projectGroupCode', e.target.value)}
|
||||
className="max-w-[200px]"
|
||||
/>
|
||||
<Input
|
||||
placeholder="项目组名称"
|
||||
value={form.getValues('projectGroupName')}
|
||||
onChange={(e) => form.setValue('projectGroupName', e.target.value)}
|
||||
className="max-w-[200px]"
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="type"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>项目组类型</FormLabel>
|
||||
<Select
|
||||
onValueChange={field.onChange}
|
||||
defaultValue={field.value}
|
||||
value={form.getValues('type')}
|
||||
onValueChange={(value) => form.setValue('type', value)}
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="w-[200px]">
|
||||
<SelectValue placeholder="请选择项目组类型" />
|
||||
<SelectTrigger className="max-w-[200px]">
|
||||
<SelectValue placeholder="项目组类型" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectItem value={ProjectGroupTypeEnum.PRODUCT}>产品型</SelectItem>
|
||||
<SelectItem value={ProjectGroupTypeEnum.PROJECT}>项目型</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() => form.reset()}
|
||||
<Select
|
||||
value={form.getValues('enabled')?.toString()}
|
||||
onValueChange={(value) => form.setValue('enabled', value === 'true')}
|
||||
>
|
||||
<SelectTrigger className="max-w-[200px]">
|
||||
<SelectValue placeholder="状态" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="true">启用</SelectItem>
|
||||
<SelectItem value="false">禁用</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button variant="outline" onClick={() => form.reset()}>
|
||||
重置
|
||||
</Button>
|
||||
<Button type="submit">
|
||||
<Button variant="ghost" onClick={() => handleSearch(form.getValues())}>
|
||||
<SearchOutlined className="mr-1" />
|
||||
搜索
|
||||
</Button>
|
||||
</form>
|
||||
</Form>
|
||||
</CardContent>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user