From 700f252454d025353a1c0df5e852f69e7c1f23f5 Mon Sep 17 00:00:00 2001 From: cloud370 Date: Tue, 23 Sep 2025 08:57:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DhandleBatchUpdate?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89=E4=B8=8D?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新UseAccountsReturn接口中handleBatchUpdate的类型签名,添加可选的targetIds参数 - 更新BatchOperationsProps接口中onBatchUpdate的类型定义以匹配实际函数签名 - 修复response.data可能为null的TypeScript严格检查错误 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- components/accounts/batch-operations.tsx | 2 +- lib/hooks/use-accounts.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/accounts/batch-operations.tsx b/components/accounts/batch-operations.tsx index 5e47676..3adbc9d 100644 --- a/components/accounts/batch-operations.tsx +++ b/components/accounts/batch-operations.tsx @@ -13,7 +13,7 @@ interface BatchOperationsProps { selectedCount: number; selectedAccounts: Account[]; stats: StatsOverview | null; - onBatchUpdate: (payload: Partial>) => Promise; + onBatchUpdate: (payload: Partial>, targetIds?: number[]) => Promise; onBatchDelete: () => Promise; } diff --git a/lib/hooks/use-accounts.ts b/lib/hooks/use-accounts.ts index cf9c81c..3ab0ac8 100644 --- a/lib/hooks/use-accounts.ts +++ b/lib/hooks/use-accounts.ts @@ -47,7 +47,7 @@ export interface UseAccountsReturn { handleSelectAll: (checked: boolean) => void; handleSelectOne: (id: number, checked: boolean) => void; handleBatchDelete: () => Promise; - handleBatchUpdate: (payload: Partial>) => Promise; + handleBatchUpdate: (payload: Partial>, targetIds?: number[]) => Promise; handleUploadAccounts: (accounts: ScriptUploadItem[], ownerId: string) => Promise; setSelectedIds: (ids: number[]) => void; } @@ -108,8 +108,8 @@ export function useAccounts(): UseAccountsReturn { setAccounts(response.data.list); setPagination(prev => ({ ...prev, - total: response.data.pagination.total, - totalPages: response.data.pagination.totalPages + total: response.data!.pagination.total, + totalPages: response.data!.pagination.totalPages })); } } catch (error) {