generated from liutk/owl-admin-base
70 lines
3.1 KiB
PHP
70 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Controllers\Train;
|
|
|
|
use App\Admin\Controllers\AdminController;
|
|
use App\Admin\Services\Train\PaperService;
|
|
use Slowlyo\OwlAdmin\Admin;
|
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
|
use App\Enums\QuestionCate;
|
|
|
|
/**
|
|
* 成绩管理
|
|
*/
|
|
class PaperController extends AdminController
|
|
{
|
|
protected string $serviceName = PaperService::class;
|
|
|
|
public function list(): Page
|
|
{
|
|
$crud = $this->baseCRUD()
|
|
->tableLayout('fixed')
|
|
->headerToolbar([
|
|
...$this->baseHeaderToolBar(),
|
|
])
|
|
->bulkActions([])
|
|
->filter($this->baseFilter()->body([
|
|
amis()->GroupControl()->mode('horizontal')->body([
|
|
amisMake()->TextControl()->name('examination_search')->label(__('train_paper.examination_id'))->columnRatio(3)->clearable(),
|
|
amisMake()->TextControl()->name('employee_search')->label(__('train_paper.employee_id'))->columnRatio(3)->clearable(),
|
|
]),
|
|
]))
|
|
->filterDefaultVisible()
|
|
->columns([
|
|
amisMake()->TableColumn()->name('id')->label(__('train_paper.id')),
|
|
amisMake()->TableColumn()->name('examination.name')->label(__('train_paper.examination_id')),
|
|
amisMake()->TableColumn()->name('employee.name')->label(__('train_paper.employee_id')),
|
|
amisMake()->TableColumn()->name('mark')->label(__('train_paper.mark')),
|
|
amisMake()->TableColumn()->name('finished_at')->label(__('train_paper.finished_at')),
|
|
$this->rowActions([
|
|
$this->rowShowButton(),
|
|
]),
|
|
]);
|
|
|
|
return $this->baseList($crud);
|
|
}
|
|
|
|
public function detail(): Form
|
|
{
|
|
$detail = amisMake()->Property()->column(2)->items([
|
|
['label' => __('train_paper.examination_id'), 'content' => '${examination.name}'],
|
|
['label' => __('train_paper.employee_id'), 'content' => '${employee.name}'],
|
|
['label' => __('train_paper.mark'), 'content' => '${mark}'],
|
|
['label' => __('train_paper.finished_at'), 'content' => '${finished_at}'],
|
|
]);
|
|
$question = amisMake()->Table()->columnsTogglable(false)->source('${content}')->columns([
|
|
amisMake()->TableColumn()->name('title')->label(__('train_question.title')),
|
|
amisMake()->TableColumn()->name('cate')->label(__('train_question.cate'))->set('type', 'mapping')->map(QuestionCate::options()),
|
|
amisMake()->TableColumn()->name('options')->label(__('train_question.options'))->set('type', 'list')->source('${options}')->listItem([
|
|
'titleClassName' => 'text-${IF(is_true, "success", "danger")}',
|
|
'title' => '${text}',
|
|
'desc' => '${selected ? "已选择" : ""}',
|
|
]),
|
|
amisMake()->TableColumn()->name('score')->label(__('train_question.score')),
|
|
amisMake()->TableColumn()->name('user_score')->label(__('train_question.user_score')),
|
|
]);
|
|
return $this->baseDetail()->title('')->body([$detail, amisMake()->Divider(), $question]);
|
|
}
|
|
}
|