|
|
@ -58,7 +58,7 @@ export default defineComponent({ |
|
|
|
default: () => [] |
|
|
|
} |
|
|
|
}, |
|
|
|
emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort'], |
|
|
|
emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort','getSelectionRows'], |
|
|
|
setup(props, { attrs, slots, emit, expose }) { |
|
|
|
const elTableRef = ref<ComponentRef<typeof ElTable>>() |
|
|
|
|
|
|
@ -101,9 +101,19 @@ export default defineComponent({ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const toggleRowSelection = (row: Recordable, selected: boolean) => { |
|
|
|
const tableRef = unref(elTableRef) |
|
|
|
tableRef?.toggleRowSelection(unref(getProps).data.find(item=>item.id === row.id), selected) |
|
|
|
} |
|
|
|
|
|
|
|
const selections = ref<Recordable[]>([]) |
|
|
|
const sortRef = ref() |
|
|
|
|
|
|
|
const selectRow = ()=>{ |
|
|
|
emit('getSelectionRows', currentPageRef.value,elTableRef.value?.getSelectionRows()) |
|
|
|
} |
|
|
|
const selectAll = (val)=>{ |
|
|
|
emit('getSelectionRows', currentPageRef.value,elTableRef.value?.getSelectionRows()) |
|
|
|
} |
|
|
|
const selectionChange = (selection: Recordable[]) => { |
|
|
|
selections.value = selection |
|
|
|
} |
|
|
@ -116,7 +126,8 @@ export default defineComponent({ |
|
|
|
expose({ |
|
|
|
setProps, |
|
|
|
setColumn, |
|
|
|
selections |
|
|
|
selections, |
|
|
|
toggleRowSelection |
|
|
|
}) |
|
|
|
|
|
|
|
const pagination = computed(() => { |
|
|
@ -306,6 +317,8 @@ export default defineComponent({ |
|
|
|
header-cell-class-name="tableHeader" |
|
|
|
row-class-name="tableRow" |
|
|
|
cell-class-name="tableRow" |
|
|
|
onSelect={selectRow} |
|
|
|
onSelect-all={selectAll} |
|
|
|
onSelection-change={selectionChange} |
|
|
|
onSort-change={sortChange} |
|
|
|
{...unref(getBindValue)} |
|
|
|