1
This commit is contained in:
parent
224a3fe5cc
commit
959ff9cc3b
@ -1,12 +1,13 @@
|
|||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
import {PageContainer} from '@ant-design/pro-layout';
|
import {PageContainer} from '@ant-design/pro-layout';
|
||||||
import {Button, Space, Popconfirm, Tag, App} from 'antd';
|
import {Button, Space, Popconfirm, Tag, App, Form, Input, Select, Card} from 'antd';
|
||||||
import {
|
import {
|
||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
EditOutlined,
|
EditOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
TeamOutlined,
|
TeamOutlined,
|
||||||
EnvironmentOutlined,
|
EnvironmentOutlined,
|
||||||
|
SearchOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import {getProjectGroupPage, deleteProjectGroup} from './service';
|
import {getProjectGroupPage, deleteProjectGroup} from './service';
|
||||||
import type {ProjectGroup, ProjectGroupQueryParams} from './types';
|
import type {ProjectGroup, ProjectGroupQueryParams} from './types';
|
||||||
@ -20,6 +21,7 @@ const ProjectGroupList: React.FC = () => {
|
|||||||
const [modalVisible, setModalVisible] = useState(false);
|
const [modalVisible, setModalVisible] = useState(false);
|
||||||
const [currentProject, setCurrentProject] = useState<ProjectGroup>();
|
const [currentProject, setCurrentProject] = useState<ProjectGroup>();
|
||||||
const actionRef = React.useRef<ActionType>();
|
const actionRef = React.useRef<ActionType>();
|
||||||
|
const [searchForm] = Form.useForm();
|
||||||
const {message: messageApi} = App.useApp();
|
const {message: messageApi} = App.useApp();
|
||||||
|
|
||||||
const handleDelete = async (id: number) => {
|
const handleDelete = async (id: number) => {
|
||||||
@ -53,6 +55,10 @@ const ProjectGroupList: React.FC = () => {
|
|||||||
actionRef.current?.reload();
|
actionRef.current?.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleSearch = async (values: any) => {
|
||||||
|
actionRef.current?.reload();
|
||||||
|
};
|
||||||
|
|
||||||
const columns: ProColumns<ProjectGroup>[] = [
|
const columns: ProColumns<ProjectGroup>[] = [
|
||||||
{
|
{
|
||||||
title: '项目组编码',
|
title: '项目组编码',
|
||||||
@ -61,12 +67,18 @@ const ProjectGroupList: React.FC = () => {
|
|||||||
copyable: true,
|
copyable: true,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
|
filters: true,
|
||||||
|
filterSearch: true,
|
||||||
|
onFilter: (value: string, record) => record.projectGroupCode.toLowerCase().includes(value.toLowerCase()),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '项目组名称',
|
title: '项目组名称',
|
||||||
dataIndex: 'projectGroupName',
|
dataIndex: 'projectGroupName',
|
||||||
width: 150,
|
width: 150,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
filters: true,
|
||||||
|
filterSearch: true,
|
||||||
|
onFilter: (value: string, record) => record.projectGroupName.toLowerCase().includes(value.toLowerCase()),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '项目组描述',
|
title: '项目组描述',
|
||||||
@ -171,6 +183,56 @@ const ProjectGroupList: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainer>
|
<PageContainer>
|
||||||
|
<Card style={{ marginBottom: 16 }}>
|
||||||
|
<Form
|
||||||
|
form={searchForm}
|
||||||
|
layout="inline"
|
||||||
|
onFinish={handleSearch}
|
||||||
|
style={{ gap: '16px' }}
|
||||||
|
>
|
||||||
|
<Form.Item name="projectGroupCode" label="项目组编码">
|
||||||
|
<Input placeholder="请输入项目组编码" allowClear />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="projectGroupName" label="项目组名称">
|
||||||
|
<Input placeholder="请输入项目组名称" allowClear />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="type" label="项目组类型">
|
||||||
|
<Select
|
||||||
|
placeholder="请选择项目组类型"
|
||||||
|
allowClear
|
||||||
|
style={{ width: 200 }}
|
||||||
|
options={[
|
||||||
|
{ label: '产品型', value: ProjectGroupTypeEnum.PRODUCT },
|
||||||
|
{ label: '项目型', value: ProjectGroupTypeEnum.PROJECT },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="enabled" label="状态">
|
||||||
|
<Select
|
||||||
|
placeholder="请选择状态"
|
||||||
|
allowClear
|
||||||
|
style={{ width: 120 }}
|
||||||
|
options={[
|
||||||
|
{ label: '启用', value: true },
|
||||||
|
{ label: '禁用', value: false },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item>
|
||||||
|
<Space>
|
||||||
|
<Button type="primary" htmlType="submit" icon={<SearchOutlined />}>
|
||||||
|
搜索
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => {
|
||||||
|
searchForm.resetFields();
|
||||||
|
handleSearch({});
|
||||||
|
}}>
|
||||||
|
重置
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Card>
|
||||||
<ProTable<ProjectGroup>
|
<ProTable<ProjectGroup>
|
||||||
columns={columns}
|
columns={columns}
|
||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
@ -206,12 +268,14 @@ const ProjectGroupList: React.FC = () => {
|
|||||||
}}
|
}}
|
||||||
request={async (params) => {
|
request={async (params) => {
|
||||||
try {
|
try {
|
||||||
|
const formValues = searchForm.getFieldsValue();
|
||||||
const queryParams: ProjectGroupQueryParams = {
|
const queryParams: ProjectGroupQueryParams = {
|
||||||
pageSize: params.pageSize,
|
pageSize: params.pageSize,
|
||||||
pageNum: params.current,
|
pageNum: params.current,
|
||||||
projectGroupName: params.projectGroupName as string,
|
projectGroupCode: formValues.projectGroupCode?.trim(),
|
||||||
projectGroupCode: params.projectGroupCode as string,
|
projectGroupName: formValues.projectGroupName?.trim(),
|
||||||
enabled: params.enabled as boolean,
|
type: formValues.type,
|
||||||
|
enabled: formValues.enabled,
|
||||||
};
|
};
|
||||||
const data = await getProjectGroupPage(queryParams);
|
const data = await getProjectGroupPage(queryParams);
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user