Showing
1 changed file
with
9 additions
and
0 deletions
| ... | ... | @@ -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 | }; | ... | ... |