Skip to content

Commit

Permalink
fix(role authorization): judge menu checked key type to avoid undefin…
Browse files Browse the repository at this point in the history
…ed error
  • Loading branch information
suyuan32 committed Jun 8, 2024
1 parent d0d5c74 commit 4059d4a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/views/sys/role/RoleDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import { ApiListResp } from '@/api/sys/model/apiModel';
import { buildDataNode } from '@/utils/tree';
import { BasicTree, TreeActionType } from '@/components/Tree';
import { isArray } from 'remeda';
export default defineComponent({
name: 'RoleDrawer',
Expand Down Expand Up @@ -213,7 +214,9 @@
const roleData = await getFieldsValue();
const result = await createOrUpdateMenuAuthority({
roleId: Number(roleData['id']),
menuIds: getMenuTree().getCheckedKeys()['checked'] as number[],
menuIds: isArray(getMenuTree().getCheckedKeys())
? (getMenuTree().getCheckedKeys() as number[])
: (getMenuTree().getCheckedKeys()['checked'] as number[]),
});
if (result.code === 0) {
childrenDrawer.value = false;
Expand Down

0 comments on commit 4059d4a

Please sign in to comment.