65 lines
2.5 KiB
PHP
65 lines
2.5 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 App\Services\Admin\AdminNoticeService;
|
|
use App\Admin\Components;
|
|
|
|
class AdminNoticeController extends AdminController
|
|
{
|
|
protected string $serviceName = AdminNoticeService::class;
|
|
|
|
protected string $pageTitle = '公告管理';//待完善-todo
|
|
|
|
public function list(): Page
|
|
{
|
|
$crud = $this->baseCRUD()
|
|
->filterTogglable(false)
|
|
->headerToolbar([
|
|
$this->createButton(true, 'lg'),
|
|
...$this->baseHeaderToolBar(),
|
|
])
|
|
->columns([
|
|
TableColumn::make()->name('id')->label('ID')->sortable(true),
|
|
TableColumn::make()->name('title')->label('标题'),
|
|
TableColumn::make()->name('article_id')->label('关联文章')->className('text-primary'),
|
|
TableColumn::make()->name('is_enable')->type('switch')->label('显示'),
|
|
TableColumn::make()->name('published_at')->label('发布时间')->type('datetime')->sortable(true),
|
|
TableColumn::make()->name('created_at')->label('创建时间')->type('datetime')->sortable(true),
|
|
// TableColumn::make()->name('updated_at')->label('更新时间')->type('datetime')->sortable(true),
|
|
$this->rowActions(true, 'lg'),
|
|
]);
|
|
|
|
return $this->baseList($crud);
|
|
}
|
|
|
|
public function form(): Form
|
|
{
|
|
return $this->baseForm()->body([
|
|
\amisMake()->TextControl()->name('title')->label('标题')->required(true),
|
|
Components::make()->fuEditorControl(),
|
|
\amisMake()->SelectControl()->name('article_id')->label('关联文章'),
|
|
Components::make()->sortControl(),
|
|
\amisMake()->DateTimeControl()->name('published_at')->label('发布时间')->description('*不填写则默认为创建时间'),
|
|
\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('title')->label('标题'),
|
|
//-todo
|
|
|
|
TextControl::make()->static(true)->name('created_at')->label('创建时间'),
|
|
TextControl::make()->static(true)->name('updated_at')->label('更新时间')
|
|
]);
|
|
}
|
|
}
|