修改列表查询bug
This commit is contained in:
@ -29,16 +29,14 @@ const SupplierAnnualResult: React.FC = () => {
|
||||
const [searchParams, setSearchParams] = useState({});
|
||||
|
||||
// 获取年度结果列表
|
||||
const fetchList = async (params: any = {}) => {
|
||||
const fetchList = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { current, pageSize, ...restParams } = params;
|
||||
const res = await getAnnualResultTaskList({
|
||||
basePageRequest: {
|
||||
pageNo: current,
|
||||
pageSize,
|
||||
pageNo: pagination.current,
|
||||
pageSize: pagination.pageSize,
|
||||
},
|
||||
...restParams,
|
||||
...searchParams,
|
||||
});
|
||||
|
||||
@ -46,8 +44,6 @@ const SupplierAnnualResult: React.FC = () => {
|
||||
setData(res.data?.records || []);
|
||||
setPagination({
|
||||
...pagination,
|
||||
current,
|
||||
pageSize,
|
||||
total: res.data?.total || 0,
|
||||
});
|
||||
} else {
|
||||
@ -61,14 +57,15 @@ const SupplierAnnualResult: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 首次加载获取数据
|
||||
// 监听搜索参数和分页变化,自动请求数据
|
||||
useEffect(() => {
|
||||
fetchList({ current: 1, pageSize: 10 });
|
||||
}, []);
|
||||
fetchList();
|
||||
}, [searchParams, pagination.current, pagination.pageSize]);
|
||||
|
||||
// 表格变化处理
|
||||
const handleTableChange = (paginationParams: any) => {
|
||||
fetchList({
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: paginationParams.current,
|
||||
pageSize: paginationParams.pageSize,
|
||||
});
|
||||
@ -85,15 +82,28 @@ const SupplierAnnualResult: React.FC = () => {
|
||||
delete params.reviewTime;
|
||||
}
|
||||
|
||||
// 更新分页到第一页
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: 1,
|
||||
});
|
||||
|
||||
// 更新搜索参数,会触发useEffect重新请求
|
||||
setSearchParams(params);
|
||||
fetchList({ current: 1, pageSize: pagination.pageSize, ...params });
|
||||
};
|
||||
|
||||
// 重置搜索
|
||||
const handleReset = () => {
|
||||
form.resetFields();
|
||||
|
||||
// 更新分页到第一页
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: 1,
|
||||
});
|
||||
|
||||
// 清空搜索参数,会触发useEffect重新请求
|
||||
setSearchParams({});
|
||||
fetchList({ current: 1, pageSize: pagination.pageSize });
|
||||
};
|
||||
|
||||
// 查看年度统计
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
Form,
|
||||
Select,
|
||||
Typography,
|
||||
DatePicker
|
||||
DatePicker,
|
||||
} from 'antd';
|
||||
import { ArrowLeftOutlined, SearchOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||
import { getAnnualResultSupplierList } from '@/servers/api/supplierAnnual';
|
||||
@ -44,17 +44,17 @@ const SupplierAnnualResultQuery: React.FC = () => {
|
||||
const { taskId, annualTheme } = history.location.state as { taskId: string; annualTheme: string };
|
||||
|
||||
// 获取供应商列表
|
||||
const fetchList = async (params: any = {}) => {
|
||||
const fetchList = async () => {
|
||||
if (!taskId) return;
|
||||
|
||||
try {
|
||||
setLoading(true);
|
||||
const { current, pageSize, ...restParams } = params;
|
||||
const res = await getAnnualResultSupplierList({
|
||||
annualreviewTaskId: taskId,
|
||||
basePageRequest: {
|
||||
pageNo: current,
|
||||
pageSize,
|
||||
pageNo: pagination.current,
|
||||
pageSize: pagination.pageSize,
|
||||
},
|
||||
...restParams,
|
||||
...searchParams,
|
||||
});
|
||||
|
||||
@ -62,8 +62,6 @@ const SupplierAnnualResultQuery: React.FC = () => {
|
||||
setData(res.data?.records || []);
|
||||
setPagination({
|
||||
...pagination,
|
||||
current,
|
||||
pageSize,
|
||||
total: res.data?.total || 0,
|
||||
});
|
||||
} else {
|
||||
@ -77,19 +75,20 @@ const SupplierAnnualResultQuery: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 首次加载获取数据
|
||||
// 监听任务ID变化,初始化数据
|
||||
useEffect(() => {
|
||||
if (taskId) {
|
||||
fetchList({ current: 1, pageSize: 10 });
|
||||
fetchList();
|
||||
} else {
|
||||
message.error('任务ID不存在,无法获取详情');
|
||||
history.goBack();
|
||||
}
|
||||
}, [taskId]);
|
||||
}, [taskId, searchParams, pagination.current, pagination.pageSize]);
|
||||
|
||||
// 表格变化处理
|
||||
const handleTableChange = (paginationParams: any) => {
|
||||
fetchList({
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: paginationParams.current,
|
||||
pageSize: paginationParams.pageSize,
|
||||
});
|
||||
@ -106,15 +105,28 @@ const SupplierAnnualResultQuery: React.FC = () => {
|
||||
delete params.reviewTime;
|
||||
}
|
||||
|
||||
// 更新分页到第一页
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: 1,
|
||||
});
|
||||
|
||||
// 更新搜索参数,会触发useEffect重新请求
|
||||
setSearchParams(params);
|
||||
fetchList({ current: 1, pageSize: pagination.pageSize, ...params });
|
||||
};
|
||||
|
||||
// 重置搜索
|
||||
const handleReset = () => {
|
||||
form.resetFields();
|
||||
|
||||
// 更新分页到第一页
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: 1,
|
||||
});
|
||||
|
||||
// 清空搜索参数,会触发useEffect重新请求
|
||||
setSearchParams({});
|
||||
fetchList({ current: 1, pageSize: pagination.pageSize });
|
||||
};
|
||||
|
||||
// 返回列表页
|
||||
@ -142,7 +154,8 @@ const SupplierAnnualResultQuery: React.FC = () => {
|
||||
dataIndex: 'index',
|
||||
key: 'index',
|
||||
width: 80,
|
||||
render: (_: any, __: any, index: number) => index + 1 + (pagination.current - 1) * pagination.pageSize,
|
||||
render: (_: any, __: any, index: number) =>
|
||||
index + 1 + (pagination.current - 1) * pagination.pageSize,
|
||||
},
|
||||
{
|
||||
title: '供应商名称',
|
||||
@ -191,18 +204,13 @@ const SupplierAnnualResultQuery: React.FC = () => {
|
||||
</div>
|
||||
|
||||
<div className="filter-action-row">
|
||||
<Form
|
||||
form={form}
|
||||
layout="inline"
|
||||
onFinish={handleSearch}
|
||||
className="filter-form"
|
||||
>
|
||||
<Form form={form} layout="inline" onFinish={handleSearch} className="filter-form">
|
||||
<Form.Item name="name" label="供应商名称">
|
||||
<Input placeholder="请输入供应商名称" allowClear />
|
||||
</Form.Item>
|
||||
<Form.Item name="reviewResult" label="审查结果">
|
||||
<Select placeholder="请选择审查结果" allowClear style={{ width: 150 }}>
|
||||
{resultOptions.map(item => (
|
||||
{resultOptions.map((item) => (
|
||||
<Option key={item.value} value={item.value}>
|
||||
{item.label}
|
||||
</Option>
|
||||
@ -210,21 +218,13 @@ const SupplierAnnualResultQuery: React.FC = () => {
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="reviewTime" label="审查时间">
|
||||
<RangePicker
|
||||
placeholder={['开始日期', '结束日期']}
|
||||
format="YYYY-MM-DD"
|
||||
/>
|
||||
<RangePicker placeholder={['开始日期', '结束日期']} format="YYYY-MM-DD" />
|
||||
</Form.Item>
|
||||
<Form.Item className="filter-btns">
|
||||
<Button type="primary" icon={<SearchOutlined />} onClick={() => form.submit()}>
|
||||
搜索
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={handleReset}
|
||||
>
|
||||
<Button type="primary" danger icon={<DeleteOutlined />} onClick={handleReset}>
|
||||
重置
|
||||
</Button>
|
||||
</Form.Item>
|
||||
|
@ -55,18 +55,18 @@ const SupplierAnnualResultQuery2: React.FC = () => {
|
||||
};
|
||||
|
||||
// 获取供应商审查列表
|
||||
const fetchList = async (params: any = {}) => {
|
||||
const fetchList = async () => {
|
||||
if (!supplierId) return;
|
||||
|
||||
try {
|
||||
setLoading(true);
|
||||
const { current, pageSize, ...restParams } = params;
|
||||
const res = await getAnnualResultReviewList({
|
||||
basePageRequest: {
|
||||
pageNo: current,
|
||||
pageSize,
|
||||
pageNo: pagination.current,
|
||||
pageSize: pagination.pageSize,
|
||||
},
|
||||
supplierId, // 使用userId参数传递supplierId
|
||||
userId: supplierId, // 使用userId参数传递supplierId
|
||||
annualreviewTaskId,
|
||||
...restParams,
|
||||
...searchParams,
|
||||
});
|
||||
|
||||
@ -74,8 +74,6 @@ const SupplierAnnualResultQuery2: React.FC = () => {
|
||||
setData(res.data?.records || []);
|
||||
setPagination({
|
||||
...pagination,
|
||||
current,
|
||||
pageSize,
|
||||
total: res.data?.total || 0,
|
||||
});
|
||||
} else {
|
||||
@ -89,19 +87,20 @@ const SupplierAnnualResultQuery2: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 首次加载获取数据
|
||||
// 监听supplierId和搜索参数、分页变化获取数据
|
||||
useEffect(() => {
|
||||
if (supplierId) {
|
||||
fetchList({ current: 1, pageSize: 10 });
|
||||
fetchList();
|
||||
} else {
|
||||
message.error('供应商ID不存在,无法获取详情');
|
||||
history.goBack();
|
||||
}
|
||||
}, [supplierId]);
|
||||
}, [supplierId, searchParams, pagination.current, pagination.pageSize]);
|
||||
|
||||
// 表格变化处理
|
||||
const handleTableChange = (paginationParams: any) => {
|
||||
fetchList({
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: paginationParams.current,
|
||||
pageSize: paginationParams.pageSize,
|
||||
});
|
||||
@ -118,15 +117,28 @@ const SupplierAnnualResultQuery2: React.FC = () => {
|
||||
delete params.reviewTime;
|
||||
}
|
||||
|
||||
// 更新分页到第一页
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: 1,
|
||||
});
|
||||
|
||||
// 更新搜索参数,会触发useEffect重新请求
|
||||
setSearchParams(params);
|
||||
fetchList({ current: 1, pageSize: pagination.pageSize, ...params });
|
||||
};
|
||||
|
||||
// 重置搜索
|
||||
const handleReset = () => {
|
||||
form.resetFields();
|
||||
|
||||
// 更新分页到第一页
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: 1,
|
||||
});
|
||||
|
||||
// 清空搜索参数,会触发useEffect重新请求
|
||||
setSearchParams({});
|
||||
fetchList({ current: 1, pageSize: pagination.pageSize });
|
||||
};
|
||||
|
||||
// 返回列表页
|
||||
@ -163,7 +175,8 @@ const SupplierAnnualResultQuery2: React.FC = () => {
|
||||
dataIndex: 'index',
|
||||
key: 'index',
|
||||
width: 80,
|
||||
render: (_: any, __: any, index: number) => index + 1 + (pagination.current - 1) * pagination.pageSize,
|
||||
render: (_: any, __: any, index: number) =>
|
||||
index + 1 + (pagination.current - 1) * pagination.pageSize,
|
||||
},
|
||||
{
|
||||
title: '供应商名称',
|
||||
|
@ -11,16 +11,12 @@ import {
|
||||
Tooltip,
|
||||
Tag,
|
||||
DatePicker,
|
||||
Row,
|
||||
Col,
|
||||
Card,
|
||||
} from 'antd';
|
||||
import type { TablePaginationConfig } from 'antd';
|
||||
import {
|
||||
SearchOutlined,
|
||||
DeleteOutlined,
|
||||
EyeOutlined,
|
||||
EditOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { getAnnualReviewList } from '@/servers/api/supplierAnnual';
|
||||
import {
|
||||
@ -28,7 +24,8 @@ import {
|
||||
AnnualReviewStatusText,
|
||||
AnnualReviewStatusColor,
|
||||
} from '@/dicts/supplierAnnualReviewDict';
|
||||
import styles from './supplierAnnualReview.less';
|
||||
import { getDictList } from '@/servers/api/dicts';
|
||||
import type { DictItem } from '@/servers/api/dicts';
|
||||
|
||||
const { Option } = Select;
|
||||
const { RangePicker } = DatePicker;
|
||||
@ -44,7 +41,7 @@ interface AnnualReviewSearchParams {
|
||||
const SupplierAnnualReview: React.FC = () => {
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const [reviewStatus, setReviewStatus] = useState<DictItem[]>([]);
|
||||
const [reviewData, setReviewData] = useState<supplierAnnualReview.ReviewRecord[]>([]);
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({
|
||||
current: 1,
|
||||
@ -114,6 +111,11 @@ const SupplierAnnualReview: React.FC = () => {
|
||||
// 首次加载获取数据
|
||||
useEffect(() => {
|
||||
fetchReviewList(pagination.current, pagination.pageSize, {});
|
||||
getDictList('project_status ').then((res) => {
|
||||
if (res.success) {
|
||||
setReviewStatus(res.data);
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
// 处理查看
|
||||
@ -282,8 +284,8 @@ const SupplierAnnualReview: React.FC = () => {
|
||||
</Form.Item>
|
||||
<Form.Item name="reviewStatus" label="状态">
|
||||
<Select placeholder="请选择状态" allowClear style={{ width: 120 }}>
|
||||
{Object.entries(AnnualReviewStatusText).map(([key, value]) => (
|
||||
<Option key={key} value={key}>{value}</Option>
|
||||
{reviewStatus.map((item) => (
|
||||
<Option key={item.code} value={item.code}>{item.dicName}</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
@ -44,17 +44,16 @@ const SupplierAnnualTaskManage: React.FC = () => {
|
||||
});
|
||||
const [searchParams, setSearchParams] = useState<any>({});
|
||||
const [evaluateStatus, setEvaluateStatus] = useState<DictItem[]>([]);
|
||||
|
||||
// 获取年度任务列表
|
||||
const fetchList = async (params: any = {}) => {
|
||||
const fetchList = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { current, pageSize, ...restParams } = params;
|
||||
const res = await getAnnualTaskList({
|
||||
basePageRequest: {
|
||||
pageNo: current,
|
||||
pageSize,
|
||||
pageNo: pagination.current,
|
||||
pageSize: pagination.pageSize,
|
||||
},
|
||||
...restParams,
|
||||
...searchParams,
|
||||
});
|
||||
|
||||
@ -62,8 +61,6 @@ const SupplierAnnualTaskManage: React.FC = () => {
|
||||
setData(res.data?.records || []);
|
||||
setPagination({
|
||||
...pagination,
|
||||
current,
|
||||
pageSize,
|
||||
total: res.data?.total || 0,
|
||||
});
|
||||
} else {
|
||||
@ -77,20 +74,24 @@ const SupplierAnnualTaskManage: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 首次加载获取数据
|
||||
// 获取状态字典
|
||||
useEffect(() => {
|
||||
fetchList({ current: 1, pageSize: 10 });
|
||||
getDictList('project_status').then((res) => {
|
||||
if (res.success) {
|
||||
setEvaluateStatus(res.data);
|
||||
}
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
// 监听搜索参数和分页变化,自动请求数据
|
||||
useEffect(() => {
|
||||
fetchList();
|
||||
}, [searchParams, pagination.current, pagination.pageSize]);
|
||||
|
||||
// 表格变化处理
|
||||
const handleTableChange = (paginationParams: any) => {
|
||||
fetchList({
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: paginationParams.current,
|
||||
pageSize: paginationParams.pageSize,
|
||||
});
|
||||
@ -107,15 +108,28 @@ const SupplierAnnualTaskManage: React.FC = () => {
|
||||
delete params.timeRange;
|
||||
}
|
||||
|
||||
// 更新分页到第一页
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: 1,
|
||||
});
|
||||
|
||||
// 更新搜索参数,会触发useEffect重新请求
|
||||
setSearchParams(params);
|
||||
fetchList({ current: 1, pageSize: pagination.pageSize, ...params });
|
||||
};
|
||||
|
||||
// 重置搜索
|
||||
const handleReset = () => {
|
||||
form.resetFields();
|
||||
|
||||
// 更新分页到第一页
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: 1,
|
||||
});
|
||||
|
||||
// 清空搜索参数,会触发useEffect重新请求
|
||||
setSearchParams({});
|
||||
fetchList({ current: 1, pageSize: pagination.pageSize });
|
||||
};
|
||||
|
||||
// 新增任务
|
||||
|
Reference in New Issue
Block a user