1
0
Fork 0

更新框架角色权限管理

develop
vine_liutk 2023-03-20 10:07:38 +08:00
parent e09755a197
commit e20253c2bf
5 changed files with 13 additions and 88 deletions

View File

@ -1,79 +0,0 @@
<?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([]);
}
}

View File

@ -18,7 +18,7 @@ Route::group([
$router->resource('keywords', \App\Admin\Controllers\KeywordController::class);
$router->resource('system/re-roles', \App\Admin\Controllers\AdminRoleController::class);
// $router->resource('system/re-roles', \App\Admin\Controllers\AdminRoleController::class);
$router->resource('system/settings', \App\Admin\Controllers\SettingController::class);
});

View File

@ -64,10 +64,14 @@
},
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": {
"packagist": {
"repositories": [
{
"type": "composer",
"url": "https://mirrors.aliyun.com/composer/"
},
{
"type": "composer",
"url": "https://repo.packagist.org"
}
}
]
}

8
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "0955c00d24fb997149c86a6cf19f653a",
"content-hash": "919683e37fe05de4a5eed11ce6fdccd9",
"packages": [
{
"name": "brick/math",
@ -2317,11 +2317,11 @@
},
{
"name": "slowlyo/owl-admin",
"version": "v2.1.0",
"version": "v2.1.4",
"source": {
"type": "git",
"url": "https://gitee.com/slowlyo/owl-admin",
"reference": "33b9ebe4e3372e2b93c17df105d776d47268238f"
"reference": "c85a1f9fee4414a9ee69099b14aced0a0cb5ed18"
},
"require": {
"illuminate/support": "~9|~10",
@ -2364,7 +2364,7 @@
"admin",
"laravel"
],
"time": "2023-03-15T06:01:19+00:00"
"time": "2023-03-18T14:39:35+00:00"
},
{
"name": "symfony/console",

View File

@ -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/re-roles'],
['title' => '角色管理', 'icon' => 'icon-park:people-plus-one', 'url' => '/system/admin_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'],