@ -29,6 +29,7 @@
< / div >
< / div >
< div class = "gva-table-box" >
< div class = "gva-table-box" >
< div class = "gva-btn-list" >
< div class = "gva-btn-list" >
< el -button size = "mini" type = "primary" icon = "el-icon-plus" @click ="openDialog('addApi')" > 新增 < / el -button >
< el -button size = "mini" type = "primary" icon = "el-icon-plus" @click ="openDialog('addApi')" > 新增 < / el -button >
< el -popover v -model :visible ="deleteVisible" placement = "top" width = "160" >
< el -popover v -model :visible ="deleteVisible" placement = "top" width = "160" >
< p > 确定要删除吗 ? < / p >
< p > 确定要删除吗 ? < / p >
@ -37,12 +38,7 @@
< el -button size = "mini" type = "primary" @click ="onDelete" > 确定 < / el -button >
< el -button size = "mini" type = "primary" @click ="onDelete" > 确定 < / el -button >
< / div >
< / div >
< template # reference >
< template # reference >
< el -button
icon = "el-icon-delete"
size = "mini"
style = "margin-left: 10px;"
: disabled = "showTableHeadDelbtn"
> 删除 < / e l - b u t t o n >
< el -button icon = "el-icon-delete" size = "mini" style = "margin-left: 10px;" > 删除 < / e l - b u t t o n >
< / template >
< / template >
< / e l - p o p o v e r >
< / e l - p o p o v e r >
< / div >
< / div >
@ -57,25 +53,26 @@
< el -table -column align = "center" label = "API简介" min -width = " 150 " prop = "description" sortable = "custom" / >
< el -table -column align = "center" label = "API简介" min -width = " 150 " prop = "description" sortable = "custom" / >
< el -table -column align = "center" label = "请求" min -width = " 150 " prop = "method" sortable = "custom" >
< el -table -column align = "center" label = "请求" min -width = " 150 " prop = "method" sortable = "custom" >
< template # default = "scope" >
< template # default = "scope" >
< div > { { scope . row . method } } / { { methodFiletr ( scope . row . method ) } } < / div >
< div >
{ { scope . row . method } } / { { methodFiletr ( scope . row . method ) } }
< / div >
< / template >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e - c o l u m n >
< el -table -column align = "center" fixed = "right" label = "操作" width = "200" >
< el -table -column align = "center" fixed = "right" label = "操作" width = "200" >
< template # default = "scope" >
< template # default = "scope" >
< el -button icon = "el-icon-edit" size = "small" type = "text" @click ="editApi(scope.row)" > 编辑 < / el -button >
< el -popconfirm
confirmButtonText = "好的"
cancelButtonText = "不用了"
icon = "el-icon-info"
iconColor = "red"
title = "你确定要删除吗?"
@ confirm = "deleteApi(scope.row)"
>
< template # reference >
< el -button icon = "el-icon-delete" size = "small" type = "text" > 删除 < / e l - b u t t o n >
< / template >
< / e l - p o p c o n f i r m >
< el -button
icon = "el-icon-edit"
size = "small"
type = "text"
@ click = "editApi(scope.row)"
> 编辑 < / e l - b u t t o n >
< el -button
icon = "el-icon-delete"
size = "small"
type = "text"
@ click = "deleteApi(scope.row)"
> 删除 < / e l - b u t t o n >
< / template >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e >
< / e l - t a b l e >
@ -90,11 +87,12 @@
@ size - change = "handleSizeChange"
@ size - change = "handleSizeChange"
/ >
/ >
< / div >
< / div >
< / div >
< / div >
< el -dialog v-model ="dialogFormVisible" :before-close="closeDialog" :title ="dialogTitle" >
< el -dialog v-model ="dialogFormVisible" :before-close="closeDialog" :title ="dialogTitle" >
< warning -bar title = "新增API,需要在角色管理内篇日志权限才可使用" / >
< warning -bar title = "新增API,需要在角色管理内篇日志权限才可使用" / >
< el -form ref = "apiForm" :model ="form" :rules ="rules" label -width = " 12 0px" >
< el -form ref = "apiForm" :model ="form" :rules ="rules" label -width = " 8 0px" >
< el -form -item label = "路径" prop = "path" >
< el -form -item label = "路径" prop = "path" >
< el -input v -model = " form.path " autocomplete = "off" / >
< el -input v -model = " form.path " autocomplete = "off" / >
< / e l - f o r m - i t e m >
< / e l - f o r m - i t e m >
@ -194,8 +192,7 @@ export default {
description : [
description : [
{ required : true , message : '请输入api介绍' , trigger : 'blur' }
{ required : true , message : '请输入api介绍' , trigger : 'blur' }
]
]
} ,
showTableHeadDelbtn : true
}
}
}
} ,
} ,
created ( ) {
created ( ) {
@ -212,11 +209,6 @@ export default {
} ,
} ,
/ / 选 中 a p i
/ / 选 中 a p i
handleSelectionChange ( val ) {
handleSelectionChange ( val ) {
if ( val . length ) {
this . showTableHeadDelbtn = false
} else {
this . showTableHeadDelbtn = true
}
this . apis = val
this . apis = val
} ,
} ,
async onDelete ( ) {
async onDelete ( ) {
@ -284,6 +276,12 @@ export default {
this . openDialog ( 'edit' )
this . openDialog ( 'edit' )
} ,
} ,
async deleteApi ( row ) {
async deleteApi ( row ) {
this . $confirm ( '此操作将永久删除所有角色下该api, 是否继续?' , '提示' , {
confirmButtonText : '确定' ,
cancelButtonText : '取消' ,
type : 'warning'
} )
. then ( async ( ) => {
const res = await deleteApi ( row )
const res = await deleteApi ( row )
if ( res . code === 0 ) {
if ( res . code === 0 ) {
this . $message ( {
this . $message ( {
@ -295,6 +293,13 @@ export default {
}
}
this . getTableData ( )
this . getTableData ( )
}
}
} )
. catch ( ( ) => {
this . $message ( {
type : 'info' ,
message : '已取消删除'
} )
} )
} ,
} ,
async enterDialog ( ) {
async enterDialog ( ) {
this . $refs . apiForm . validate ( async valid => {
this . $refs . apiForm . validate ( async valid => {