Commit 862e532e12304de1b6d8a07ad13c1691e4350cba
1 parent
f82f9285
fix: bug修复
Showing
2 changed files
with
31 additions
and
3 deletions
src/views/project/finance/financeProfit/ProductProfit/InnerData/index.vue
... | ... | @@ -116,11 +116,22 @@ |
116 | 116 | bordered: true, |
117 | 117 | columns: COLUMNS, |
118 | 118 | rowKey: 'orderId', |
119 | + customRow: () => { | |
120 | + return { | |
121 | + onClick: (e) => { | |
122 | + // Prevent row selection when clicking anywhere except checkboxes | |
123 | + if (!e.target.closest('.ant-checkbox-wrapper')) { | |
124 | + e.stopPropagation(); | |
125 | + } | |
126 | + }, | |
127 | + }; | |
128 | + }, | |
119 | 129 | rowSelection: { |
120 | 130 | type: 'checkbox', |
121 | 131 | selectedRowKeys: checkedKeys as any, |
122 | 132 | onSelect: onSelect, |
123 | 133 | onSelectAll: onSelectAll, |
134 | + checkStrictly: true, | |
124 | 135 | }, |
125 | 136 | formConfig: { |
126 | 137 | labelWidth: 120, | ... | ... |
src/views/project/finance/financeProfit/ServiceProfit/PackageProfit/index.vue
... | ... | @@ -119,18 +119,29 @@ |
119 | 119 | api: getPackageProfit, |
120 | 120 | bordered: true, |
121 | 121 | columns: COLUMNS, |
122 | - rowKey: 'id', | |
122 | + rowKey: (record) => record.orderId, | |
123 | 123 | formConfig: { |
124 | 124 | labelWidth: 120, |
125 | 125 | schemas: searchFormSchema, |
126 | 126 | autoSubmitOnEnter: true, |
127 | 127 | }, |
128 | - rowKey: (record) => record.orderId, | |
128 | + // Add custom row props to prevent selection when clicking rows | |
129 | + customRow: () => { | |
130 | + return { | |
131 | + onClick: (e) => { | |
132 | + // Prevent row selection when clicking anywhere except checkboxes | |
133 | + if (!e.target.closest('.ant-checkbox-wrapper')) { | |
134 | + e.stopPropagation(); | |
135 | + } | |
136 | + }, | |
137 | + }; | |
138 | + }, | |
129 | 139 | rowSelection: { |
130 | 140 | type: 'checkbox', |
131 | 141 | selectedRowKeys: checkedKeys as any, |
132 | 142 | onSelect: onSelect, |
133 | 143 | onSelectAll: onSelectAll, |
144 | + checkStrictly: true, | |
134 | 145 | }, |
135 | 146 | useSearchForm: true, |
136 | 147 | showTableSetting: true, |
... | ... | @@ -350,7 +361,13 @@ |
350 | 361 | handleClearChoose(); |
351 | 362 | reload(); |
352 | 363 | } |
353 | - async function onSelect(record, selected: boolean) { | |
364 | + async function onSelect(record, selected: boolean, _selectedRows, nativeEvent) { | |
365 | + // Only process selection if it's coming from a checkbox click or programmatically | |
366 | + // This checks if the event is from clicking the row - then we ignore it | |
367 | + if (nativeEvent && nativeEvent.target && !nativeEvent.target.closest('.ant-checkbox-wrapper')) { | |
368 | + return; | |
369 | + } | |
370 | + | |
354 | 371 | const rowKey = record.orderId; |
355 | 372 | if (selected) { |
356 | 373 | checkedKeys.value = [...checkedKeys.value, rowKey]; | ... | ... |