From c048dcf02a2dcea219a5350197cdfd693b05aae7 Mon Sep 17 00:00:00 2001 From: AhJindeg Date: Mon, 1 Apr 2024 16:14:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(role):=20=F0=9F=90=9E=20add=20nextTick=20fo?= =?UTF-8?q?r=20open?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加 nextTick(),修复在权限范围为指定机构并且已选择数据时,编辑打开提示 setChecked undefined 问题 --- src/views/system/role/RoleDataPermissionForm.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/system/role/RoleDataPermissionForm.vue b/src/views/system/role/RoleDataPermissionForm.vue index 5d7801b7..0cdc7409 100644 --- a/src/views/system/role/RoleDataPermissionForm.vue +++ b/src/views/system/role/RoleDataPermissionForm.vue @@ -102,8 +102,10 @@ const open = async (row: RoleApi.RoleVO) => { formData.name = row.name formData.code = row.code formData.dataScope = row.dataScope - row.dataScopeDeptIds?.forEach((deptId: number) => { - treeRef.value.setChecked(deptId, true, false) + nextTick((): void => { + row.dataScopeDeptIds?.forEach((deptId: number) => { + treeRef.value.setChecked(deptId, true, false) + }) }) } defineExpose({ open }) // 提供 open 方法,用于打开弹窗