77 lines
2.8 KiB
PHP
77 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
|
use Slowlyo\OwlAdmin\Renderers\TableColumn;
|
|
use Slowlyo\OwlAdmin\Renderers\TextControl;
|
|
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
|
use Slowlyo\OwlAdmin\Renderers\Button;
|
|
use App\Services\Admin\RegionCategoryService;
|
|
use App\Admin\Components;
|
|
|
|
class RegionCategoryController extends AdminController
|
|
{
|
|
protected string $serviceName = RegionCategoryService::class;
|
|
|
|
protected string $pageTitle = '区域分类';
|
|
|
|
public function list(): Page
|
|
{
|
|
$crud = $this->baseCRUD()
|
|
//关闭查询
|
|
->filterTogglable(false)
|
|
//去掉分页-start
|
|
->loadDataOnce(true)
|
|
->footerToolbar([])
|
|
//去掉分页-end
|
|
->headerToolbar([
|
|
$this->createButton(true),
|
|
...$this->baseHeaderToolBar(),
|
|
])
|
|
->filter(
|
|
$this->baseFilter()->body([
|
|
amisMake()->TextControl()->make('name')->label('分类名称')->name('name'),
|
|
|
|
Button::make()->label(__('admin.reset'))->actionType('clear-and-submit'),
|
|
amis('submit')->label(__('admin.search'))->level('primary'),
|
|
])->actions([])
|
|
)
|
|
->columns([
|
|
TableColumn::make()->name('id')->label('ID')->sortable(true),
|
|
TableColumn::make()->name('name')->label('名称'),
|
|
// TableColumn::make()->name('parent.name')->label('父级ID'),
|
|
TableColumn::make()->name('sort')->label('排序'),
|
|
TableColumn::make()->name('is_enable')->type('switch')->label('显示'),
|
|
TableColumn::make()->name('created_at')->label('创建时间')->type('datetime')->sortable(true),
|
|
$this->rowActions(true),
|
|
]);
|
|
|
|
return $this->baseList($crud);
|
|
}
|
|
|
|
public function form(): Form
|
|
{
|
|
return $this->baseForm()->body([
|
|
amisMake()->TextControl()->name('name')->label('名称')->required(true),
|
|
amisMake()->ImageControl()->name('icon')->label('封面图')->autoUpload(true),
|
|
amisMake()->TextControl()->name('description')->label('描述'),
|
|
Components::make()->parentControl(),
|
|
Components::make()->sortControl(),
|
|
amisMake()->SwitchControl()->name('is_enable')->label('状态'),
|
|
]);
|
|
}
|
|
|
|
public function detail(): Form
|
|
{
|
|
return $this->baseDetail()->body([
|
|
TextControl::make()->static(true)->name('id')->label('ID'),
|
|
TextControl::make()->static(true)->name('name')->label('名称'),
|
|
TextControl::make()->static(true)->name('description')->label('描述'),
|
|
TextControl::make()->static(true)->name('created_at')->label('创建时间'),
|
|
TextControl::make()->static(true)->name('updated_at')->label('更新时间')
|
|
]);
|
|
}
|
|
}
|