Commit 605e26ae79300b7f2a559bb19cc5f025a18eea38

Authored by boyang
2 parents 66e38ec1 ddc5a9a0

Merge branch 'bugfix-0516client' into 'dev'

Bugfix 0516client



See merge request !34
src/pages/Client/Client/index.tsx
... ... @@ -432,14 +432,31 @@ export default () => {
432 432 actionRef={actionRef}
433 433 cardBordered
434 434 request={async (params) => {
  435 + // 获取分页参数
  436 + const { current, pageSize, ...restParams } = params;
  437 +
435 438 const res = await postAdminClientQueryClientPage({
436 439 data: {
437   - ...params,
  440 + ...restParams,
438 441 groupFilter: groupFilter,
  442 + // 明确传递分页参数
  443 + current: current,
  444 + pageSize: pageSize,
439 445 },
440 446 });
441   - const data = res.data;
442   - return data;
  447 +
  448 + // 处理后端返回的实际数据格式
  449 + // 根据提供的JSON,格式已经是 {records, total, current, pages, size, count}
  450 + const result = {
  451 + data: res.data?.records || [], // 数据源是 records 数组
  452 + success: true,
  453 + total: res.data?.total || 0, // 总记录数
  454 + // 返回服务器端的分页信息,让ProTable使用
  455 + current: res.data?.current || 1,
  456 + pageSize: res.data?.size || 10,
  457 + };
  458 +
  459 + return result;
443 460 }}
444 461 search={{
445 462 labelWidth: 'auto',
... ... @@ -504,8 +521,12 @@ export default () => {
504 521 },
505 522 }}
506 523 pagination={{
507   - pageSize: 5,
508   - onChange: (page) => console.log(page),
  524 + defaultPageSize: 10,
  525 + pageSizeOptions: ['5', '20', '50', '100'],
  526 + showSizeChanger: true,
  527 + showQuickJumper: true,
  528 + // 使用服务端返回的分页信息
  529 + responsive: true,
509 530 }}
510 531 dateFormatter="string"
511 532 headerTitle="高级表格"
... ...
src/pages/Client/FollowRecord/index.tsx
... ... @@ -334,13 +334,18 @@ export default () => {
334 334 actionRef={actionRef}
335 335 cardBordered
336 336 request={async (params) => {
  337 + // 获取分页参数
  338 + const { current, pageSize } = params;
  339 +
337 340 const res = await postAdminClientQueryClientComunicationInfo({
338 341 data: {
339 342 ...params,
  343 + // 明确传递分页参数
  344 + current: current,
  345 + pageSize: pageSize,
340 346 },
341 347 });
342 348 if (res.result === RESPONSE_CODE.SUCCESS) {
343   - console.log(JSON.stringify(res.data));
344 349 return {
345 350 ...res.data,
346 351 data: res.data.data.map((item) => {
... ... @@ -349,9 +354,13 @@ export default () => {
349 354 tid: (Math.random() * 1000000).toFixed(0),
350 355 };
351 356 }),
  357 + // 返回服务器端的分页信息,让ProTable使用
  358 + current: res.data.current || 1,
  359 + pageSize: res.data.pageSize || 10,
352 360 };
353 361 } else {
354 362 message.error('获取失败');
  363 + return { data: [], success: false };
355 364 }
356 365 }}
357 366 search={{
... ... @@ -392,7 +401,12 @@ export default () => {
392 401 },
393 402 }}
394 403 pagination={{
395   - pageSize: 5,
  404 + defaultPageSize: 10,
  405 + pageSizeOptions: ['5', '20', '50', '100'],
  406 + showSizeChanger: true,
  407 + showQuickJumper: true,
  408 + // 使用服务端返回的分页信息
  409 + responsive: true,
396 410 onChange: (page) => console.log(page),
397 411 }}
398 412 dateFormatter="string"
... ...