Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Elij4h
jeecg-boot
提交
107e9018
J
jeecg-boot
项目概览
Elij4h
/
jeecg-boot
与 Fork 源项目一致
Fork自
jeecg / jeecg-boot
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jeecg-boot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
107e9018
编写于
10月 20, 2019
作者:
JEECG低代码平台
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
JeecgBoot 2.1.1 代码生成器AI版本发布
上级
c69884c8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
36 deletion
+20
-36
ant-design-vue-jeecg/src/views/system/modules/UserRoleModal.vue
...sign-vue-jeecg/src/views/system/modules/UserRoleModal.vue
+20
-36
未找到文件。
ant-design-vue-jeecg/src/views/system/modules/UserRoleModal.vue
浏览文件 @
107e9018
...
...
@@ -31,10 +31,8 @@
<div
class=
"drawer-bootom-button"
>
<a-dropdown
style=
"float: left"
:trigger=
"['click']"
placement=
"topCenter"
>
<a-menu
slot=
"overlay"
>
<!-- 简化Tree逻辑,使用默认checkStrictly为false的行为,即默认父子关联
<a-menu-item
key=
"1"
@
click=
"switchCheckStrictly(1)"
>
父子关联
</a-menu-item>
<a-menu-item
key=
"2"
@
click=
"switchCheckStrictly(2)"
>
取消关联
</a-menu-item>
-->
<a-menu-item
key=
"3"
@
click=
"checkALL"
>
全部勾选
</a-menu-item>
<a-menu-item
key=
"4"
@
click=
"cancelCheckALL"
>
取消全选
</a-menu-item>
<a-menu-item
key=
"5"
@
click=
"expandAll"
>
展开所有
</a-menu-item>
...
...
@@ -70,11 +68,10 @@
treeData
:
[],
defaultCheckedKeys
:[],
checkedKeys
:[],
halfCheckedKeys
:[],
expandedKeysss
:[],
allTreeKeys
:[],
autoExpandParent
:
true
,
checkStrictly
:
fals
e
,
checkStrictly
:
tru
e
,
title
:
"
角色权限配置
"
,
visible
:
false
,
loading
:
false
,
...
...
@@ -88,10 +85,12 @@
}
this
.
$refs
.
datarule
.
show
(
this
.
selectedKeys
[
0
],
this
.
roleId
)
},
onCheck
(
checkedKeys
,
{
halfCheckedKeys
})
{
// 保存选中的和半选中的,后面保存的时候合并提交
this
.
checkedKeys
=
checkedKeys
this
.
halfCheckedKeys
=
halfCheckedKeys
onCheck
(
o
)
{
if
(
this
.
checkStrictly
){
this
.
checkedKeys
=
o
.
checked
;
}
else
{
this
.
checkedKeys
=
o
}
},
show
(
roleId
){
this
.
roleId
=
roleId
...
...
@@ -122,18 +121,24 @@
this
.
checkedKeys
=
this
.
allTreeKeys
},
cancelCheckALL
()
{
//this.checkedKeys = this.defaultCheckedKeys
this
.
checkedKeys
=
[]
},
switchCheckStrictly
(
v
)
{
if
(
v
==
1
){
this
.
checkStrictly
=
false
}
else
if
(
v
==
2
){
this
.
checkStrictly
=
true
}
},
handleCancel
()
{
this
.
close
()
},
handleSubmit
(){
let
that
=
this
;
let
checkedKeys
=
[...
that
.
checkedKeys
,
...
that
.
halfCheckedKeys
]
const
permissionIds
=
checkedKeys
.
join
(
"
,
"
)
let
params
=
{
roleId
:
that
.
roleId
,
permissionIds
,
permissionIds
:
that
.
checkedKeys
.
join
(
"
,
"
)
,
lastpermissionIds
:
that
.
defaultCheckedKeys
.
join
(
"
,
"
),
};
that
.
loading
=
true
;
...
...
@@ -150,15 +155,6 @@
}
})
},
convertTreeListToKeyLeafPairs
(
treeList
,
keyLeafPair
=
[])
{
for
(
const
{
key
,
isLeaf
,
children
}
of
treeList
)
{
keyLeafPair
.
push
({
key
,
isLeaf
})
if
(
children
&&
children
.
length
>
0
)
{
this
.
convertTreeListToKeyLeafPairs
(
children
,
keyLeafPair
)
}
}
return
keyLeafPair
;
},
},
watch
:
{
visible
()
{
...
...
@@ -166,23 +162,11 @@
queryTreeListForRole
().
then
((
res
)
=>
{
this
.
treeData
=
res
.
result
.
treeList
this
.
allTreeKeys
=
res
.
result
.
ids
const
keyLeafPairs
=
this
.
convertTreeListToKeyLeafPairs
(
this
.
treeData
)
queryRolePermission
({
roleId
:
this
.
roleId
}).
then
((
res
)
=>
{
// 过滤出 leaf node 即可,即选中的
// Tree组件中checkStrictly默认为false的时候,选中子节点,父节点会自动设置选中或半选中
// 保存 checkedKeys 以及 halfCheckedKeys 以便于未做任何操作时提交表单数据
const
checkedKeys
=
[...
res
.
result
].
filter
(
key
=>
{
const
keyLeafPair
=
keyLeafPairs
.
filter
(
item
=>
item
.
key
===
key
)[
0
]
return
keyLeafPair
&&
keyLeafPair
.
isLeaf
})
const
halfCheckedKeys
=
[...
res
.
result
].
filter
(
key
=>
{
const
keyLeafPair
=
keyLeafPairs
.
filter
(
item
=>
item
.
key
===
key
)[
0
]
return
keyLeafPair
&&
!
keyLeafPair
.
isLeaf
})
this
.
checkedKeys
=
[...
checkedKeys
];
this
.
halfCheckedKeys
=
[...
halfCheckedKeys
]
this
.
defaultCheckedKeys
=
[...
halfCheckedKeys
,
...
checkedKeys
];
this
.
expandedKeysss
=
this
.
allTreeKeys
;
this
.
checkedKeys
=
[...
res
.
result
];
this
.
defaultCheckedKeys
=
[...
res
.
result
];
this
.
expandedKeysss
=
this
.
allTreeKeys
;
//console.log(this.defaultCheckedKeys)
})
})
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录