瀏覽代碼

前端分页功能修复

skyline 1 月之前
父節點
當前提交
6ce9cfd6db
共有 31 個文件被更改,包括 34 次插入32 次删除
  1. 1 1
      haha-admin-web/src/utils/paginationHelper.ts
  2. 1 1
      haha-admin-web/src/views/account-settings/components/SecurityLog.vue
  3. 1 1
      haha-admin-web/src/views/checkin/utils/hook.tsx
  4. 1 1
      haha-admin-web/src/views/customer/utils/hook.tsx
  5. 1 1
      haha-admin-web/src/views/device/utils/hook.tsx
  6. 1 1
      haha-admin-web/src/views/distribution/commission/utils/hook.tsx
  7. 1 1
      haha-admin-web/src/views/distribution/referral/utils/hook.tsx
  8. 1 1
      haha-admin-web/src/views/distribution/report/index.vue
  9. 1 1
      haha-admin-web/src/views/distribution/withdrawal/utils/hook.tsx
  10. 1 1
      haha-admin-web/src/views/inventory/logs/utils/hook.tsx
  11. 1 1
      haha-admin-web/src/views/inventory/records/utils/hook.tsx
  12. 1 1
      haha-admin-web/src/views/inventory/utils/hook.tsx
  13. 1 1
      haha-admin-web/src/views/layer-template/utils/hook.ts
  14. 1 1
      haha-admin-web/src/views/marketing/invite/records.vue
  15. 1 1
      haha-admin-web/src/views/marketing/user-coupon/utils/hook.tsx
  16. 1 1
      haha-admin-web/src/views/order/utils/hook.tsx
  17. 1 1
      haha-admin-web/src/views/product/new-apply/utils/hook.tsx
  18. 4 2
      haha-admin-web/src/views/product/utils/hook.tsx
  19. 1 1
      haha-admin-web/src/views/shop/utils/hook.tsx
  20. 1 1
      haha-admin-web/src/views/statistics/device/index.vue
  21. 1 1
      haha-admin-web/src/views/statistics/product/index.vue
  22. 1 1
      haha-admin-web/src/views/statistics/profit/index.vue
  23. 1 1
      haha-admin-web/src/views/statistics/repurchase/index.vue
  24. 1 1
      haha-admin-web/src/views/statistics/shop/index.vue
  25. 1 1
      haha-admin-web/src/views/sync/utils/hook.tsx
  26. 1 1
      haha-admin-web/src/views/system/admin/utils/hook.tsx
  27. 1 1
      haha-admin-web/src/views/system/announcement/utils/hook.tsx
  28. 1 1
      haha-admin-web/src/views/system/operation-log/utils/hook.tsx
  29. 1 1
      haha-admin-web/src/views/system/role/utils/hook.tsx
  30. 1 1
      haha-admin-web/src/views/system/user/utils/hook.tsx
  31. 1 1
      haha-admin-web/src/views/timed-discount/utils/hook.tsx

+ 1 - 1
haha-admin-web/src/utils/paginationHelper.ts

@@ -72,5 +72,5 @@ export function updatePaginationData(
   pagination: PaginationProps,
   data: { list: any[]; total: number }
 ): void {
-  pagination.total = data.total || 0;
+  pagination.total = Number(data.total) || 0;
 }

+ 1 - 1
haha-admin-web/src/views/account-settings/components/SecurityLog.vue

@@ -57,7 +57,7 @@ async function onSearch() {
   loading.value = true;
   const { data } = await getMineLogs();
   dataList.value = data.list;
-  pagination.total = data.total;
+  pagination.total = Number(data.total);
   pagination.pageSize = data.pageSize;
   pagination.currentPage = data.currentPage;
 

+ 1 - 1
haha-admin-web/src/views/checkin/utils/hook.tsx

@@ -114,7 +114,7 @@ export function useCheckin() {
       const { data } = await getCheckinList(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } finally {
       loading.value = false;

+ 1 - 1
haha-admin-web/src/views/customer/utils/hook.tsx

@@ -123,7 +123,7 @@ export function useCustomer(tableRef: Ref) {
       const { data } = await getUserList(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } catch (error) {
       console.error("获取客户列表失败:", error);

+ 1 - 1
haha-admin-web/src/views/device/utils/hook.tsx

@@ -141,7 +141,7 @@ export function useDevice(tableRef: Ref) {
       
       const { data } = await getDeviceList(searchParams);
       dataList.value = data.list;
-      pagination.total = data.total;
+      pagination.total = Number(data.total);
     } catch (error) {
       console.error("获取设备列表失败:", error);
       dataList.value = [];

+ 1 - 1
haha-admin-web/src/views/distribution/commission/utils/hook.tsx

@@ -134,7 +134,7 @@ export function useCommission() {
       const { data } = await getCommissionList(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } catch (error) {
       console.error("获取佣金记录列表失败:", error);

+ 1 - 1
haha-admin-web/src/views/distribution/referral/utils/hook.tsx

@@ -125,7 +125,7 @@ export function useReferral() {
       const { data } = await getReferralList(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } catch (error) {
       console.error("获取推荐记录列表失败:", error);

+ 1 - 1
haha-admin-web/src/views/distribution/report/index.vue

@@ -110,7 +110,7 @@ async function onSearch() {
     const { data } = await getReportList(searchParams);
     if (data) {
       dataList.value = data.list || [];
-      pagination.total = data.total || 0;
+      pagination.total = Number(data.total) || 0;
     }
   } catch (error) {
     console.error("获取月度报表列表失败:", error);

+ 1 - 1
haha-admin-web/src/views/distribution/withdrawal/utils/hook.tsx

@@ -123,7 +123,7 @@ export function useWithdrawal() {
       const { data } = await getWithdrawalList(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } catch (error) {
       console.error("获取提现记录列表失败:", error);

+ 1 - 1
haha-admin-web/src/views/inventory/logs/utils/hook.tsx

@@ -104,7 +104,7 @@ export function useInventoryLogs() {
       });
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } finally {
       loading.value = false;

+ 1 - 1
haha-admin-web/src/views/inventory/records/utils/hook.tsx

@@ -120,7 +120,7 @@ export function useStockRecords() {
       const { data } = await getStockRecords(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } finally {
       loading.value = false;

+ 1 - 1
haha-admin-web/src/views/inventory/utils/hook.tsx

@@ -113,7 +113,7 @@ export function useInventory(tableRef: Ref) {
       const { data } = await getInventoryList(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } catch (error) {
       console.error("获取库存列表失败:", error);

+ 1 - 1
haha-admin-web/src/views/layer-template/utils/hook.ts

@@ -242,7 +242,7 @@ export function useProduct(tableRef?: Ref) {
 
       const { data } = await getLayerTemplateList(searchParams);
       dataList.value = data.list || [];
-      pagination.total = data.total || 0;
+      pagination.total = Number(data.total) || 0;
     } catch (error) {
       console.error("获取层模版列表失败:", error);
       message("获取层模版列表失败", { type: "error" });

+ 1 - 1
haha-admin-web/src/views/marketing/invite/records.vue

@@ -83,7 +83,7 @@ async function onSearch() {
     const { data } = await getInviteRecords(params);
     if (data) {
       dataList.value = data.list || [];
-      pagination.total = data.total || 0;
+      pagination.total = Number(data.total) || 0;
     }
   } finally {
     loading.value = false;

+ 1 - 1
haha-admin-web/src/views/marketing/user-coupon/utils/hook.tsx

@@ -117,7 +117,7 @@ export function useUserCoupon() {
       const { data } = await getUserCouponList(params);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } catch (error) {
       console.error("查询用户优惠券失败:", error);

+ 1 - 1
haha-admin-web/src/views/order/utils/hook.tsx

@@ -211,7 +211,7 @@ export function useOrder(tableRef: Ref) {
       // @ts-ignore - data 是 PageResult 结构
       dataList.value = data.list || [];
       // @ts-ignore - data 是 PageResult 结构
-      pagination.total = data.total || 0;
+      pagination.total = Number(data.total) || 0;
     } catch (error) {
       console.error("获取订单列表失败:", error);
       dataList.value = [];

+ 1 - 1
haha-admin-web/src/views/product/new-apply/utils/hook.tsx

@@ -138,7 +138,7 @@ export function useNewProductApply(tableRef: Ref) {
       const { data } = await getNewProductApplyList(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } finally {
       loading.value = false;

+ 4 - 2
haha-admin-web/src/views/product/utils/hook.tsx

@@ -40,7 +40,9 @@ export function useProduct(tableRef: Ref) {
     total: 0,
     pageSize: 10,
     currentPage: 1,
-    background: true
+    background: true,
+    pageSizes: [10, 20, 50, 100],
+    layout: "total, sizes, prev, pager, next, jumper"
   });
 
   const categoryOptions = [
@@ -194,7 +196,7 @@ export function useProduct(tableRef: Ref) {
         syncStatus?: number;
       });
       dataList.value = data.list;
-      pagination.total = data.total;
+      pagination.total = Number(data.total);
     } catch (error) {
       console.error("获取商品列表失败:", error);
     } finally {

+ 1 - 1
haha-admin-web/src/views/shop/utils/hook.tsx

@@ -146,7 +146,7 @@ export function useShop(tableRef: Ref) {
       
       const { data } = await getShopList(searchParams);
       dataList.value = data.list || [];
-      pagination.total = data.total || 0;
+      pagination.total = Number(data.total) || 0;
     } catch (error) {
       console.error("获取门店列表失败:", error);
     } finally {

+ 1 - 1
haha-admin-web/src/views/statistics/device/index.vue

@@ -65,7 +65,7 @@ async function fetchDeviceList() {
     
     const { data } = await getDeviceList(params);
     tableData.value = data.list || [];
-    total.value = data.total || 0;
+    total.value = Number(data.total) || 0;
   } catch (error) {
     console.error("获取设备统计数据失败:", error);
   } finally {

+ 1 - 1
haha-admin-web/src/views/statistics/product/index.vue

@@ -40,7 +40,7 @@ async function fetchProductList() {
     
     const { data } = await getProductList(params);
     tableData.value = data.list || [];
-    total.value = data.total || 0;
+    total.value = Number(data.total) || 0;
   } catch (error) {
     console.error("获取商品统计数据失败:", error);
   } finally {

+ 1 - 1
haha-admin-web/src/views/statistics/profit/index.vue

@@ -66,7 +66,7 @@ async function fetchProfitList() {
     
     const { data } = await getProfitList(params);
     tableData.value = data.list || [];
-    total.value = data.total || 0;
+    total.value = Number(data.total) || 0;
   } catch (error) {
     console.error("获取利润数据失败:", error);
   } finally {

+ 1 - 1
haha-admin-web/src/views/statistics/repurchase/index.vue

@@ -111,7 +111,7 @@ async function fetchUserList() {
     
     const { data } = await getRepurchaseUsers(params);
     tableData.value = data.list || [];
-    total.value = data.total || 0;
+    total.value = Number(data.total) || 0;
   } catch (error) {
     console.error("获取用户复购数据失败:", error);
   } finally {

+ 1 - 1
haha-admin-web/src/views/statistics/shop/index.vue

@@ -66,7 +66,7 @@ async function fetchShopList() {
     
     const { data } = await getShopList(params);
     tableData.value = data.list || [];
-    total.value = data.total || 0;
+    total.value = Number(data.total) || 0;
   } catch (error) {
     console.error("获取门店统计数据失败:", error);
   } finally {

+ 1 - 1
haha-admin-web/src/views/sync/utils/hook.tsx

@@ -202,7 +202,7 @@ export function useSync() {
       const { data } = await getSyncRecords(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
         // 更新模块卡片的最近同步信息
         updateModuleLastSync(data.list);
       }

+ 1 - 1
haha-admin-web/src/views/system/admin/utils/hook.tsx

@@ -216,7 +216,7 @@ export function useAdmin(tableRef: Ref) {
       const { data } = await getAdminList(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } catch (error) {
       console.error("获取管理员列表失败:", error);

+ 1 - 1
haha-admin-web/src/views/system/announcement/utils/hook.tsx

@@ -126,7 +126,7 @@ export function useAnnouncement() {
       const { data } = await getAnnouncementList(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } finally {
       loading.value = false;

+ 1 - 1
haha-admin-web/src/views/system/operation-log/utils/hook.tsx

@@ -119,7 +119,7 @@ export function useOperationLog() {
       const { data } = await getOperationLogList(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } finally {
       loading.value = false;

+ 1 - 1
haha-admin-web/src/views/system/role/utils/hook.tsx

@@ -209,7 +209,7 @@ export function useRole(treeRef: Ref) {
       
       const { data } = await getRoleList(searchParams);
       dataList.value = data.list;
-      pagination.total = data.total;
+      pagination.total = Number(data.total);
     } catch (error) {
       console.error("获取角色列表失败:", error);
       dataList.value = [];

+ 1 - 1
haha-admin-web/src/views/system/user/utils/hook.tsx

@@ -288,7 +288,7 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
       const { data } = await getUserList(searchParams);
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } finally {
       setTimeout(() => {

+ 1 - 1
haha-admin-web/src/views/timed-discount/utils/hook.tsx

@@ -873,7 +873,7 @@ function PriceAdjustmentTable(props: { recordId: number }) {
       });
       if (data) {
         dataList.value = data.list || [];
-        pagination.total = data.total || 0;
+        pagination.total = Number(data.total) || 0;
       }
     } finally {
       loading.value = false;