Procházet zdrojové kódy

fix(web): 合并页三处列表分页按 0 基换算(运营对账/合伙人客户/合伙人合同)

分页器是 1 基、后端 page 是 0 基(openapi:页码 0 基索引)⇒ 只在请求边界换算,
否则第 1 页请求带 page=1 会跳过首屏 20 行。三处同改:reconGetList、customerGetList、
contractGetList。

Co-authored-by: Cursor <cursoragent@cursor.com>
cg před 4 dny
rodič
revize
089116a2b5
1 změnil soubory, kde provedl 6 přidání a 3 odebrání
  1. 6 3
      web-scaffold/src/pages/PartyViewPages.tsx

+ 6 - 3
web-scaffold/src/pages/PartyViewPages.tsx

@@ -447,7 +447,8 @@ export function OperatorReconPage() {
   const periodsFetch = useViewFetch(() => reconGetPeriods(), []);
   const periods = periodsFetch.data?.periods ?? null;
   const fetchState = useViewFetch(
-    () => reconGetList({ page, page_size: 20, period: month || undefined, keyword: keyword.trim() || undefined }),
+    // 分页器是 1 基、后端 `page` 是 0 基(openapi:页码 0 基索引)⇒ 只在请求边界换算。
+    () => reconGetList({ page: Math.max(0, page - 1), page_size: 20, period: month || undefined, keyword: keyword.trim() || undefined }),
     [month, keyword, page],
   );
   const { data, fail } = fetchState;
@@ -692,7 +693,8 @@ export function PartyCustomerListPage({ kind }: { kind: "partner" | "operator" }
   const [page, setPage] = useState(1);
   // ⛔ 前端下传 partner_id/operator_id(总则§16.1:范围在服务端谓词层展开)。
   const fetchState = useViewFetch(
-    () => customerGetList({ page, page_size: 20, keyword: keyword.trim() || undefined }),
+    // 分页器是 1 基、后端 `page` 是 0 基(openapi:页码 0 基索引)⇒ 只在请求边界换算。
+    () => customerGetList({ page: Math.max(0, page - 1), page_size: 20, keyword: keyword.trim() || undefined }),
     [keyword, page],
   );
   const { data, fail } = fetchState;
@@ -762,7 +764,8 @@ export function PartyContractListPage({ kind }: { kind: "partner" | "operator" }
   const [page, setPage] = useState(1);
   // 行集=本方客户集合传导(SQL-2 第二段);⛔ 前端下传范围入参。
   const fetchState = useViewFetch(
-    () => contractGetList({ page, page_size: 20, keyword: keyword.trim() || undefined }),
+    // 分页器是 1 基、后端 `page` 是 0 基(openapi:页码 0 基索引)⇒ 只在请求边界换算。
+    () => contractGetList({ page: Math.max(0, page - 1), page_size: 20, keyword: keyword.trim() || undefined }),
     [keyword, page],
   );
   const { data, fail } = fetchState;