修改权限管理
This commit is contained in:
@@ -20,24 +20,13 @@ class Permission extends CatchController
|
||||
$this->permissions = $permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @time 2019年12月11日
|
||||
* @throws \Exception
|
||||
* @return string
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @time 2019年12月11日
|
||||
* @param Request $request
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function list(Request $request)
|
||||
public function index(Request $request)
|
||||
{
|
||||
return CatchResponse::success(Tree::done($this->permissions->getList($request->param())));
|
||||
}
|
||||
@@ -49,29 +38,7 @@ class Permission extends CatchController
|
||||
* @return string
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$form = new CatchForm();
|
||||
$form->formId('permission');
|
||||
$form->text('permission_name', '菜单名称', true)->verify('required')->placeholder('请输入菜单名称');
|
||||
$form->hidden('parent_id')->default(\request()->param('id') ?? 0);
|
||||
$form->select('module', '模块', true)->verify('required')->options(CatchAdmin::getModulesInfo());
|
||||
$form->text('route', '路由')->placeholder('请输入路由');
|
||||
$form->radio('method', '请求方法', true)->default(Permissions::GET)->options([
|
||||
['value' => Permissions::GET, 'title' => 'get'],
|
||||
['value' => Permissions::POST, 'title' => 'post'],
|
||||
['value' => Permissions::PUT, 'title' => 'put'],
|
||||
['value' => Permissions::DELETE, 'title' => 'delete'],
|
||||
]);
|
||||
$form->text('permission_mark', '权限标识', true)->verify('required')->placeholder('请输入权限标识controller:action');
|
||||
$form->radio('type', '类型', true)->default(Permissions::BTN_TYPE)->options([
|
||||
['value' => Permissions::MENU_TYPE, 'title' => '菜单'],
|
||||
['value' => Permissions::BTN_TYPE, 'title' => '按钮'],
|
||||
]);
|
||||
$form->text('sort', '排序')->verify('numberX')->default(1)->placeholder('倒叙排序');
|
||||
$form->formBtn('submitPermission');
|
||||
|
||||
return $this->fetch(['form' => $form->render()]);
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -95,39 +62,7 @@ class Permission extends CatchController
|
||||
* @return string
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$permission = $this->permissions->findBy($id);
|
||||
|
||||
$form = new CatchForm();
|
||||
$form->formId('permission');
|
||||
$form->text('permission_name', '菜单名称', true)
|
||||
->default($permission->permission_name)
|
||||
->verify('required')
|
||||
->placeholder('请输入菜单名称');
|
||||
$form->hidden('parent_id')->default($permission->parent_id);
|
||||
$form->select('module', '模块', true)->default($permission->module)->options(CatchAdmin::getModulesInfo());
|
||||
$form->text('route', '路由')->default($permission->route)->placeholder('请输入路由');
|
||||
$form->radio('method', '请求方法', true)->verify('required')->default($permission->method)->options([
|
||||
['value' => Permissions::GET, 'title' => 'get'],
|
||||
['value' => Permissions::POST, 'title' => 'post'],
|
||||
['value' => Permissions::PUT, 'title' => 'put'],
|
||||
['value' => Permissions::DELETE, 'title' => 'delete'],
|
||||
]);
|
||||
$form->text('permission_mark', '权限标识', true)
|
||||
->default($permission->permission_mark)
|
||||
->verify('required')->placeholder('请输入权限标识controller:action');
|
||||
$form->radio('type', '类型', true)->default($permission->type)->options([
|
||||
['value' => Permissions::MENU_TYPE, 'title' => '菜单'],
|
||||
['value' => Permissions::BTN_TYPE, 'title' => '按钮'],
|
||||
]);
|
||||
$form->text('sort', '排序')->verify('numberX')->default($permission->sort)->placeholder('倒叙排序');
|
||||
$form->formBtn('submitPermission');
|
||||
|
||||
return $this->fetch([
|
||||
'form' => $form->render(),
|
||||
'permission_id' => $permission->id,
|
||||
]);
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -18,15 +18,15 @@ class Role extends CatchController
|
||||
$this->role = $role;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @time 2019年12月09日
|
||||
* @throws \Exception
|
||||
* @return string
|
||||
*/
|
||||
public function index()
|
||||
/**
|
||||
*
|
||||
* @time 2019年12月09日
|
||||
* @param Request $request
|
||||
* @return string
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
return $this->fetch();
|
||||
return CatchResponse::success(Tree::done($this->role->getList($request->param())));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,20 +36,7 @@ class Role extends CatchController
|
||||
* @return string
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$form = new CatchForm();
|
||||
$form->formId('role');
|
||||
$form->text('role_name', '角色名称', true)->verify('required')->placeholder('请输入角色名称');
|
||||
$form->hidden('parent_id')->default(\request()->param('id') ?? 0);
|
||||
$form->textarea('description', '角色描述')->placeholder('请输入角色描述');
|
||||
$form->dom('<div id="permissions"></div>', '权限');
|
||||
$form->formBtn('submitRole');
|
||||
|
||||
return $this->fetch([
|
||||
'form' => $form->render(),
|
||||
'parent_id' => \request()->param('id') ?? 0,
|
||||
]);
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -149,17 +136,6 @@ class Role extends CatchController
|
||||
return CatchResponse::success();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @time 2019年12月11日
|
||||
* @param Request $request
|
||||
* @return Json
|
||||
*/
|
||||
public function list(Request $request)
|
||||
{
|
||||
return CatchResponse::success(Tree::done($this->role->getList($request->param())));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @time 2019年12月11日
|
||||
@@ -194,4 +170,4 @@ class Role extends CatchController
|
||||
'hasPermissions' => $permissionIds,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user