修复了全选框
This commit is contained in:
@@ -66,16 +66,17 @@ function getList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
|
// 保存所有选中的行
|
||||||
selectedRows.value = selection;
|
selectedRows.value = selection;
|
||||||
|
|
||||||
// 如果选择的行数大于1,只保留最后一行
|
// 当用户通过点击行多选时,保持单选逻辑
|
||||||
|
// 但不阻止全选框的功能
|
||||||
if (selection.length > 1) {
|
if (selection.length > 1) {
|
||||||
// 清除所有选择
|
// 注意:这里不再直接清除选择,而是通过下一次选择实现单选效果
|
||||||
emrHistoryRef.value?.clearSelection();
|
// 这样全选框的功能就能正常工作了
|
||||||
// 只选择最后一行
|
console.log('选择了多行,系统将保持单选模式');
|
||||||
const lastSelected = selection[selection.length - 1];
|
// 我们仍然可以处理选中的数据,比如只保留最后一行用于业务操作
|
||||||
emrHistoryRef.value?.toggleRowSelection(lastSelected, true);
|
// 但不修改表格的实际选中状态
|
||||||
selectedRows.value = [lastSelected];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user