fix: 全选时过滤disabled的节点

This commit is contained in:
zouawen 2025-09-11 18:16:05 +08:00
parent 39820c783c
commit dfa2ac3435
2 changed files with 12 additions and 11 deletions

View File

@ -159,20 +159,22 @@ function collapseAll() {
}
function checkAll() {
if (props.multiple) {
modelValue.value = flattenData.value.map((item) =>
get(item.value, props.valueField),
);
if (!props.multiple) return;
modelValue.value = [
...new Set(
flattenData.value
.filter((item) => !get(item.value, props.disabledField))
.map((item) => get(item.value, props.valueField)),
),
];
updateTreeValue();
}
}
function unCheckAll() {
if (props.multiple) {
if (!props.multiple) return;
modelValue.value = [];
updateTreeValue();
}
}
function isNodeDisabled(item: FlattenedItem<Recordable<any>>) {
return props.disabled || get(item.value, props.disabledField);

View File

@ -51,7 +51,6 @@ export function treePropsDefaults() {
defaultExpandedLevel: 0,
disabled: false,
disabledField: 'disabled',
expanded: () => [],
iconField: 'icon',
labelField: 'label',
multiple: false,