|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
|
|
+use App\Enums\ProjectStatus;
|
|
|
use App\Services\ProjectCateService;
|
|
|
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
|
|
|
|
@@ -12,50 +13,79 @@ use Slowlyo\OwlAdmin\Controllers\AdminController;
|
|
|
*/
|
|
|
class ProjectCateController extends AdminController
|
|
|
{
|
|
|
- protected string $serviceName = ProjectCateService::class;
|
|
|
-
|
|
|
- public function list()
|
|
|
- {
|
|
|
- $crud = $this->baseCRUD()
|
|
|
- ->filterTogglable(false)
|
|
|
- ->headerToolbar([
|
|
|
- $this->createButton('dialog'),
|
|
|
- ...$this->baseHeaderToolBar()
|
|
|
- ])
|
|
|
- ->columns([
|
|
|
- amis()->TableColumn('id', 'ID')->sortable(),
|
|
|
- amis()->TableColumn('name', '项目分类名称'),
|
|
|
- amis()->TableColumn('cover', '分类封面'),
|
|
|
- amis()->TableColumn('sort', '排序')->sortable(),
|
|
|
- amis()->TableColumn('state', '状态'),
|
|
|
- amis()->TableColumn('created_at', admin_trans('admin.created_at'))->type('datetime')->sortable(),
|
|
|
- amis()->TableColumn('updated_at', admin_trans('admin.updated_at'))->type('datetime')->sortable(),
|
|
|
- $this->rowActions('dialog')
|
|
|
- ]);
|
|
|
-
|
|
|
- return $this->baseList($crud);
|
|
|
- }
|
|
|
-
|
|
|
- public function form($isEdit = false)
|
|
|
- {
|
|
|
- return $this->baseForm()->body([
|
|
|
- amis()->TextControl('name', '项目分类名称'),
|
|
|
- amis()->TextControl('cover', '分类封面'),
|
|
|
- amis()->TextControl('sort', '排序'),
|
|
|
- amis()->TextControl('state', '状态'),
|
|
|
- ]);
|
|
|
- }
|
|
|
-
|
|
|
- public function detail()
|
|
|
- {
|
|
|
- return $this->baseDetail()->body([
|
|
|
- amis()->TextControl('id', 'ID')->static(),
|
|
|
- amis()->TextControl('name', '项目分类名称')->static(),
|
|
|
- amis()->TextControl('cover', '分类封面')->static(),
|
|
|
- amis()->TextControl('sort', '排序')->static(),
|
|
|
- amis()->TextControl('state', '状态')->static(),
|
|
|
- amis()->TextControl('created_at', admin_trans('admin.created_at'))->static(),
|
|
|
- amis()->TextControl('updated_at', admin_trans('admin.updated_at'))->static(),
|
|
|
- ]);
|
|
|
- }
|
|
|
-}
|
|
|
+ protected string $serviceName = ProjectCateService::class;
|
|
|
+
|
|
|
+ public function list()
|
|
|
+ {
|
|
|
+ $crud = $this->baseCRUD()
|
|
|
+ ->filterTogglable(false)
|
|
|
+ ->headerToolbar([
|
|
|
+ $this->createButton('dialog'),
|
|
|
+ ...$this->baseHeaderToolBar()
|
|
|
+ ])
|
|
|
+ ->columns([
|
|
|
+ amis()->TableColumn('id', 'ID')->sortable(),
|
|
|
+ amis()->TableColumn('name', '项目分类名称'),
|
|
|
+ amis()->TableColumn('cover', '分类封面')
|
|
|
+ ->type('image')
|
|
|
+ ->enlargeAble(true)
|
|
|
+ ->thumbMode('cover')
|
|
|
+ ->height(50)
|
|
|
+ ->width(50),
|
|
|
+ amis()->TableColumn('sort', '排序')->sortable(),
|
|
|
+ amis()->TableColumn('state', '状态')
|
|
|
+ ->type('mapping')
|
|
|
+ ->map([
|
|
|
+ ProjectStatus::CLOSE->value => '关闭',
|
|
|
+ ProjectStatus::OPEN->value => '开启',
|
|
|
+ ]),
|
|
|
+ amis()->TableColumn('created_at', admin_trans('admin.created_at'))->type('datetime')->sortable(),
|
|
|
+ amis()->TableColumn('updated_at', admin_trans('admin.updated_at'))->type('datetime')->sortable(),
|
|
|
+ $this->rowActions('dialog')
|
|
|
+ ]);
|
|
|
+
|
|
|
+ return $this->baseList($crud);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function form($isEdit = false)
|
|
|
+ {
|
|
|
+ return $this->baseForm()->body([
|
|
|
+ amis()->TextControl('name', '项目分类名称')
|
|
|
+ ->required(),
|
|
|
+
|
|
|
+ amis()->ImageControl('cover', '分类封面')
|
|
|
+ ->receiver('/upload-project-cate')
|
|
|
+ ->data([
|
|
|
+ 'bucket' => 'project-cate'
|
|
|
+ ])
|
|
|
+ ->autoUpload(true)
|
|
|
+ ->accept('image/*')
|
|
|
+ ->multiple(false),
|
|
|
+
|
|
|
+ amis()->NumberControl('sort', '排序')
|
|
|
+ ->min(0)
|
|
|
+ ->value(0),
|
|
|
+
|
|
|
+ amis()->SelectControl('state', '状态')
|
|
|
+ ->options([
|
|
|
+ ['label' => '关闭', 'value' => ProjectStatus::CLOSE],
|
|
|
+ ['label' => '开启', 'value' => ProjectStatus::OPEN],
|
|
|
+ ])
|
|
|
+ ->value(ProjectStatus::OPEN)
|
|
|
+ ->required(),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function detail()
|
|
|
+ {
|
|
|
+ return $this->baseDetail()->body([
|
|
|
+ amis()->TextControl('id', 'ID')->static(),
|
|
|
+ amis()->TextControl('name', '项目分类名称')->static(),
|
|
|
+ amis()->TextControl('cover', '分类封面')->static(),
|
|
|
+ amis()->TextControl('sort', '排序')->static(),
|
|
|
+ amis()->TextControl('state', '状态')->static(),
|
|
|
+ amis()->TextControl('created_at', admin_trans('admin.created_at'))->static(),
|
|
|
+ amis()->TextControl('updated_at', admin_trans('admin.updated_at'))->static(),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+}
|