fix test errors

This commit is contained in:
2026-04-15 11:05:50 +08:00
parent 4809ad03e4
commit 51f0315d68
9 changed files with 402 additions and 45 deletions
+12 -7
View File
@@ -186,13 +186,18 @@ function handleModeChange(val: unknown) {
}
// 树事件
function onCheck(checked: (string | number)[], info: { halfCheckedKeys: (string | number)[] }) {
checkedKeys.value = checked.map(String)
halfCheckedKeys.value = info.halfCheckedKeys.map(String)
function onCheck(
checked: (string | number)[] | { checked: (string | number)[]; halfChecked: (string | number)[] },
info: { halfCheckedKeys?: (string | number)[] },
) {
const keys = Array.isArray(checked) ? checked : checked.checked
checkedKeys.value = keys.map(String)
const half = Array.isArray(checked) ? (info.halfCheckedKeys ?? []) : checked.halfChecked
halfCheckedKeys.value = half.map(String)
}
function onExpand(keys: string[]) {
expandedKeys.value = keys
function onExpand(keys: (string | number)[]) {
expandedKeys.value = keys.map(String)
autoExpandParent.value = false
}
@@ -233,8 +238,8 @@ function scopesToCheckedKeys(userScopes: ScopeRecord[]): string[] {
}
// checkedKeys → scopes(智能判断全选/部分选)
function checkedKeysToScopes(): { scope_type: string; scope_id: number }[] {
const scopes: { scope_type: string; scope_id: number }[] = []
function checkedKeysToScopes(): Omit<ScopeRecord, 'name'>[] {
const scopes: Omit<ScopeRecord, 'name'>[] = []
const keySet = new Set(checkedKeys.value)
for (const key of checkedKeys.value) {