临时处理角色编辑权限
parent
6bc1af4d47
commit
58954f3851
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||
use Slowlyo\OwlAdmin\Renderers\Form;
|
||||
use Slowlyo\OwlAdmin\Renderers\Operation;
|
||||
use Slowlyo\OwlAdmin\Renderers\TableColumn;
|
||||
use Slowlyo\OwlAdmin\Renderers\TextControl;
|
||||
use Slowlyo\OwlAdmin\Services\AdminRoleService;
|
||||
use Slowlyo\OwlAdmin\Renderers\TreeSelectControl;
|
||||
use Slowlyo\OwlAdmin\Renderers\CheckboxesControl;
|
||||
use Slowlyo\OwlAdmin\Services\AdminPermissionService;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminRoleController as BaseRoleController;
|
||||
|
||||
class AdminRoleController extends BaseRoleController
|
||||
{
|
||||
public function list(): Page
|
||||
{
|
||||
$crud = $this->baseCRUD()
|
||||
->headerToolbar([
|
||||
$this->createButton(true, 'lg'),
|
||||
'bulkActions',
|
||||
amis('reload')->align('right'),
|
||||
amis('filter-toggler')->align('right'),
|
||||
])
|
||||
->filterTogglable(false)
|
||||
->columns([
|
||||
TableColumn::make()->label('ID')->name('id')->sortable(true),
|
||||
TableColumn::make()->label(__('admin.admin_role.name'))->name('name'),
|
||||
TableColumn::make()->label(__('admin.admin_role.slug'))->name('slug')->type('tag'),
|
||||
TableColumn::make()->label(__('admin.created_at'))->name('created_at')->type('datetime')->sortable(true),
|
||||
TableColumn::make()->label(__('admin.updated_at'))->name('updated_at')->type('datetime')->sortable(true),
|
||||
Operation::make()->label(__('admin.actions'))->buttons([
|
||||
$this->rowEditButton(true, 'lg'),
|
||||
$this->rowDeleteButton()->visibleOn('${slug != "administrator"}'),
|
||||
]),
|
||||
]);
|
||||
|
||||
return $this->baseList($crud);
|
||||
}
|
||||
|
||||
public function form(): Form
|
||||
{
|
||||
return $this->baseForm()->body([
|
||||
TextControl::make()->label(__('admin.admin_role.name'))->name('name')->required(true)->size('lg'),
|
||||
TextControl::make()
|
||||
->label(__('admin.admin_role.slug'))
|
||||
->name('slug')
|
||||
->description(__('admin.admin_role.slug_description'))
|
||||
->required(true)->size('lg'),
|
||||
CheckboxesControl::make()
|
||||
->name('permissions')
|
||||
->label(__('admin.admin_role.permissions'))
|
||||
->options(AdminPermissionService::make()->getTree())
|
||||
// ->checkAll(true)
|
||||
->labelField('name')
|
||||
->valueField('id')
|
||||
->joinValues(false)
|
||||
->extractValue(true)
|
||||
// TreeSelectControl::make()
|
||||
// ->name('permissions')
|
||||
// ->label(__('admin.admin_role.permissions'))
|
||||
// ->multiple(true)
|
||||
// ->options(AdminPermissionService::make()->getTree())
|
||||
// ->searchable(true)
|
||||
// ->labelField('name')
|
||||
// ->valueField('id')
|
||||
// ->autoCheckChildren(false)
|
||||
// ->joinValues(false)
|
||||
// ->extractValue(true),
|
||||
]);
|
||||
}
|
||||
|
||||
public function detail(): Form
|
||||
{
|
||||
return $this->baseDetail()->body([]);
|
||||
}
|
||||
}
|
||||
|
|
@ -13,5 +13,7 @@ Route::group([
|
|||
|
||||
$router->resource('keywords', \App\Admin\Controllers\KeywordController::class);
|
||||
|
||||
$router->resource('system/re-roles', \App\Admin\Controllers\AdminRoleController::class);
|
||||
|
||||
$router->resource('system/settings', \App\Admin\Controllers\SettingController::class);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class AdminMenuSeeder extends Seeder
|
|||
['title' => '系统管理', 'icon' => 'icon-park:setting', 'url' => '/system',
|
||||
'children' => [
|
||||
['title' => '用户管理', 'icon' => 'icon-park:people-plus', 'url' => '/system/admin_users'],
|
||||
['title' => '角色管理', 'icon' => 'icon-park:people-plus-one', 'url' => '/system/admin_roles'],
|
||||
['title' => '角色管理', 'icon' => 'icon-park:people-plus-one', 'url' => '/system/re-roles'],
|
||||
['title' => '权限管理', 'icon' => 'icon-park:key-one', 'url' => '/system/admin_permissions'],
|
||||
['title' => '菜单管理', 'icon' => 'icon-park:menu-fold-one', 'url' => '/system/admin_menus'],
|
||||
['title' => '字典管理', 'icon' => 'icon-park:arrow-keys', 'url' => '/keywords'],
|
||||
|
|
|
|||
Loading…
Reference in New Issue