Commit 6897f6a0a0175f0c1291383d0b5340ae9f16eea2

Authored by sqy
1 parent afc65fd8

fix:优化批量删除的hooks函数

... ... @@ -17,6 +17,7 @@ interface selectionOptions {
17 17 clickToRowSelect: boolean;
18 18 rowSelection: {
19 19 onSelect: (_, __, selectedRowKeys: string[]) => void;
  20 + onSelectAll: (_, selectedRows: string[], __) => void;
20 21 type: 'radio' | 'checkbox';
21 22 };
22 23 }
... ... @@ -32,6 +33,13 @@ export const useBatchDelete = (
32 33 const selectedRowKeys = selectedRows.map((item) => item.id);
33 34 selectedRowIds.value = selectedRowKeys;
34 35 };
  36 +
  37 + // 全选按钮
  38 + const onSelectAll = (_, selectedRows, __) => {
  39 + console.log(selectedRows);
  40 + const selectedRowKeys = selectedRows.map((item) => item.id);
  41 + selectedRowIds.value = selectedRowKeys;
  42 + };
35 43 const handleDeleteOrBatchDelete = async (record: Recordable | null) => {
36 44 if (record) {
37 45 try {
... ... @@ -59,6 +67,7 @@ export const useBatchDelete = (
59 67 clickToRowSelect: false,
60 68 rowSelection: {
61 69 onSelect,
  70 + onSelectAll,
62 71 type: 'checkbox',
63 72 },
64 73 };
... ...