解决参数缓存问题,调用reset重新为获取全部刷新参数

This commit is contained in:
WindowBird 2025-11-08 17:13:14 +08:00
parent 1b53149d88
commit d7690fc0b4

View File

@ -147,7 +147,9 @@ const {
getList, getList,
loadMore, loadMore,
updateParams, updateParams,
refresh refresh,
queryParams,
reset
} = usePagination({ } = usePagination({
fetchData: getCustomerList, fetchData: getCustomerList,
mode: 'loadMore', mode: 'loadMore',
@ -203,18 +205,27 @@ const formatDateTime = (dateTime) => {
// //
const buildQueryParams = () => { const buildQueryParams = () => {
const params = {}; const params = {};
// statusList // statusList
if (filterStatus.value) { if (filterStatus.value) {
const statusMap = { const statusMap = {
'following': ['1'], // 'following': ['1'], //
'pending': ['2'] // 'pending': ['2'], //
}; };
if (statusMap[filterStatus.value]) {
params.statusList = statusMap[filterStatus.value]; const statusList = statusMap[filterStatus.value];
if (statusList) {
params.statusList = statusList;
console.log(`筛选状态: ${filterStatus.value} -> statusList:`, statusList);
} else {
console.log(`未知的筛选状态: ${filterStatus.value},跳过状态筛选`);
} }
} else {
console.log('无筛选状态,返回空参数');
} }
return params; return params;
}; };
@ -333,8 +344,23 @@ const handleAddCustomer = () => {
// //
watch(filterStatus, () => { watch(filterStatus, () => {
console.log('筛选状态变化:', filterStatus.value); console.log('筛选状态变化:', filterStatus.value);
const params = buildQueryParams();
updateParams(params); // ""
if (filterStatus.value === '') {
//
reset();
//
queryParams.value = {
pageNum: 1,
pageSize: 10
};
//
refresh();
} else {
// 使 updateParams
const params = buildQueryParams();
updateParams(params);
}
}); });
// //