fix: 全选状态选中当前页

This commit is contained in:
xinxin.wu 2024-06-20 15:56:32 +08:00 committed by Craftsman
parent 14ae7659eb
commit 4d3f6878d3
1 changed files with 7 additions and 3 deletions

View File

@ -453,13 +453,17 @@ export default function useTableProps<T>(
// 表格SelectAll change // 表格SelectAll change
selectAllChange: (v: SelectAllEnum, onlyCurrent: boolean) => { selectAllChange: (v: SelectAllEnum, onlyCurrent: boolean) => {
const { data, rowKey } = propsRes.value; const { data, rowKey, selectorStatus } = propsRes.value;
if (v === SelectAllEnum.NONE) { if (v === SelectAllEnum.NONE) {
// 清空选中项 // 清空选中项
resetSelector(false); resetSelector(false);
} else if (v === SelectAllEnum.CURRENT) { } else if (v === SelectAllEnum.CURRENT) {
// 先清空选中项选,当再选中当前页面所有数据, // 如果是全选先清空选中项选和排除项,再选中当前页面所有数据,
if (selectorStatus === SelectAllEnum.ALL) {
propsRes.value.selectedKeys.clear(); propsRes.value.selectedKeys.clear();
propsRes.value.excludeKeys.clear();
}
collectIds(data as MsTableDataItem<T>[], rowKey); collectIds(data as MsTableDataItem<T>[], rowKey);
} else if (v === SelectAllEnum.ALL) { } else if (v === SelectAllEnum.ALL) {
// 全选所有页的时候先清空排除项,再选中所有数据 // 全选所有页的时候先清空排除项,再选中所有数据