mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
modified 优化菜单权限配置
This commit is contained in:
parent
b1fd6a1f56
commit
621fbc5a77
@ -22,14 +22,26 @@ class Menu extends Base {
|
||||
'field' => 'url',
|
||||
'info' => '菜单URL'
|
||||
],
|
||||
[
|
||||
'field' => 'type',
|
||||
'info' => '菜单类型'
|
||||
],
|
||||
[
|
||||
'field' => 'level',
|
||||
'info' => '等级'
|
||||
],
|
||||
[
|
||||
'field' => 'post',
|
||||
'info' => 'Post'
|
||||
],
|
||||
[
|
||||
'field' => 'get',
|
||||
'info' => 'Get'
|
||||
],
|
||||
[
|
||||
'field' => 'put',
|
||||
'info' => 'Put'
|
||||
],
|
||||
[
|
||||
'field' => 'delete',
|
||||
'info' => 'Delete'
|
||||
],
|
||||
[
|
||||
'field' => 'hide',
|
||||
'info' => '隐藏'
|
||||
@ -98,21 +110,60 @@ class Menu extends Base {
|
||||
]
|
||||
]
|
||||
],
|
||||
'type' => [
|
||||
'module' => 'label',
|
||||
'post' => [
|
||||
'module' => 'icon',
|
||||
'rule' => [
|
||||
[
|
||||
'info' => '方法类功能',
|
||||
'class' => 'label label-info'
|
||||
'info' => '',
|
||||
'class' => 'fa fa-close'
|
||||
],
|
||||
[
|
||||
'info' => '模块类功能',
|
||||
'class' => 'label label-primary'
|
||||
'info' => '',
|
||||
'class' => 'fa fa-check'
|
||||
]
|
||||
]
|
||||
],
|
||||
'get' => [
|
||||
'module' => 'icon',
|
||||
'rule' => [
|
||||
[
|
||||
'info' => '',
|
||||
'class' => 'fa fa-close'
|
||||
],
|
||||
[
|
||||
'info' => '',
|
||||
'class' => 'fa fa-check'
|
||||
]
|
||||
]
|
||||
],
|
||||
'put' => [
|
||||
'module' => 'icon',
|
||||
'rule' => [
|
||||
[
|
||||
'info' => '',
|
||||
'class' => 'fa fa-close'
|
||||
],
|
||||
[
|
||||
'info' => '',
|
||||
'class' => 'fa fa-check'
|
||||
]
|
||||
]
|
||||
],
|
||||
'delete' => [
|
||||
'module' => 'icon',
|
||||
'rule' => [
|
||||
[
|
||||
'info' => '',
|
||||
'class' => 'fa fa-close'
|
||||
],
|
||||
[
|
||||
'info' => '',
|
||||
'class' => 'fa fa-check'
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'data' => $data //这个数据应该是从数据库中查出来
|
||||
'data' => $data
|
||||
];
|
||||
$this->result($table, ReturnCode::GET_TEMPLATE_SUCCESS);
|
||||
}
|
||||
@ -177,15 +228,29 @@ class Menu extends Base {
|
||||
]
|
||||
],
|
||||
[
|
||||
'module' => 'radio',
|
||||
'module' => 'checkbox',
|
||||
'description' => '',
|
||||
'info' => '菜单类型:',
|
||||
'info' => '访客权限:',
|
||||
'attr' => [
|
||||
'name' => 'type',
|
||||
'value' => '',
|
||||
'options' => [
|
||||
'模块类功能',
|
||||
'方法类功能'
|
||||
[
|
||||
'name' => 'auth[get]',
|
||||
'desc' => 'GET',
|
||||
'value' => ''
|
||||
],
|
||||
[
|
||||
'name' => 'auth[put]',
|
||||
'desc' => 'PUT',
|
||||
'value' => ''
|
||||
],
|
||||
[
|
||||
'name' => 'auth[post]',
|
||||
'desc' => 'POST',
|
||||
'value' => ''
|
||||
],
|
||||
[
|
||||
'name' => 'auth[delete]',
|
||||
'desc' => 'DELETE',
|
||||
'value' => ''
|
||||
]
|
||||
]
|
||||
],
|
||||
@ -202,19 +267,6 @@ class Menu extends Base {
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'module' => 'radio',
|
||||
'description' => '',
|
||||
'info' => '是否推荐:「该配置只对模块类功能生效」',
|
||||
'attr' => [
|
||||
'name' => 'recommend',
|
||||
'value' => '',
|
||||
'options' => [
|
||||
'普通模块',
|
||||
'推荐模块'
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'module' => 'text',
|
||||
'description' => '',
|
||||
@ -321,15 +373,29 @@ class Menu extends Base {
|
||||
]
|
||||
],
|
||||
[
|
||||
'module' => 'radio',
|
||||
'module' => 'checkbox',
|
||||
'description' => '',
|
||||
'info' => '菜单类型:',
|
||||
'info' => '访客权限:',
|
||||
'attr' => [
|
||||
'name' => 'type',
|
||||
'value' => $detail['type'],
|
||||
'options' => [
|
||||
'模块类功能',
|
||||
'方法类功能'
|
||||
[
|
||||
'name' => 'auth[get]',
|
||||
'desc' => 'GET',
|
||||
'value' => ''
|
||||
],
|
||||
[
|
||||
'name' => 'auth[put]',
|
||||
'desc' => 'PUT',
|
||||
'value' => ''
|
||||
],
|
||||
[
|
||||
'name' => 'auth[post]',
|
||||
'desc' => 'POST',
|
||||
'value' => ''
|
||||
],
|
||||
[
|
||||
'name' => 'auth[delete]',
|
||||
'desc' => 'DELETE',
|
||||
'value' => ''
|
||||
]
|
||||
]
|
||||
],
|
||||
@ -346,19 +412,6 @@ class Menu extends Base {
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'module' => 'radio',
|
||||
'description' => '',
|
||||
'info' => '是否推荐:「该配置只对模块类功能生效」',
|
||||
'attr' => [
|
||||
'name' => 'recommend',
|
||||
'value' => $detail['recommend'],
|
||||
'options' => [
|
||||
'普通模块',
|
||||
'推荐模块'
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'module' => 'text',
|
||||
'description' => '',
|
||||
|
@ -45,6 +45,9 @@
|
||||
case 'hidden':
|
||||
formHtml += buildHidden(value);
|
||||
break;
|
||||
case 'checkbox':
|
||||
formHtml += buildCheckbox(value);
|
||||
break;
|
||||
}
|
||||
});
|
||||
formHtml += '</div><div class="box-footer">';
|
||||
@ -53,6 +56,27 @@
|
||||
return formHtml;
|
||||
}
|
||||
|
||||
function buildCheckbox( checkboxObj ) {
|
||||
var formHtml = '<div>';
|
||||
formHtml += '<div class="col-xs-8 form-group"><label>'+ checkboxObj.info +'</label>';
|
||||
formHtml += '<div class="input-group radio">';
|
||||
if( checkboxObj.attr ){
|
||||
$.each(checkboxObj.attr, function (index, value) {
|
||||
if( value.value ){
|
||||
formHtml += '<input type="checkbox" checked name="'+ value.name +'"> '+ value.desc +' ';
|
||||
}else{
|
||||
formHtml += '<input type="checkbox" name="'+ value.name +'"> '+ value.desc +' ';
|
||||
}
|
||||
});
|
||||
}
|
||||
formHtml += '</div>';
|
||||
if( checkboxObj.description ){
|
||||
formHtml += ' <div class="col-xs-4 form-group" style="margin-top: 30px"><span class="label label-info">'+ checkboxObj.description +'</span></div>';
|
||||
}
|
||||
formHtml += '</div></div>';
|
||||
return formHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文本框
|
||||
* @param inputObj
|
||||
|
Loading…
x
Reference in New Issue
Block a user