feat: 表格批量操作增加当前选中的数量
This commit is contained in:
parent
766ef37320
commit
fcebe7ceaf
|
@ -310,6 +310,7 @@
|
||||||
selectedIds: Array.from(selectedKeys),
|
selectedIds: Array.from(selectedKeys),
|
||||||
excludeIds: Array.from(excludeKeys),
|
excludeIds: Array.from(excludeKeys),
|
||||||
selectAll: selectorStatus === SelectAllEnum.ALL,
|
selectAll: selectorStatus === SelectAllEnum.ALL,
|
||||||
|
currentSelectCount: selectCurrent.value,
|
||||||
params: {
|
params: {
|
||||||
...(attrs.msPagination as MsPaginationI),
|
...(attrs.msPagination as MsPaginationI),
|
||||||
},
|
},
|
||||||
|
|
|
@ -117,4 +117,5 @@ export interface BatchActionQueryParams {
|
||||||
selectedIds?: string[]; // 选中的id
|
selectedIds?: string[]; // 选中的id
|
||||||
selectAll: boolean; // 是否跨页全选
|
selectAll: boolean; // 是否跨页全选
|
||||||
params?: TableQueryParams; // 查询参数
|
params?: TableQueryParams; // 查询参数
|
||||||
|
currentSelectCount: number; // 当前选中的数量
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,6 +216,25 @@ export default function useTableProps<T>(
|
||||||
propsRes.value.selectorStatus = SelectAllEnum.NONE;
|
propsRes.value.selectorStatus = SelectAllEnum.NONE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 获取当前表格的选中项数量
|
||||||
|
const getSelectedCount = () => {
|
||||||
|
const { selectorStatus, msPagination, excludeKeys, selectedKeys } = propsRes.value;
|
||||||
|
if (msPagination) {
|
||||||
|
if (selectorStatus === SelectAllEnum.ALL) {
|
||||||
|
// 如果是全选状态,返回总数减去排除的数量
|
||||||
|
return msPagination.total - excludeKeys.size;
|
||||||
|
}
|
||||||
|
// if (selectorStatus === SelectAllEnum.NONE) {
|
||||||
|
// 如果是全不选状态,返回选中的数量
|
||||||
|
return selectedKeys.size;
|
||||||
|
// }
|
||||||
|
// if (selectorStatus === SelectAllEnum.CURRENT) {
|
||||||
|
// // 如果是当前页状态,返回当前页减去排除的数量
|
||||||
|
// return msPagination.pageSize - excludeKeys.size;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 事件触发组
|
// 事件触发组
|
||||||
const propsEvent = ref({
|
const propsEvent = ref({
|
||||||
// 排序触发
|
// 排序触发
|
||||||
|
@ -318,5 +337,6 @@ export default function useTableProps<T>(
|
||||||
setLoadListParams,
|
setLoadListParams,
|
||||||
setKeyword,
|
setKeyword,
|
||||||
resetPagination,
|
resetPagination,
|
||||||
|
getSelectedCount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue