From 0230a4af01a2eaed9c43a54e54ffad97d4a549f4 Mon Sep 17 00:00:00 2001 From: moon69 <1016830869@qq.com> Date: Sat, 9 Mar 2024 17:38:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=97=A0=E6=B3=95=E5=9B=9E=E6=98=BE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/role/RoleDataPermissionForm.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/views/system/role/RoleDataPermissionForm.vue b/src/views/system/role/RoleDataPermissionForm.vue index 5d7801b7..e9e55ff8 100644 --- a/src/views/system/role/RoleDataPermissionForm.vue +++ b/src/views/system/role/RoleDataPermissionForm.vue @@ -102,8 +102,12 @@ 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) + + // 需要在 DOM 渲染完成后,再设置选中状态 + nextTick(() => { + row.dataScopeDeptIds?.forEach((deptId: number) => { + treeRef.value.setChecked(deptId, true, false) + }) }) } defineExpose({ open }) // 提供 open 方法,用于打开弹窗