baseCRUD() ->tableLayout('fixed') ->headerToolbar([ $this->createTypeButton('drawer', 'lg')->visible(Admin::user()->can('admin.hr.promotion.create')), ...$this->baseHeaderToolBar(), $this->exportAction(true)->visible($user->can('admin.hr.promotion.export')), ]) ->bulkActions([]) ->filterDefaultVisible() ->filter($this->baseFilter()->body([ amis()->GroupControl()->mode('horizontal')->body([ amisMake()->SelectControl()->name('store_id')->label(__('employee_promotion.store_id')) ->source(admin_url('api/stores?_all=1')) ->labelField('title') ->valueField('id') ->searchable() ->columnRatio(3) ->clearable(), amisMake()->TextControl()->name('employee_search')->label(__('employee_promotion.employee_id')) ->placeholder(__('employee.name').'/'.__('employee.phone')) ->columnRatio(3) ->clearable(), amisMake()->SelectControl()->name('job_id')->label(__('employee_promotion.job_id')) ->source(admin_url('api/keywords/tree-list').'?parent_key=job') ->labelField('name') ->valueField('key') ->columnRatio(3) ->clearable(), amisMake()->TextControl()->name('invitor_search')->label(__('employee_promotion.invitor_id')) ->placeholder(__('employee.name').'/'.__('employee.phone')) ->columnRatio(3) ->clearable(), ]), amis()->GroupControl()->mode('horizontal')->body([ amisMake()->SelectControl()->name('promotion_status')->label(__('employee_promotion.promotion_status')) ->options(PromotionStatus::options()) ->columnRatio(3) ->clearable(), ]), ])) ->columns([ amisMake()->TableColumn()->name('id')->label(__('employee_promotion.id')), amisMake()->TableColumn()->name('store.title')->label(__('employee_promotion.store_id')), amisMake()->TableColumn()->name('employee.name')->label(__('employee_promotion.employee_id')), amisMake()->TableColumn()->name('job.name')->label(__('employee_promotion.job_id')), amisMake()->TableColumn()->name('invitor.name')->label(__('employee_promotion.invitor_id')), amisMake()->TableColumn()->name('promotion_status')->label(__('employee_promotion.promotion_status'))->set('type', 'mapping')->map(PromotionStatus::options()), amisMake()->TableColumn()->name('workflow.check_name')->label(__('workflow.value')), amisMake()->TableColumn()->name('created_at')->label(__('employee_promotion.created_at')), $this->rowActions([ $this->rowShowButton()->visibleOn('${ARRAYINCLUDES(row_actions, "view")}'), $this->rowEditTypeButton('drawer', 'lg')->visibleOn('${ARRAYINCLUDES(row_actions, "edit")}'), $this->rowDeleteButton()->visibleOn('${ARRAYINCLUDES(row_actions, "delete")}'), // $this->cancelAction()->visibleOn('${ARRAYINCLUDES(row_actions, "cancel")}'), ]), ]); return $this->baseList($crud); } public function form($edit): Form { return $this->baseForm()->title('')->body([ amisMake()->SelectControl()->name('employee_id')->label(__('employee_promotion.employee_id')) ->source(admin_url('api/employees?_all=1&employee_status='.EmployeeStatus::Online->value)) ->labelField('name') ->valueField('id') ->searchable() ->joinValues(false) ->extractValue() ->required(), amisMake()->SelectControl()->name('invitor_id')->label(__('employee_promotion.invitor_id')) ->source(admin_url('api/employees?_all=1&employee_status='.EmployeeStatus::Online->value)) ->labelField('name') ->valueField('id') ->searchable() ->joinValues(false) ->extractValue() ->required(), amisMake()->SelectControl()->name('job_id')->label(__('employee_promotion.job_id')) ->source(admin_url('api/keywords/tree-list').'?parent_key=job') ->labelField('name') ->valueField('key') ->required(), amisMake()->TextControl()->name('remarks')->label(__('employee_promotion.remarks')), ]); } public function detail(): Form { $detailId = 'promotion-detail'; $serviceId = 'promotion-checklog-service'; $detail = amisMake()->Property()->items([ ['label' => __('employee_promotion.store_id'), 'content' => '${store.title}'], ['label' => __('employee_promotion.employee_id'), 'content' => '${employee.name}'], ['label' => __('employee_promotion.job_id'), 'content' => '${job.name}'], ['label' => __('employee_promotion.invitor_id'), 'content' => '${invitor.name}'], ['label' => __('employee_promotion.promotion_status'), 'content' => amisMake()->Mapping()->name('promotion_status')->map(PromotionStatus::options())], ['label' => __('employee_promotion.remarks'), 'content' => '${remarks}'], ['label' => __('employee_promotion.created_at'), 'content' => '${created_at}', 'span' => 3], ['label' => __('workflow_log.check_status'), 'content' => amisMake()->Mapping()->name('workflow.check_status')->map(CheckStatus::options())], ['label' => __('workflow_log.checked_at'), 'content' => '${workflow.checked_at}'], ['label' => __('workflow_log.remarks'), 'content' => '${workflow.check_remarks}'], ]); $data = amisMake()->Property()->items([ ['label' => __('employee_promotion.age'), 'content' => '${employee_data.age}'], ['label' => __('employee_promotion.sex'), 'content' => '${employee_data.sex}'], ['label' => __('employee_promotion.education'), 'content' => '${employee_data.education}'], ['label' => __('employee_promotion.first_work_time'), 'content' => '${employee_data.first_work_time}'], ['label' => __('employee_promotion.work_years'), 'content' => '${employee_data.work_years}'], ['label' => __('employee_promotion.work_years_in_company'), 'content' => '${employee_data.work_years_in_company}'], ['label' => __('employee_promotion.comment_self'), 'content' => '${employee_data.comment_self}', 'span' => 3], ['label' => __('employee_promotion.plans'), 'content' => '${employee_data.plans}', 'span' => 3], ['label' => __('employee_promotion.reason'), 'content' => '${employee_data.reason}', 'span' => 3], ]); return $this->baseDetail()->id($detailId)->title('')->onEvent([ 'inited' => [ 'actions' => [ ['actionType' => 'reload', 'componentId' => $serviceId], ], ], ])->body([ $detail, amisMake()->Divider()->title('补充资料'), $data, amisMake()->Divider(), $this->baseWorkflowLogList($detailId)->id($serviceId), ]); } protected function exportFileName() { return '升职申请'; } protected function exportMap($row) { return [ __('employee_promotion.id') => data_get($row, 'id'), __('employee_promotion.store_id') => data_get($row, 'store.title'), __('employee_promotion.employee_id') => data_get($row, 'employee.name'), __('employee_promotion.job_id') => data_get($row, 'job.name'), __('employee_promotion.invitor_id') => data_get($row, 'invitor.name'), __('employee_promotion.promotion_status') => data_get(PromotionStatus::options(), data_get($row, 'promotion_status'), ''), __('workflow.value') => data_get($row, 'workflow.check_name'), __('employee_promotion.created_at') => data_get($row, 'created_at'), ]; } }