Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
962e3752
G
gin-vue-admin
项目概览
FLIPPED-AURORA
/
gin-vue-admin
大约 1 年 前同步成功
通知
333
Star
18155
Fork
5506
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
962e3752
编写于
5月 02, 2020
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
角色权限自动切换保存 提示信息友好修改
上级
14d54715
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
11 deletion
+46
-11
web/src/view/superAdmin/authority/authority.vue
web/src/view/superAdmin/authority/authority.vue
+13
-4
web/src/view/superAdmin/authority/components/apis.vue
web/src/view/superAdmin/authority/components/apis.vue
+10
-1
web/src/view/superAdmin/authority/components/datas.vue
web/src/view/superAdmin/authority/components/datas.vue
+13
-5
web/src/view/superAdmin/authority/components/menus.vue
web/src/view/superAdmin/authority/components/menus.vue
+10
-1
未找到文件。
web/src/view/superAdmin/authority/authority.vue
浏览文件 @
962e3752
...
...
@@ -51,15 +51,15 @@
</el-dialog>
<el-drawer
:visible.sync=
"drawer"
:with-header=
"false"
size=
"40%"
title=
"角色配置"
v-if=
"drawer"
>
<el-tabs
class=
"role-box"
type=
"border-card"
>
<el-tabs
class=
"role-box"
type=
"border-card"
:before-leave=
"autoEnter"
>
<el-tab-pane
label=
"角色菜单"
>
<Menus
:row=
"activeRow"
/>
<Menus
:row=
"activeRow"
ref=
"menus"
/>
</el-tab-pane>
<el-tab-pane
label=
"角色api"
>
<apis
:row=
"activeRow"
/>
<apis
:row=
"activeRow"
ref=
"apis"
/>
</el-tab-pane>
<el-tab-pane
label=
"资源权限"
>
<Datas
:authority=
"tableData"
:row=
"activeRow"
/>
<Datas
:authority=
"tableData"
:row=
"activeRow"
ref=
"datas"
/>
</el-tab-pane>
</el-tabs>
</el-drawer>
...
...
@@ -124,6 +124,15 @@ export default {
Datas
},
methods
:
{
autoEnter
(
activeName
,
oldActiveName
){
const
paneArr
=
[
"
menus
"
,
"
apis
"
,
"
datas
"
]
if
(
oldActiveName
){
if
(
this
.
$refs
[
paneArr
[
oldActiveName
]].
needConfirm
){
this
.
$refs
[
paneArr
[
oldActiveName
]].
enterAndNext
()
this
.
$refs
[
paneArr
[
oldActiveName
]].
needConfirm
=
false
}
}
},
// 拷贝角色
copyAuthority
(
row
)
{
this
.
setOptions
()
...
...
web/src/view/superAdmin/authority/components/apis.vue
浏览文件 @
962e3752
...
...
@@ -7,6 +7,7 @@
:data=
"apiTreeData"
:default-checked-keys=
"apiTreeIds"
:props=
"apiDefaultProps"
@
check=
"nodeChange"
default-expand-all
highlight-current
node-key=
"onlyId"
...
...
@@ -32,6 +33,7 @@ export default {
return
{
apiTreeData
:
[],
apiTreeIds
:
[],
needConfirm
:
false
,
apiDefaultProps
:
{
children
:
'
children
'
,
label
:
'
description
'
...
...
@@ -39,6 +41,13 @@ export default {
}
},
methods
:
{
nodeChange
(){
this
.
needConfirm
=
true
},
// 暴露给外层使用的切换拦截统一方法
enterAndNext
(){
this
.
authApiEnter
()
},
// 创建api树方法
buildApiTree
(
apis
)
{
const
apiObj
=
new
Object
()
...
...
@@ -78,7 +87,7 @@ export default {
casbinInfos
})
if
(
res
.
code
==
0
)
{
this
.
$message
({
type
:
'
success
'
,
message
:
res
.
msg
})
this
.
$message
({
type
:
'
success
'
,
message
:
"
api设置成功
"
})
}
}
},
...
...
web/src/view/superAdmin/authority/components/datas.vue
浏览文件 @
962e3752
...
...
@@ -3,8 +3,8 @@
<div
class=
"clearflex"
style=
"margin:18px"
>
<el-button
@
click=
"authDataEnter"
class=
"fl-right"
size=
"small"
type=
"primary"
>
确 定
</el-button>
<el-button
@
click=
"all"
class=
"fl-left"
size=
"small"
type=
"primary"
>
全选
</el-button>
<el-button
@
click=
"self"
class=
"fl-left"
size=
"small"
type=
"primary"
>
本
部门
</el-button>
<el-button
@
click=
"selfAndChildren"
class=
"fl-left"
size=
"small"
type=
"primary"
>
部门及以下
</el-button>
<el-button
@
click=
"self"
class=
"fl-left"
size=
"small"
type=
"primary"
>
本
角色
</el-button>
<el-button
@
click=
"selfAndChildren"
class=
"fl-left"
size=
"small"
type=
"primary"
>
本角色及子角色
</el-button>
</div>
<el-checkbox-group
v-model=
"dataAuthorityId"
@
change=
"selectAuthority"
>
<el-checkbox
v-for=
"(item,key) in authoritys"
:label=
"item"
:key=
"key"
>
{{
item
.
authorityName
}}
</el-checkbox>
...
...
@@ -18,7 +18,8 @@ export default {
data
()
{
return
{
authoritys
:[],
dataAuthorityId
:[]
dataAuthorityId
:[],
needConfirm
:
false
}
},
props
:
{
...
...
@@ -36,20 +37,26 @@ export default {
}
},
methods
:{
// 暴露给外层使用的切换拦截统一方法
enterAndNext
(){
this
.
authDataEnter
()
},
all
(){
this
.
dataAuthorityId
=
[...
this
.
authoritys
]
this
.
row
.
dataAuthorityId
=
this
.
dataAuthorityId
this
.
needConfirm
=
true
},
self
(){
this
.
dataAuthorityId
=
this
.
authoritys
.
filter
(
item
=>
item
.
authorityId
===
this
.
row
.
authorityId
)
this
.
row
.
dataAuthorityId
=
this
.
dataAuthorityId
this
.
needConfirm
=
true
},
selfAndChildren
(){
const
arrBox
=
[]
this
.
getChildrenId
(
this
.
row
,
arrBox
)
this
.
dataAuthorityId
=
this
.
authoritys
.
filter
(
item
=>
arrBox
.
indexOf
(
item
.
authorityId
)
>-
1
)
this
.
row
.
dataAuthorityId
=
this
.
dataAuthorityId
this
.
needConfirm
=
true
},
getChildrenId
(
row
,
arrBox
){
arrBox
.
push
(
row
.
authorityId
)
...
...
@@ -61,7 +68,7 @@ export default {
async
authDataEnter
(){
const
res
=
await
setDataAuthority
(
this
.
row
)
if
(
res
.
code
==
0
){
this
.
$message
({
type
:
'
success
'
,
message
:
res
.
msg
})
this
.
$message
({
type
:
'
success
'
,
message
:
"
资源设置成功
"
})
}
},
// 平铺角色
...
...
@@ -79,6 +86,7 @@ export default {
// 选择
selectAuthority
(){
this
.
row
.
dataAuthorityId
=
this
.
dataAuthorityId
this
.
needConfirm
=
true
}
},
created
()
{
...
...
web/src/view/superAdmin/authority/components/menus.vue
浏览文件 @
962e3752
...
...
@@ -7,6 +7,7 @@
:data=
"menuTreeData"
:default-checked-keys=
"menuTreeIds"
:props=
"menuDefaultProps"
@
check=
"nodeChange"
default-expand-all
highlight-current
node-key=
"ID"
...
...
@@ -32,6 +33,7 @@ export default {
return
{
menuTreeData
:
[],
menuTreeIds
:
[],
needConfirm
:
false
,
menuDefaultProps
:
{
children
:
'
children
'
,
label
:
function
(
data
){
...
...
@@ -41,6 +43,13 @@ export default {
}
},
methods
:
{
nodeChange
(){
this
.
needConfirm
=
true
},
// 暴露给外层使用的切换拦截统一方法
enterAndNext
(){
this
.
relation
()
},
// 关联树 确认方法
async
relation
()
{
const
checkArr
=
this
.
$refs
.
menuTree
.
getCheckedNodes
(
false
,
true
)
...
...
@@ -51,7 +60,7 @@ export default {
if
(
res
.
code
==
0
)
{
this
.
$message
({
type
:
'
success
'
,
message
:
'
添加
成功!
'
message
:
'
菜单设置
成功!
'
})
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录