搜索与分页

This commit is contained in:
孙景学
2025-08-12 16:14:24 +08:00
parent fa0e41d1c7
commit a56ebe2948
6 changed files with 39 additions and 32 deletions

View File

@ -75,7 +75,7 @@ const CategoryLibraryManage: React.FC = () => {
const res = await approval({ id });
if (res.code === 200) {
message.success('提交成功');
getList(); // 刷新列表
getList(1, pagination.pageSize || 10);
}
},
});

View File

@ -40,17 +40,17 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
// 查询
const handleSearch = () => {
setPagination(p => ({ ...p, current: 1 }));
getList(selectedKeys ? selectedKeys : currentUser.organizationId);
getList(selectedKeys ? selectedKeys : currentUser.organizationId, 1, pagination.pageSize);
};
const handleReset = () => {
form.resetFields();
setPagination(p => ({ ...p, current: 1 }));
getList(selectedKeys ? selectedKeys : currentUser.organizationId);
getList(selectedKeys ? selectedKeys : currentUser.organizationId, 1, pagination.pageSize);
};
const handleTreeSelect = (keys: string | number) => {
const key = keys as string;
setSelectedKeys(key);
getList(key);
getList(key,1, pagination.pageSize);
};

View File

@ -1,6 +1,6 @@
import React, { useEffect, useState } from "react";
//第三方UI库/组件
import { Form, Button, Table, Input, Space, Tooltip } from 'antd';
import { Form, Button, Table, Input, Space, Tooltip, Select } from 'antd';
import { SearchOutlined, DeleteOutlined } from '@ant-design/icons';
//类型定义
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
@ -11,14 +11,24 @@ import { connect } from 'umi';
// import SupplierDetailModal from './components/SupplierDetailModal';
import CategorySelector from '@/components/TreeCategorySelector';
import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect'
import AccessStatusSelect from '@/components/CommonSelect/AccessStatusSelect'
//本地服务/接口
import { getPageMy } from './services';
import { downloadFile } from '@/utils/download';
import { getDictList } from '@/servers/api/dicts'
//统一列表分页
import tableProps from '@/utils/tableProps'
const accessStatusType = [
{ code: '0', dicName: '未准入' },
{ code: '1', dicName: '已准入' },
{ code: '2', dicName: '已退出' }
]
//准入状态
const statusColor = (status: string) => {
if (status === '已驳回' || status === '已退出') return '#ef6969';
if (status === '已准入') return '#004f8e';
return undefined;
};
// 列表数据接口
interface Data {
id: number;
@ -54,13 +64,13 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
// 查询
const handleSearch = () => {
setPagination({ ...pagination, current: 1 });
getList();
getList(1, pagination.pageSize);
};
// 重置
const handleReset = () => {
form.resetFields();
setPagination({ ...pagination, current: 1 });
getList();
getList(1, pagination.pageSize);
};
//列表方法
const getList = async (pageNo: number = 1, pageSize: number = 10) => {
@ -79,7 +89,6 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
}
};
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
const [approveTypeMap, setApproveTypeMap] = useState<{ [code: string]: string }>({});
// 初始化
useEffect(() => {
getDictList('enterprise_type').then((res: any) => {
@ -92,15 +101,6 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
setEnterpriseTypeMap(map);
}
})
getDictList('approve_type').then((res) => {
if (res.code == 200) {
const map: { [code: string]: string } = {};
res.data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setApproveTypeMap(map);
}
})
getList();
}, []);
@ -184,11 +184,14 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
},
{
title: '准入状态',
dataIndex: 'accessStatus',
key: 'accessStatus',
dataIndex: 'accessStatusCn',
key: 'accessStatusCn',
width: 160,
align: 'center',
width: 140,
render: (code: string) => approveTypeMap[code] || code
render: (val: string) =>
<span style={{
color: statusColor(val) || (val === '未准入' ? '#aaa' : undefined),
}}>{val}</span>
},
{
title: '操作',
@ -232,7 +235,11 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
<CategorySelector multiple={false} />
</Form.Item>
<Form.Item name="accessStatus" label="准入状态">
<AccessStatusSelect />
<Select style={{ width: 160 }} placeholder="请选择" allowClear>
{accessStatusType?.map(item => (
<Select.Option key={item.code} value={item.code}>{item.dicName}</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item name="supplierType" label="境内/境外">
<RegionTypeSelect />
@ -260,7 +267,7 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
pagination={{ ...tableProps.pagination, total: pagination.total }}
onChange={(pagination) => getList(pagination.current!, pagination.pageSize!)}
style={{ flex: 1, minHeight: 0 }}
scroll={{ y: 'calc(100vh - 350px)' }}
scroll={{ y: 'calc(100vh - 380px)' }}
/>
</div>
{/* 查看组件

View File

@ -43,18 +43,18 @@ const PersonQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
// 查询
const handleSearch = () => {
setPagination(p => ({ ...p, current: 1 }));
getList(selectedKeys ? selectedKeys : currentUser.organizationId);
getList(selectedKeys ? selectedKeys : currentUser.organizationId, 1, pagination.pageSize);
};
const handleReset = () => {
form.resetFields();
setPagination(p => ({ ...p, current: 1 }));
getList(selectedKeys ? selectedKeys : currentUser.organizationId);
getList(selectedKeys ? selectedKeys : currentUser.organizationId, 1, pagination.pageSize);
};
const handleTreeSelect = (keys: string | number) => {
const key = keys as string;
setSelectedKeys(key);
getList(key);
getList(key, 1, pagination.pageSize);
};
const getList = async (orgId: string, pageNo: number = 1, pageSize: number = 10) => {

View File

@ -63,13 +63,13 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
// 搜索
const handleSearch = () => {
setPagination({ ...pagination, current: 1 });
getList();
getList(1, pagination.pageSize);
};
// 重置
const handleReset = () => {
form.resetFields();
setPagination({ ...pagination, current: 1 });
getList();
getList(1, pagination.pageSize);
};
//列表方法
const getList = async (pageNo: number = 1, pageSize: number = 10) => {
@ -235,7 +235,7 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
pagination={{ ...tableProps.pagination, total: pagination.total }}
onChange={(pagination) => getList(pagination.current!, pagination.pageSize!)}
style={{ flex: 1, minHeight: 0 }}
scroll={{ y: 'calc(100vh - 350px)' }}
scroll={{ y: 'calc(100vh - 380px)' }}
/>
{/* 查看组件 */}
<SupplierViewModal

View File

@ -68,7 +68,7 @@ const blacklistManage: React.FC = () => {
const res = await submit({ id });
if (res.code === 200) {
message.success('提交成功');
getList(); // 刷新列表
getList(1, pagination.pageSize);
}
},
});
@ -80,7 +80,7 @@ const blacklistManage: React.FC = () => {
const res = await restoreSubmit({ id });
if (res.code === 200) {
message.success('提交成功');
getList(); // 刷新列表
getList(1, pagination.pageSize);
}
},
});