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 方法,用于打开弹窗