From c048dcf02a2dcea219a5350197cdfd693b05aae7 Mon Sep 17 00:00:00 2001 From: AhJindeg Date: Mon, 1 Apr 2024 16:14:30 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(role):=20=F0=9F=90=9E=20add=20nextTick?= =?UTF-8?q?=20for=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 方法,用于打开弹窗 From 7b84ddd35802d2446e18eb407968f48f3af738fe Mon Sep 17 00:00:00 2001 From: AhJindeg Date: Thu, 4 Apr 2024 18:54:51 +0800 Subject: [PATCH 2/3] =?UTF-8?q?perf:=20=F0=9F=8E=88=20add=20await=20for=20?= =?UTF-8?q?nextTick()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/role/RoleDataPermissionForm.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/system/role/RoleDataPermissionForm.vue b/src/views/system/role/RoleDataPermissionForm.vue index 0cdc7409..3b8c3ee6 100644 --- a/src/views/system/role/RoleDataPermissionForm.vue +++ b/src/views/system/role/RoleDataPermissionForm.vue @@ -102,8 +102,8 @@ const open = async (row: RoleApi.RoleVO) => { formData.name = row.name formData.code = row.code formData.dataScope = row.dataScope - nextTick((): void => { - row.dataScopeDeptIds?.forEach((deptId: number) => { + await nextTick((): void => { + row.dataScopeDeptIds?.forEach((deptId: number): void => { treeRef.value.setChecked(deptId, true, false) }) }) From db4795744e2ed0337f0b22a88988253631145011 Mon Sep 17 00:00:00 2001 From: AhJindeg Date: Fri, 5 Apr 2024 13:51:27 +0800 Subject: [PATCH 3/3] =?UTF-8?q?style:=20=F0=9F=8C=88=20add=20more=20readab?= =?UTF-8?q?le=20for=20open?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/role/RoleDataPermissionForm.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/views/system/role/RoleDataPermissionForm.vue b/src/views/system/role/RoleDataPermissionForm.vue index 3b8c3ee6..32745e95 100644 --- a/src/views/system/role/RoleDataPermissionForm.vue +++ b/src/views/system/role/RoleDataPermissionForm.vue @@ -102,10 +102,9 @@ const open = async (row: RoleApi.RoleVO) => { formData.name = row.name formData.code = row.code formData.dataScope = row.dataScope - await nextTick((): void => { - row.dataScopeDeptIds?.forEach((deptId: number): void => { - treeRef.value.setChecked(deptId, true, false) - }) + await nextTick() + row.dataScopeDeptIds?.forEach((deptId: number): void => { + treeRef.value.setChecked(deptId, true, false) }) } defineExpose({ open }) // 提供 open 方法,用于打开弹窗