chore: updateCheckedNumber

This commit is contained in:
dap 2025-01-04 19:25:45 +08:00
parent a48a7a9444
commit 831a1abac7

View File

@ -95,12 +95,12 @@ const gridOptions: VxeGridProps = {
/**
* 用于界面显示选中的数量
*/
const checkedLength = ref(0);
const checkedNum = ref(0);
/**
* 更新选中的数量
*/
function updateCheckedLength() {
checkedLength.value = getCheckedKeys().length;
function updateCheckedNumber() {
checkedNum.value = getCheckedKeys().length;
}
const [BasicTable, tableApi] = useVbenVxeGrid({
@ -110,7 +110,7 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
checkboxChange: (params) => {
//
if (!association.value) {
updateCheckedLength();
updateCheckedNumber();
return;
}
//
@ -119,7 +119,7 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
const record = params.row;
//
rowAndChildrenChecked(record, checked);
updateCheckedLength();
updateCheckedNumber();
},
//
checkboxAll: (params) => {
@ -127,7 +127,7 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
records.forEach((item) => {
rowAndChildrenChecked(item, params.checked);
});
updateCheckedLength();
updateCheckedNumber();
},
},
});
@ -208,6 +208,7 @@ onMounted(() => {
// data checkedKeysmenuswatch
const records = tableApi.grid.getData();
setCheckedByKeys(records, allCheckedKeys, association.value);
updateCheckedNumber();
},
);
});
@ -223,7 +224,7 @@ async function handleAssociationChange() {
});
//
await tableApi.grid.clearCheckboxRow();
updateCheckedLength();
updateCheckedNumber();
//
await tableApi.grid.scrollTo(0, 0);
}
@ -256,7 +257,7 @@ function handlePermissionChange(row: any) {
}
}
//
updateCheckedLength();
updateCheckedNumber();
}
/**
@ -341,7 +342,7 @@ defineExpose({
<div v-if="tableApi?.grid">
已选中
<span class="text-primary mx-1 font-semibold">
{{ checkedLength }}
{{ checkedNum }}
</span>
个节点
</div>