added 细节的进一步细节体现

This commit is contained in:
zhaoxiang 2016-11-15 14:24:50 +08:00
parent 3b323e2869
commit 21fe069f77
4 changed files with 47 additions and 14 deletions

View File

@ -53,7 +53,7 @@ class Auth extends Base {
],
'topButton' => [
[
'href' => url('Auth/add'),
'href' => 'Auth/add',
'class'=> 'btn-success',
'info'=> '新增',
'icon' => 'fa fa-plus',
@ -63,7 +63,7 @@ class Auth extends Base {
'rightButton' => [
[
'info' => '编辑',
'href' => url('Auth/edit'),
'href' => 'Auth/edit',
'class'=> 'btn-info',
'param'=> [$this->primaryKey],
'icon' => 'fa fa-pencil',
@ -72,7 +72,7 @@ class Auth extends Base {
],
[
'info' => '启用',
'href' => url('Auth/open'),
'href' => 'Auth/open',
'class'=> 'btn-success ajax-put-url',
'param'=> [$this->primaryKey],
'icon' => 'fa fa-check',
@ -81,7 +81,7 @@ class Auth extends Base {
],
[
'info' => '禁用',
'href' => url('Auth/close'),
'href' => 'Auth/close',
'class'=> 'btn-warning ajax-put-url',
'param'=> [$this->primaryKey],
'icon' => 'fa fa-close',
@ -90,7 +90,7 @@ class Auth extends Base {
],
[
'info' => '删除',
'href' => url('Auth/del'),
'href' => 'Auth/del',
'class'=> 'btn-danger ajax-delete',
'param'=> [$this->primaryKey],
'icon' => 'fa fa-trash',
@ -145,6 +145,7 @@ class Auth extends Base {
],
'data' => $data
];
$table = $this->_prepareTemplate($table);
$this->result($table, ReturnCode::GET_TEMPLATE_SUCCESS);
}

View File

@ -45,6 +45,33 @@ class Base extends Controller {
return (new PublicShow())->show_404();
}
protected function _prepareTemplate( $temp ){
$authList = (new \Permission())->getAuthList($this->uid);
switch ( $temp['tempType'] ){
case 'table':
foreach ( $temp['topButton'] as $key => $value ){
if( !isset($authList[$value['href']]) || !$authList[$value['href']] ){
unset($temp['topButton'][$key]);
}else{
$temp['topButton'][$key]['href'] = url($value['href']);
}
}
$temp['topButton'] = array_values($temp['topButton']);
foreach ( $temp['rightButton'] as $k => $v ){
if( !isset($authList[$v['href']]) || !$authList[$v['href']] ){
unset($temp['rightButton'][$k]);
}else{
$temp['rightButton'][$k]['href'] = url($v['href']);
}
}
$temp['rightButton'] = array_values($temp['rightButton']);
break;
case 'form':
break;
}
return $temp;
}
/**
* 系统初始化函数(登陆状态检测,权限检测,初始化菜单)
*/
@ -91,6 +118,9 @@ class Base extends Controller {
}
}
/**
* 权限检测&权限验证
*/
private function checkRule(){
$check = (new \Permission())->check($this->url, $this->uid);
if( !$check && !isAdministrator() ){

View File

@ -78,14 +78,14 @@ class Menu extends Base {
],
'topButton' => [
[
'href' => url('Menu/add'),
'href' => 'Menu/add',
'class'=> 'btn-success',
'info'=> '新增',
'icon' => 'fa fa-plus',
'confirm' => 0,
],
[
'href' => url('Menu/del'),
'href' => 'Menu/del',
'class'=> 'btn-danger ajax-delete',
'info'=> '删除',
'icon' => 'fa fa-trash',
@ -95,7 +95,7 @@ class Menu extends Base {
'rightButton' => [
[
'info' => '编辑',
'href' => url('Menu/edit'),
'href' => 'Menu/edit',
'class'=> 'btn-warning',
'param'=> [$this->primaryKey],
'icon' => 'fa fa-pencil',
@ -104,7 +104,7 @@ class Menu extends Base {
],
[
'info' => '删除',
'href' => url('Menu/del'),
'href' => 'Menu/del',
'class'=> 'btn-danger ajax-delete',
'param'=> [$this->primaryKey],
'icon' => 'fa fa-trash',
@ -190,6 +190,7 @@ class Menu extends Base {
],
'data' => $data
];
$table = $this->_prepareTemplate($table);
$this->result($table, ReturnCode::GET_TEMPLATE_SUCCESS);
}

View File

@ -61,7 +61,7 @@ class User extends Base {
],
'topButton' => [
[
'href' => url('User/add'),
'href' => 'User/add',
'class'=> 'btn-success',
'info'=> '新增',
'icon' => 'fa fa-plus',
@ -71,7 +71,7 @@ class User extends Base {
'rightButton' => [
[
'info' => '启用',
'href' => url('User/open'),
'href' => 'User/open',
'class'=> 'btn-success ajax-put-url',
'param'=> [$this->primaryKey],
'icon' => 'fa fa-check',
@ -80,7 +80,7 @@ class User extends Base {
],
[
'info' => '禁用',
'href' => url('User/close'),
'href' => 'User/close',
'class'=> 'btn-warning ajax-put-url',
'param'=> [$this->primaryKey],
'icon' => 'fa fa-close',
@ -89,7 +89,7 @@ class User extends Base {
],
[
'info' => '授权',
'href' => url('Auth/group'),
'href' => 'Auth/group',
'class'=> 'btn-default',
'param'=> [$this->primaryKey],
'icon' => 'fa fa-lock',
@ -97,7 +97,7 @@ class User extends Base {
],
[
'info' => '删除',
'href' => url('User/del'),
'href' => 'User/del',
'class'=> 'btn-danger ajax-delete',
'param'=> [$this->primaryKey],
'icon' => 'fa fa-trash',
@ -124,6 +124,7 @@ class User extends Base {
],
'data' => $data
];
$table = $this->_prepareTemplate($table);
$this->result($table, ReturnCode::GET_TEMPLATE_SUCCESS);
}