From 3c6554c05834c7ba12e7cc9303cc9f93ce9d02fd Mon Sep 17 00:00:00 2001
From: gexinzhineng/gxzn27 <1348660141@qq.com>
Date: Sat, 4 Mar 2023 13:44:46 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A7=9F=E6=88=B7=E5=92=8C=E8=A7=92=E8=89=B2?=
=?UTF-8?q?=E7=AE=A1=E7=90=86=E7=9A=84=E8=8F=9C=E5=8D=95=E6=9D=83=E9=99=90?=
=?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=BB=9A=E5=8A=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/system/role/index.vue | 98 +++++++++++++-----------
src/views/system/tenantPackage/index.vue | 23 +++++-
2 files changed, 76 insertions(+), 45 deletions(-)
diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue
index 72c602c1..97993f5f 100644
--- a/src/views/system/role/index.vue
+++ b/src/views/system/role/index.vue
@@ -99,37 +99,41 @@
-
-
-
- 父子联动(选中父节点,自动选择子节点):
-
- 全选/全不选:
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -245,26 +249,28 @@ const dialogScopeVisible = ref(false)
const dialogScopeTitle = ref('数据权限')
const actionScopeType = ref('')
const dataScopeDictDatas = ref()
-const defaultCheckedKeys = ref()
// 选项
-const checkStrictly = ref(true)
-const treeNodeAll = ref(false)
+const checkStrictly = ref(false)
+// const treeNodeAll = ref(false)
// 全选/全不选
-const handleCheckedTreeNodeAll = () => {
- treeRef.value!.setCheckedNodes(treeNodeAll.value ? treeOptions.value : [])
-}
+// const handleCheckedTreeNodeAll = () => {
+// treeRef.value!.setCheckedNodes(treeNodeAll.value ? treeOptions.value : [])
+// }
// 权限操作
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 +278,11 @@ 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 () => {
@@ -312,3 +317,10 @@ onMounted(() => {
init()
})
+
diff --git a/src/views/system/tenantPackage/index.vue b/src/views/system/tenantPackage/index.vue
index a665b8af..9222365b 100644
--- a/src/views/system/tenantPackage/index.vue
+++ b/src/views/system/tenantPackage/index.vue
@@ -25,7 +25,7 @@
ref="formRef"
>
-
+