Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0b9022c8
authored
Mar 03, 2023
by
chengyangwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复el-tree组件setCheckedKeys设置一旦选中父级子级也被选中
parent
3e2b5e18
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
src/views/system/role/index.vue
+10
-8
No files found.
src/views/system/role/index.vue
View file @
0b9022c8
...
@@ -122,7 +122,6 @@
...
@@ -122,7 +122,6 @@
ref=
"treeRef"
ref=
"treeRef"
node-key=
"id"
node-key=
"id"
show-checkbox
show-checkbox
:default-checked-keys=
"defaultCheckedKeys"
:check-strictly=
"!checkStrictly"
:check-strictly=
"!checkStrictly"
:props=
"defaultProps"
:props=
"defaultProps"
:data=
"treeOptions"
:data=
"treeOptions"
...
@@ -245,7 +244,6 @@ const dialogScopeVisible = ref(false)
...
@@ -245,7 +244,6 @@ const dialogScopeVisible = ref(false)
const
dialogScopeTitle
=
ref
(
'数据权限'
)
const
dialogScopeTitle
=
ref
(
'数据权限'
)
const
actionScopeType
=
ref
(
''
)
const
actionScopeType
=
ref
(
''
)
const
dataScopeDictDatas
=
ref
()
const
dataScopeDictDatas
=
ref
()
const
defaultCheckedKeys
=
ref
()
// 选项
// 选项
const
checkStrictly
=
ref
(
true
)
const
checkStrictly
=
ref
(
true
)
const
treeNodeAll
=
ref
(
false
)
const
treeNodeAll
=
ref
(
false
)
...
@@ -258,13 +256,17 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
...
@@ -258,13 +256,17 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
dataScopeForm
.
id
=
row
.
id
dataScopeForm
.
id
=
row
.
id
dataScopeForm
.
name
=
row
.
name
dataScopeForm
.
name
=
row
.
name
dataScopeForm
.
code
=
row
.
code
dataScopeForm
.
code
=
row
.
code
actionScopeType
.
value
=
type
dialogScopeVisible
.
value
=
true
if
(
type
===
'menu'
)
{
if
(
type
===
'menu'
)
{
const
menuRes
=
await
listSimpleMenusApi
()
const
menuRes
=
await
listSimpleMenusApi
()
treeOptions
.
value
=
handleTree
(
menuRes
)
treeOptions
.
value
=
handleTree
(
menuRes
)
const
role
=
await
PermissionApi
.
listRoleMenusApi
(
row
.
id
)
const
role
=
await
PermissionApi
.
listRoleMenusApi
(
row
.
id
)
if
(
role
)
{
if
(
role
)
{
// treeRef.value!.setCheckedKeys(role as unknown as Array
<
number
>
)
role
?.
forEach
((
item
:
any
)
=>
{
defaultCheckedKeys
.
value
=
role
unref
(
treeRef
)?.
setChecked
(
item
,
true
,
false
);
})
}
}
}
else
if
(
type
===
'data'
)
{
}
else
if
(
type
===
'data'
)
{
const
deptRes
=
await
listSimpleDeptApi
()
const
deptRes
=
await
listSimpleDeptApi
()
...
@@ -272,12 +274,12 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
...
@@ -272,12 +274,12 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
const
role
=
await
RoleApi
.
getRoleApi
(
row
.
id
)
const
role
=
await
RoleApi
.
getRoleApi
(
row
.
id
)
dataScopeForm
.
dataScope
=
role
.
dataScope
dataScopeForm
.
dataScope
=
role
.
dataScope
if
(
role
.
dataScopeDeptIds
)
{
if
(
role
.
dataScopeDeptIds
)
{
// treeRef.value!.setCheckedKeys(role.dataScopeDeptIds as unknown as Array
<
number
>
,
false
)
role
.
dataScopeDeptIds
?.
forEach
((
item
:
any
)
=>
{
defaultCheckedKeys
.
value
=
role
.
dataScopeDeptIds
unref
(
treeRef
)?.
setChecked
(
item
,
true
,
false
);
})
}
}
}
}
actionScopeType
.
value
=
type
dialogScopeVisible
.
value
=
true
}
}
// 保存权限
// 保存权限
const
submitScope
=
async
()
=>
{
const
submitScope
=
async
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment