From 3e2b5e1887a123dbf597503dd866e0a8654f51fa Mon Sep 17 00:00:00 2001 From: chengyangwang <1223440313@qq.com> Date: Wed, 1 Mar 2023 17:09:03 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Del-tree=E7=BB=84?= =?UTF-8?q?=E4=BB=B6setCheckedKeys=E8=AE=BE=E7=BD=AE=E4=B8=80=E6=97=A6?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=88=B6=E7=BA=A7=E5=AD=90=E7=BA=A7=E4=B9=9F?= =?UTF-8?q?=E8=A2=AB=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/tenantPackage/index.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/views/system/tenantPackage/index.vue b/src/views/system/tenantPackage/index.vue index a665b8af..f8b81171 100644 --- a/src/views/system/tenantPackage/index.vue +++ b/src/views/system/tenantPackage/index.vue @@ -125,7 +125,9 @@ const handleUpdate = async (rowId: number) => { const res = await TenantPackageApi.getTenantPackageApi(rowId) unref(formRef)?.setValues(res) // 设置选中 - unref(treeRef)?.setCheckedKeys(res.menuIds) + res.menuIds?.forEach((item: any) => { + unref(treeRef)?.setChecked(item, true,false); + }) } // 提交按钮 From d461fed75c51c60d0bf3ea08c82f08cf44ee31f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=BF=AA=E7=94=9F?= <2046353594@qq.com> Date: Thu, 2 Mar 2023 15:15:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20=E8=A7=84=E8=8C=83=E4=B8=8D?= =?UTF-8?q?=E7=AC=A6=E5=90=88eslint=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/global.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/global.d.ts b/types/global.d.ts index 3179c200..6f583ba7 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -1,4 +1,3 @@ -import type { CSSProperties } from 'vue' declare global { declare interface Fn { (...arg: T[]): T From 0b9022c8a5b26d368c44b0fe920fd51aa4f57dee Mon Sep 17 00:00:00 2001 From: chengyangwang <1223440313@qq.com> Date: Fri, 3 Mar 2023 12:52:50 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Del-tree=E7=BB=84?= =?UTF-8?q?=E4=BB=B6setCheckedKeys=E8=AE=BE=E7=BD=AE=E4=B8=80=E6=97=A6?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=88=B6=E7=BA=A7=E5=AD=90=E7=BA=A7=E4=B9=9F?= =?UTF-8?q?=E8=A2=AB=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/role/index.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 72c602c1..b2f12af3 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -122,7 +122,6 @@ ref="treeRef" node-key="id" show-checkbox - :default-checked-keys="defaultCheckedKeys" :check-strictly="!checkStrictly" :props="defaultProps" :data="treeOptions" @@ -245,7 +244,6 @@ const dialogScopeVisible = ref(false) const dialogScopeTitle = ref('数据权限') const actionScopeType = ref('') const dataScopeDictDatas = ref() -const defaultCheckedKeys = ref() // 选项 const checkStrictly = ref(true) const treeNodeAll = ref(false) @@ -258,13 +256,17 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => { dataScopeForm.id = row.id dataScopeForm.name = row.name dataScopeForm.code = row.code + + actionScopeType.value = type + dialogScopeVisible.value = true if (type === 'menu') { const menuRes = await listSimpleMenusApi() treeOptions.value = handleTree(menuRes) const role = await PermissionApi.listRoleMenusApi(row.id) if (role) { - // treeRef.value!.setCheckedKeys(role as unknown as Array) - defaultCheckedKeys.value = role + role?.forEach((item: any) => { + unref(treeRef)?.setChecked(item, true,false); + }) } } else if (type === 'data') { const deptRes = await listSimpleDeptApi() @@ -272,12 +274,12 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => { const role = await RoleApi.getRoleApi(row.id) dataScopeForm.dataScope = role.dataScope if (role.dataScopeDeptIds) { - // treeRef.value!.setCheckedKeys(role.dataScopeDeptIds as unknown as Array, false) - defaultCheckedKeys.value = role.dataScopeDeptIds + role.dataScopeDeptIds?.forEach((item: any) => { + unref(treeRef)?.setChecked(item, true,false); + }) } } - actionScopeType.value = type - dialogScopeVisible.value = true + } // 保存权限 const submitScope = async () => {