|
|
@ -63,6 +63,8 @@ export default defineComponent({ |
|
|
|
searchTableSelectionsList:[],//回显列表 |
|
|
|
selectionColor: propTypes.bool.def(false), |
|
|
|
rowKey: propTypes.string.def(''), |
|
|
|
// true 取消父子关联; false 关联 |
|
|
|
isCheckStrictly: propTypes.bool.def(false), |
|
|
|
}, |
|
|
|
emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort','getSelectionRows','rowClick'], |
|
|
|
setup(props, { attrs, slots, emit, expose }) { |
|
|
@ -120,8 +122,14 @@ export default defineComponent({ |
|
|
|
const selections = ref<Recordable[]>([]) |
|
|
|
const sortRef = ref() |
|
|
|
// 选中某行 |
|
|
|
const selectRow = ()=>{ |
|
|
|
console.log(currentPageRef.value,elTableRef.value?.getSelectionRows()) |
|
|
|
const selectRow = (selection,row)=>{ |
|
|
|
console.log('selectRow',row) |
|
|
|
const selected = elTableRef.value?.getSelectionRows().some((item) => item.id === row.id) |
|
|
|
if(props.isCheckStrictly&&selected&&row.children){//取消关联 |
|
|
|
row.children.forEach(item => { |
|
|
|
elTableRef.value?.toggleRowSelection(item, false); |
|
|
|
}); |
|
|
|
} |
|
|
|
emit('getSelectionRows', currentPageRef.value,elTableRef.value?.getSelectionRows()) |
|
|
|
} |
|
|
|
//全选回调 |
|
|
|