baseCRUD() ->filterTogglable(false) ->columnsTogglable(false) ->alwaysShowPagination() ->headerToolbar([]) ->filter($this->baseFilter()->actions()->body([ amisMake()->SelectControl()->options($this->getPatientOptions())->searchable()->name('id')->label(__('total-record.name'))->size('md')->clearable(), amisMake()->SelectControl()->options($this->getTypeOptions())->name('type_id')->label(__('patient-record.type_id'))->size('md')->clearable(), amisMake()->DateRangeControl()->name('treat_range')->label(__('total-record.treat_at'))->clearable()->size('md'), // amisMake()->Button()->label(__('admin.reset'))->actionType('clear-and-submit'), amisMake()->Component()->setType('submit')->label(__('admin.search'))->level('primary'), ])) ->columns([ amisMake()->Column()->name('name')->label(__('total-record.name')), amisMake()->Column()->name('type.name')->label(__('total-record.type_id')), amisMake()->Column()->name('records_count')->label(__('total-record.records_count')), amisMake()->Column()->name('origin_price')->label(__('total-record.origin_price')), amisMake()->Column()->name('sell_price')->label(__('total-record.sell_price')), ]) ->affixRowClassName('text-info-dk') ->affixRow([ ['type' => 'text', 'text' => '总计: ${total}', 'colSpan' => 2], ['type' => 'text', 'text' => __('total-record.records_count').': ${records_count}'], ['type' => 'text', 'text' => __('total-record.origin_price') . ': ${origin_price}'], ['type' => 'text', 'text' => __('total-record.sell_price') . ': ${sell_price}'], ]); return $this->baseList($crud); } public function getPatientOptions() { if (!$this->patientOptions) { $this->patientOptions = Patient::select(['id as value', 'name as label'])->sort()->get(); } return $this->patientOptions; } public function getTypeOptions() { if (!$this->typeOptions) { $this->typeOptions = Keyword::where('type_key', 'treat_type')->select(['id as value', 'name as label'])->get(); } return $this->typeOptions; } }