can('admin_notice.create')) { array_push($options, $this->createButton(true, 'lg')); } $options = array_merge($options, $this->baseHeaderToolBar(),); $crud = $this->baseCRUD() ->filterTogglable(false) ->headerToolbar($options) ->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('更新时间') ]); } }