mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-06-06 09:58:20 +08:00
fix(frontend): 修复角色菜单回显时父节点级联勾选所有子节点
This commit is contained in:
@@ -13,7 +13,7 @@ import type { MenuOption } from '#/api/system/menu/model';
|
|||||||
|
|
||||||
import { nextTick, onMounted, ref, shallowRef, watch } from 'vue';
|
import { nextTick, onMounted, ref, shallowRef, watch } from 'vue';
|
||||||
|
|
||||||
import { cloneDeep, findGroupParentIds } from '@vben/utils';
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import { Alert, Checkbox, RadioGroup, Space } from 'ant-design-vue';
|
import { Alert, Checkbox, RadioGroup, Space } from 'ant-design-vue';
|
||||||
import { uniq } from 'lodash-es';
|
import { uniq } from 'lodash-es';
|
||||||
@@ -320,15 +320,7 @@ function getCheckedKeys() {
|
|||||||
const records = tableApi?.grid?.getCheckboxRecords?.(true) ?? [];
|
const records = tableApi?.grid?.getCheckboxRecords?.(true) ?? [];
|
||||||
// 子节点
|
// 子节点
|
||||||
const nodeKeys = getKeys(records, true);
|
const nodeKeys = getKeys(records, true);
|
||||||
// 所有父节点
|
return uniq(nodeKeys);
|
||||||
// Note: findGroupParentIds is typed for number[] but works with strings at runtime
|
|
||||||
const parentIds = findGroupParentIds(
|
|
||||||
props.menus,
|
|
||||||
nodeKeys as any,
|
|
||||||
) as (string | number)[];
|
|
||||||
// 拼接 去重
|
|
||||||
const realKeys = uniq([...parentIds, ...nodeKeys]);
|
|
||||||
return realKeys;
|
|
||||||
}
|
}
|
||||||
// 节点独立
|
// 节点独立
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user