Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
7b0a012a
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,发现更多精彩内容 >>
提交
7b0a012a
编写于
6月 08, 2020
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
角色管理新增角色bug修复
上级
bebed533
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
123 addition
and
94 deletion
+123
-94
web/src/view/superAdmin/authority/authority.vue
web/src/view/superAdmin/authority/authority.vue
+123
-94
未找到文件。
web/src/view/superAdmin/authority/authority.vue
浏览文件 @
7b0a012a
...
...
@@ -16,29 +16,48 @@
<el-table-column
fixed=
"right"
label=
"操作"
width=
"460"
>
<template
slot-scope=
"scope"
>
<el-button
@
click=
"opdendrawer(scope.row)"
size=
"small"
type=
"primary"
>
设置权限
</el-button>
<el-button
@
click=
"addAuthority(scope.row.authorityId)"
size=
"small"
type=
"primary"
icon=
"el-icon-plus"
>
新增子角色
</el-button>
<el-button
@
click=
"copyAuthority(scope.row)"
size=
"small"
type=
"primary"
icon=
"el-icon-copy-document"
>
拷贝
</el-button>
<el-button
@
click=
"editAuthority(scope.row)"
size=
"small"
type=
"primary"
icon=
"el-icon-edit"
>
编辑
</el-button>
<el-button
@
click=
"deleteAuth(scope.row)"
size=
"small"
type=
"danger"
icon=
"el-icon-delete"
>
删除
</el-button>
<el-button
@
click=
"addAuthority(scope.row.authorityId)"
icon=
"el-icon-plus"
size=
"small"
type=
"primary"
>
新增子角色
</el-button>
<el-button
@
click=
"copyAuthority(scope.row)"
icon=
"el-icon-copy-document"
size=
"small"
type=
"primary"
>
拷贝
</el-button>
<el-button
@
click=
"editAuthority(scope.row)"
icon=
"el-icon-edit"
size=
"small"
type=
"primary"
>
编辑
</el-button>
<el-button
@
click=
"deleteAuth(scope.row)"
icon=
"el-icon-delete"
size=
"small"
type=
"danger"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<!-- 新增角色弹窗 -->
<el-dialog
:
visible.sync=
"dialogFormVisible"
:title=
"dialogTit
le"
>
<el-dialog
:
title=
"dialogTitle"
:visible.sync=
"dialogFormVisib
le"
>
<el-form
:model=
"form"
:rules=
"rules"
ref=
"authorityForm"
>
<el-form-item
label=
"父级角色"
prop=
"parentId"
>
<el-cascader
:disabled=
"dialogType=='add'"
v-model=
"form.parentId
"
:options=
"AuthorityOption
"
:show-all-levels=
"false"
:props=
"{ checkStrictly: true,label:'authorityName',value:'authorityId',disabled:'disabled',emitPath:false}"
filterable
>
</el-cascader>
<el-form-item
label=
"父级角色"
prop=
"parentId"
>
<el-cascader
:disabled=
"dialogType=='add'"
:options=
"AuthorityOption
"
:props=
"{ checkStrictly: true,label:'authorityName',value:'authorityId',disabled:'disabled',emitPath:false}
"
:show-all-levels=
"false"
filterable
v-model=
"form.parentId"
>
</el-cascader>
</el-form-item>
<el-form-item
label=
"角色ID"
prop=
"authorityId"
>
<el-input
autocomplete=
"off"
:disabled=
"dialogType=='edit'
"
v-model=
"form.authorityId"
></el-input>
<el-input
:disabled=
"dialogType=='edit'"
autocomplete=
"off
"
v-model=
"form.authorityId"
></el-input>
</el-form-item>
<el-form-item
label=
"角色姓名"
prop=
"authorityName"
>
<el-input
autocomplete=
"off"
v-model=
"form.authorityName"
></el-input>
...
...
@@ -51,15 +70,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"
:before-leave=
"autoEnter
"
>
<el-tabs
:before-leave=
"autoEnter"
class=
"role-box"
type=
"border-card
"
>
<el-tab-pane
label=
"角色菜单"
>
<Menus
:row=
"activeRow"
ref=
"menus"
/>
<Menus
:row=
"activeRow"
ref=
"menus"
/>
</el-tab-pane>
<el-tab-pane
label=
"角色api"
>
<apis
:row=
"activeRow"
ref=
"apis"
/>
<apis
:row=
"activeRow"
ref=
"apis"
/>
</el-tab-pane>
<el-tab-pane
label=
"资源权限"
>
<Datas
:authority=
"tableData"
:row=
"activeRow"
ref=
"datas"
/>
<Datas
:authority=
"tableData"
:row=
"activeRow"
ref=
"datas"
/>
</el-tab-pane>
</el-tabs>
</el-drawer>
...
...
@@ -74,7 +93,7 @@ import {
deleteAuthority
,
createAuthority
,
updateAuthority
,
copyAuthority
copyAuthority
}
from
'
@/api/authority
'
import
Menus
from
'
@/view/superAdmin/authority/components/menus
'
...
...
@@ -87,16 +106,18 @@ export default {
mixins
:
[
infoList
],
data
()
{
return
{
AuthorityOption
:[{
authorityId
:
"
0
"
,
authorityName
:
"
根角色
"
}],
AuthorityOption
:
[
{
authorityId
:
'
0
'
,
authorityName
:
'
根角色
'
}
],
listApi
:
getAuthorityList
,
drawer
:
false
,
dialogType
:
"
add
"
,
dialogType
:
'
add
'
,
activeRow
:
{},
activeUserId
:
0
,
dialogTitle
:
"
新增角色
"
,
dialogTitle
:
'
新增角色
'
,
dialogFormVisible
:
false
,
apiDialogFlag
:
false
,
copyForm
:
{},
...
...
@@ -124,10 +145,10 @@ export default {
Datas
},
methods
:
{
autoEnter
(
activeName
,
oldActiveName
){
const
paneArr
=
[
"
menus
"
,
"
apis
"
,
"
datas
"
]
if
(
oldActiveName
)
{
if
(
this
.
$refs
[
paneArr
[
oldActiveName
]].
needConfirm
)
{
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
}
...
...
@@ -136,13 +157,13 @@ export default {
// 拷贝角色
copyAuthority
(
row
)
{
this
.
setOptions
()
this
.
dialogTitle
=
"
拷贝角色
"
this
.
dialogType
=
"
copy
"
for
(
let
k
in
this
.
form
)
{
this
.
dialogTitle
=
'
拷贝角色
'
this
.
dialogType
=
'
copy
'
for
(
let
k
in
this
.
form
)
{
this
.
form
[
k
]
=
row
[
k
]
}
this
.
copyForm
=
row
this
.
dialogFormVisible
=
true
;
this
.
dialogFormVisible
=
true
},
opdendrawer
(
row
)
{
this
.
drawer
=
true
...
...
@@ -174,8 +195,10 @@ export default {
},
// 初始化表单
initForm
()
{
this
.
$refs
.
authorityForm
.
resetFields
()
this
.
form
=
{
if
(
this
.
$refs
.
authorityForm
)
{
this
.
$refs
.
authorityForm
.
resetFields
()
}
this
.
form
=
{
authorityId
:
''
,
authorityName
:
''
,
parentId
:
'
0
'
...
...
@@ -212,7 +235,7 @@ export default {
this
.
closeDialog
()
}
}
break
;
break
case
'
edit
'
:
{
const
res
=
await
updateAuthority
(
this
.
form
)
...
...
@@ -225,82 +248,88 @@ export default {
this
.
closeDialog
()
}
}
break
;
case
'
copy
'
:
{
const
data
=
{
"
authority
"
:
{
"
authorityId
"
:
"
string
"
,
"
authorityName
"
:
"
string
"
,
"
datauthorityId
"
:
[],
"
parentId
"
:
"
string
"
,
},
"
oldAuthorityId
"
:
0
}
data
.
authority
.
authorityId
=
this
.
form
.
authorityId
data
.
authority
.
authorityName
=
this
.
form
.
authorityName
data
.
authority
.
parentId
=
this
.
form
.
parentId
data
.
authority
.
dataAuthorityId
=
this
.
copyForm
.
dataAuthorityId
data
.
oldAuthorityId
=
this
.
copyForm
.
authorityId
const
res
=
await
copyAuthority
(
data
)
if
(
res
.
code
==
0
)
{
this
.
$message
({
type
:
'
success
'
,
message
:
'
复制成功!
'
})
this
.
getTableData
()
}
break
case
'
copy
'
:
{
const
data
=
{
authority
:
{
authorityId
:
'
string
'
,
authorityName
:
'
string
'
,
datauthorityId
:
[],
parentId
:
'
string
'
},
oldAuthorityId
:
0
}
data
.
authority
.
authorityId
=
this
.
form
.
authorityId
data
.
authority
.
authorityName
=
this
.
form
.
authorityName
data
.
authority
.
parentId
=
this
.
form
.
parentId
data
.
authority
.
dataAuthorityId
=
this
.
copyForm
.
dataAuthorityId
data
.
oldAuthorityId
=
this
.
copyForm
.
authorityId
const
res
=
await
copyAuthority
(
data
)
if
(
res
.
code
==
0
)
{
this
.
$message
({
type
:
'
success
'
,
message
:
'
复制成功!
'
})
this
.
getTableData
()
}
}
}
this
.
initForm
()
this
.
dialogFormVisible
=
false
}
})
},
setOptions
(){
this
.
AuthorityOption
=
[{
authorityId
:
"
0
"
,
authorityName
:
"
根角色
"
}]
this
.
setAuthorityOptions
(
this
.
tableData
,
this
.
AuthorityOption
,
false
)
},
setAuthorityOptions
(
AuthorityData
,
optionsData
,
disabled
){
AuthorityData
&&
AuthorityData
.
map
(
item
=>
{
if
(
item
.
children
&&
item
.
children
.
length
){
const
option
=
{
authorityId
:
item
.
authorityId
,
authorityName
:
item
.
authorityName
,
disabled
:
disabled
||
item
.
authorityId
==
this
.
form
.
authorityId
,
children
:[]
setOptions
()
{
this
.
AuthorityOption
=
[
{
authorityId
:
'
0
'
,
authorityName
:
'
根角色
'
}
this
.
setAuthorityOptions
(
item
.
children
,
option
.
children
,
disabled
||
item
.
authorityId
==
this
.
form
.
authorityId
)
optionsData
.
push
(
option
)
}
else
{
const
option
=
{
authorityId
:
item
.
authorityId
,
authorityName
:
item
.
authorityName
,
disabled
:
disabled
||
item
.
authorityId
==
this
.
form
.
authorityId
,
]
this
.
setAuthorityOptions
(
this
.
tableData
,
this
.
AuthorityOption
,
false
)
},
setAuthorityOptions
(
AuthorityData
,
optionsData
,
disabled
)
{
AuthorityData
&&
AuthorityData
.
map
(
item
=>
{
if
(
item
.
children
&&
item
.
children
.
length
)
{
const
option
=
{
authorityId
:
item
.
authorityId
,
authorityName
:
item
.
authorityName
,
disabled
:
disabled
||
item
.
authorityId
==
this
.
form
.
authorityId
,
children
:
[]
}
this
.
setAuthorityOptions
(
item
.
children
,
option
.
children
,
disabled
||
item
.
authorityId
==
this
.
form
.
authorityId
)
optionsData
.
push
(
option
)
}
else
{
const
option
=
{
authorityId
:
item
.
authorityId
,
authorityName
:
item
.
authorityName
,
disabled
:
disabled
||
item
.
authorityId
==
this
.
form
.
authorityId
}
optionsData
.
push
(
option
)
}
optionsData
.
push
(
option
)
}
})
})
},
// 增加角色
addAuthority
(
parentId
)
{
this
.
initForm
()
this
.
dialogTitle
=
"
新增角色
"
this
.
dialogType
=
"
add
"
this
.
dialogTitle
=
'
新增角色
'
this
.
dialogType
=
'
add
'
this
.
form
.
parentId
=
parentId
this
.
setOptions
()
this
.
dialogFormVisible
=
true
},
// 编辑角色
editAuthority
(
row
)
{
this
.
setOptions
()
this
.
dialogTitle
=
"
编辑角色
"
this
.
dialogType
=
"
edit
"
for
(
let
key
in
this
.
form
)
{
this
.
dialogTitle
=
'
编辑角色
'
this
.
dialogType
=
'
edit
'
for
(
let
key
in
this
.
form
)
{
this
.
form
[
key
]
=
row
[
key
]
}
this
.
setOptions
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录