From ace5455b09729908261f6fc2d46bca4800adf841 Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Tue, 23 Apr 2024 14:30:20 +0800 Subject: [PATCH] fix bug --- app/Admin/Controllers/AgreementController.php | 21 +++----- .../Controllers/Hr/EmployeeController.php | 3 +- .../Controllers/Hr/HolidayController.php | 19 +++---- .../Hr/OfficalBusinessController.php | 17 +++--- .../Controllers/Hr/OvertimeController.php | 15 +++--- .../Controllers/Hr/PromotionController.php | 19 ++++--- .../Controllers/Hr/SignRepairController.php | 31 +++++------ .../Controllers/System/WorkflowController.php | 10 +++- .../Controllers/Train/BookController.php | 25 ++++++--- app/Admin/Middleware/CheckPermission.php | 6 +++ app/Admin/Services/AgreementService.php | 52 +++++++++++++++++++ .../Services/EmployeePromotionService.php | 44 ++++++++++++++++ app/Admin/Services/EmployeeService.php | 2 +- .../Services/EmployeeSignRepairService.php | 49 +++++++++++++++-- app/Admin/Services/HolidayApplyService.php | 46 +++++++++++++++- app/Admin/Services/OfficalBusinessService.php | 46 +++++++++++++++- app/Admin/Services/OvertimeApplyService.php | 46 +++++++++++++++- app/Admin/Services/Train/BookService.php | 35 +------------ app/Admin/Services/WorkFlowService.php | 32 ++++++++---- app/Admin/routes.php | 2 +- app/Models/EmployeePromotion.php | 7 --- app/Models/EmployeeSignRepair.php | 5 -- app/Models/Train/Book.php | 1 + app/Models/WorkflowCheck.php | 3 +- config/admin.php | 1 - ...24_03_27_113404_create_workflows_table.php | 5 ++ database/seeders/AdminSeeder.php | 18 +++---- database/seeders/WorkflowSeeder.php | 8 +-- 28 files changed, 403 insertions(+), 165 deletions(-) diff --git a/app/Admin/Controllers/AgreementController.php b/app/Admin/Controllers/AgreementController.php index c452795..413c999 100644 --- a/app/Admin/Controllers/AgreementController.php +++ b/app/Admin/Controllers/AgreementController.php @@ -56,25 +56,20 @@ class AgreementController extends AdminController amisMake()->TableColumn()->name('name')->label(__('agreement.name')), amisMake()->TableColumn()->name('employee.name')->label(__('agreement.employee_id')), amisMake()->TableColumn()->name('workflow.check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()), + amisMake()->TableColumn()->name('workflow.check_name')->label(__('workflow.value')), amisMake()->TableColumn()->name('created_at')->label(__('agreement.created_at')), amisMake()->Operation()->label(__('admin.actions'))->buttons([ - $this->rowShowTypeButton('drawer', 'lg') - ->visible($user->can('admin.agreement.view')), - $this->rowEditTypeButton('drawer', 'lg') - ->visible($user->can('admin.agreement.update')) - ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), - $this->rowDeleteButton() - ->visible($user->can('admin.agreement.delete')) - ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), - $this->applyAction(), - $this->cancelAction(), + $this->rowShowButton()->visibleOn('${ARRAYINCLUDES(row_actions, "view")}'), + $this->rowEditTypeButton('drawer', 'lg')->visibleOn('${ARRAYINCLUDES(row_actions, "edit")}'), + $this->rowDeleteButton()->visibleOn('${ARRAYINCLUDES(row_actions, "delete")}'), + $this->applyAction()->visibleOn('${ARRAYINCLUDES(row_actions, "apply")}'), + // $this->cancelAction()->visibleOn('${ARRAYINCLUDES(row_actions, "cancel")}'), amisMake()->AjaxAction() ->label('打包下载') ->api(admin_url('agreement/download?id=${id}')) ->level('link') ->redirect(url('admin-api/_download_export') . '?path=${path}') - ->visible($user->can('admin.agreement.download')) - ->visibleOn('${workflow.check_status == '.CheckStatus::Success->value.'}'), + ->visibleOn('${ARRAYINCLUDES(row_actions, "download")}'), ]), ]); @@ -112,7 +107,7 @@ class AgreementController extends AdminController ['label' => __('agreement.images'), 'content' => amisMake()->Images()->name('images')->src('${preview}')->enlargeAble(), '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}'], + ['label' => __('workflow_log.remarks'), 'content' => '${workflow_log.check_remarks}'], ]); return $this->baseDetail()->id($detailId)->title('')->onEvent([ diff --git a/app/Admin/Controllers/Hr/EmployeeController.php b/app/Admin/Controllers/Hr/EmployeeController.php index 0e812f8..e460687 100644 --- a/app/Admin/Controllers/Hr/EmployeeController.php +++ b/app/Admin/Controllers/Hr/EmployeeController.php @@ -38,7 +38,7 @@ class EmployeeController extends AdminController amisMake()->TableColumn()->name('jobs')->label(__('employee.jobs'))->type('each')->items(amisMake()->Tag()->label('${name}')), amisMake()->TableColumn()->name('phone')->label(__('employee.phone')), amisMake()->TableColumn()->name('employee_status_text')->label(__('employee.employee_status'))->set('type', 'tag')->set('color', '${employee_status_color}'), - amisMake()->TableColumn()->name('join_at')->label(__('employee.join_at')), + amisMake()->TableColumn()->name('store.title')->label(__('employee.store_id')), amisMake()->TableColumn()->name('remarks')->label(__('employee.remarks')), $this->rowActions([ $this->rowShowButton()->visible(Admin::user()->can('admin.hr.employees.view')), @@ -100,6 +100,7 @@ class EmployeeController extends AdminController public function detail(): Form { return $this->baseDetail()->title('')->body(amisMake()->Property()->items([ + ['label' => __('employee.store_id'), 'content' => '${store.title}', 'span' => 3], ['label' => __('employee.avatar'), 'content' => amisMake()->Avatar()->src('${avatar}')], ['label' => __('employee.name'), 'content' => '${name}'], ['label' => __('admin.username'), 'content' => '${admin_user.username}'], diff --git a/app/Admin/Controllers/Hr/HolidayController.php b/app/Admin/Controllers/Hr/HolidayController.php index 40a7332..b43d308 100644 --- a/app/Admin/Controllers/Hr/HolidayController.php +++ b/app/Admin/Controllers/Hr/HolidayController.php @@ -59,21 +59,18 @@ class HolidayController extends AdminController amisMake()->TableColumn()->name('store.title')->label(__('employee_sign.store_id')), amisMake()->TableColumn()->name('employee.name')->label(__('holiday_apply.employee_id')), amisMake()->TableColumn()->name('type.name')->label(__('holiday_apply.type_id')), - amisMake()->TableColumn()->name('reason')->label(__('holiday_apply.reason')), + // amisMake()->TableColumn()->name('reason')->label(__('holiday_apply.reason')), amisMake()->TableColumn()->name('start_at')->label(__('holiday_apply.start_at')), amisMake()->TableColumn()->name('end_at')->label(__('holiday_apply.end_at')), - amisMake()->TableColumn()->name('workflow.check_status')->label(__('holiday_apply.check_status'))->set('type', 'mapping')->map(CheckStatus::options()), + amisMake()->TableColumn()->name('workflow.check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()), + amisMake()->TableColumn()->name('workflow.check_name')->label(__('workflow.value')), amisMake()->TableColumn()->name('created_at')->label(__('holiday_apply.created_at')), $this->rowActions([ - $this->rowShowButton()->visible(Admin::user()->can('admin.hr.holiday.view')), - // $this->rowEditTypeButton('drawer', 'lg') - // ->visible(Admin::user()->can('admin.hr.holiday.update')) - // ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), - $this->rowDeleteButton() - ->visible(Admin::user()->can('admin.hr.holiday.delete')) - ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), - $this->applyAction(), - $this->cancelAction(), + $this->rowShowButton()->visibleOn('${ARRAYINCLUDES(row_actions, "view")}'), + // $this->rowEditTypeButton('drawer', 'lg')->visibleOn('${ARRAYINCLUDES(row_actions, "edit")}'), + $this->rowDeleteButton()->visibleOn('${ARRAYINCLUDES(row_actions, "delete")}'), + $this->applyAction()->visibleOn('${ARRAYINCLUDES(row_actions, "apply")}'), + $this->cancelAction()->visibleOn('${ARRAYINCLUDES(row_actions, "cancel")}'), ]), ]); diff --git a/app/Admin/Controllers/Hr/OfficalBusinessController.php b/app/Admin/Controllers/Hr/OfficalBusinessController.php index 8fe9954..eab4551 100644 --- a/app/Admin/Controllers/Hr/OfficalBusinessController.php +++ b/app/Admin/Controllers/Hr/OfficalBusinessController.php @@ -54,19 +54,16 @@ class OfficalBusinessController extends AdminController amisMake()->TableColumn()->name('start_at')->label(__('offical_business.date')), amisMake()->TableColumn()->name('end_at')->label(__('offical_business.date')), amisMake()->TableColumn()->name('address')->label(__('offical_business.address')), - amisMake()->TableColumn()->name('reason')->label(__('offical_business.reason')), + // amisMake()->TableColumn()->name('reason')->label(__('offical_business.reason')), amisMake()->TableColumn()->name('workflow.check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()), + amisMake()->TableColumn()->name('workflow.check_name')->label(__('workflow.value')), amisMake()->TableColumn()->name('created_at')->label(__('offical_business.created_at')), $this->rowActions([ - $this->rowShowButton()->visible(Admin::user()->can('admin.hr.business.view')), - // $this->rowEditTypeButton('drawer', 'lg') - // ->visible(Admin::user()->can('admin.hr.business.update')) - // ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), - $this->rowDeleteButton() - ->visible(Admin::user()->can('admin.hr.business.delete')) - ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), - $this->applyAction(), - $this->cancelAction(), + $this->rowShowButton()->visibleOn('${ARRAYINCLUDES(row_actions, "view")}'), + // $this->rowEditTypeButton('drawer', 'lg')->visibleOn('${ARRAYINCLUDES(row_actions, "view")}'), + $this->rowDeleteButton()->visibleOn('${ARRAYINCLUDES(row_actions, "delete")}'), + $this->applyAction()->visibleOn('${ARRAYINCLUDES(row_actions, "apply")}'), + $this->cancelAction()->visibleOn('${ARRAYINCLUDES(row_actions, "cancel")}'), ]), ]); diff --git a/app/Admin/Controllers/Hr/OvertimeController.php b/app/Admin/Controllers/Hr/OvertimeController.php index 6100295..5fbfd46 100644 --- a/app/Admin/Controllers/Hr/OvertimeController.php +++ b/app/Admin/Controllers/Hr/OvertimeController.php @@ -57,17 +57,14 @@ class OvertimeController extends AdminController amisMake()->TableColumn()->name('date')->label(__('overtime_apply.date')), amisMake()->TableColumn()->name('hours')->label(__('overtime_apply.hours')), amisMake()->TableColumn()->name('workflow.check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()), + amisMake()->TableColumn()->name('workflow.check_name')->label(__('workflow.value')), amisMake()->TableColumn()->name('created_at')->label(__('overtime_apply.created_at')), $this->rowActions([ - $this->rowShowButton()->visible(Admin::user()->can('admin.hr.overtime.view')), - // $this->rowEditTypeButton('drawer', 'lg') - // ->visible(Admin::user()->can('admin.hr.overtime.update')) - // ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), - $this->rowDeleteButton() - ->visible(Admin::user()->can('admin.hr.overtime.delete')) - ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), - $this->applyAction(), - $this->cancelAction(), + $this->rowShowButton()->visibleOn('${ARRAYINCLUDES(row_actions, "view")}'), + // $this->rowEditTypeButton('drawer', 'lg')->visibleOn('${ARRAYINCLUDES(row_actions, "edit")}'), + $this->rowDeleteButton()->visibleOn('${ARRAYINCLUDES(row_actions, "delete")}'), + $this->applyAction()->visibleOn('${ARRAYINCLUDES(row_actions, "apply")}'), + $this->cancelAction()->visibleOn('${ARRAYINCLUDES(row_actions, "cancel")}'), ]), ]); diff --git a/app/Admin/Controllers/Hr/PromotionController.php b/app/Admin/Controllers/Hr/PromotionController.php index 0af4ab0..1e8e9ec 100644 --- a/app/Admin/Controllers/Hr/PromotionController.php +++ b/app/Admin/Controllers/Hr/PromotionController.php @@ -4,8 +4,7 @@ namespace App\Admin\Controllers\Hr; use App\Admin\Controllers\AdminController; use App\Admin\Services\EmployeePromotionService; -use App\Enums\EmployeeStatus; -use App\Enums\PromotionStatus; +use App\Enums\{EmployeeStatus, CheckStatus, PromotionStatus}; use App\Traits\HasCheckActions; use Slowlyo\OwlAdmin\Admin; use Slowlyo\OwlAdmin\Renderers\Form; @@ -67,16 +66,13 @@ class PromotionController extends AdminController 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()->visible(Admin::user()->can('admin.hr.promotion.view')), - $this->rowEditTypeButton('drawer', 'lg') - ->visible(Admin::user()->can('admin.hr.promotion.update')) - ->visibleOn('${can_update}'), - $this->rowDeleteButton() - ->visible(Admin::user()->can('admin.hr.promotion.delete')) - ->visibleOn('${can_update}'), - $this->cancelAction()->visibleOn('${promotion_status == '.PromotionStatus::Processing->value.'}'), + $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")}'), ]), ]); @@ -124,6 +120,9 @@ class PromotionController extends AdminController ['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([ diff --git a/app/Admin/Controllers/Hr/SignRepairController.php b/app/Admin/Controllers/Hr/SignRepairController.php index f0a157a..e44e568 100644 --- a/app/Admin/Controllers/Hr/SignRepairController.php +++ b/app/Admin/Controllers/Hr/SignRepairController.php @@ -53,26 +53,19 @@ class SignRepairController extends AdminController ]), ])) ->columns([ - amisMake()->Column()->name('id')->label(__('employee_sign_repair.id')), - amisMake()->Column()->name('store.title')->label(__('employee_sign_repair.store_id')), - amisMake()->Column()->name('employee.name')->label(__('employee_sign_repair.employee_id')), - amisMake()->Column()->name('date')->label(__('employee_sign_repair.date')), - amisMake()->Column()->name('sign_time')->label(__('employee_sign_repair.sign_time')) - ->set('type', 'mapping') - ->map(SignTime::options()), - amisMake()->Column()->name('workflow.check_status')->label(__('employee_sign_repair.check_status')) - ->set('type', 'mapping') - ->map(CheckStatus::options()), + amisMake()->TableColumn()->name('id')->label(__('employee_sign_repair.id')), + amisMake()->TableColumn()->name('store.title')->label(__('employee_sign_repair.store_id')), + amisMake()->TableColumn()->name('employee.name')->label(__('employee_sign_repair.employee_id')), + amisMake()->TableColumn()->name('date')->label(__('employee_sign_repair.date')), + amisMake()->TableColumn()->name('sign_time')->label(__('employee_sign_repair.sign_time'))->set('type', 'mapping')->map(SignTime::options()), + amisMake()->TableColumn()->name('workflow.check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()), + amisMake()->TableColumn()->name('workflow.check_name')->label(__('workflow.value')), $this->rowActions([ - $this->rowShowButton()->visible(Admin::user()->can('admin.hr.repairs.view')), - // $this->rowEditTypeButton('drawer', 'lg') - // ->visible(Admin::user()->can('admin.hr.repairs.update')) - // ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), - $this->rowDeleteButton() - ->visible(Admin::user()->can('admin.hr.repairs.delete')) - ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), - $this->applyAction(), - $this->cancelAction(), + $this->rowShowButton()->visibleOn('${ARRAYINCLUDES(row_actions, "view")}'), + // $this->rowEditTypeButton('drawer', 'lg')->visibleOn('${ARRAYINCLUDES(row_actions, "edit")}'), + $this->rowDeleteButton()->visibleOn('${ARRAYINCLUDES(row_actions, "delete")}'), + $this->applyAction()->visibleOn('${ARRAYINCLUDES(row_actions, "apply")}'), + $this->cancelAction()->visibleOn('${ARRAYINCLUDES(row_actions, "cancel")}'), ]), ]); diff --git a/app/Admin/Controllers/System/WorkflowController.php b/app/Admin/Controllers/System/WorkflowController.php index 485b275..75cf490 100644 --- a/app/Admin/Controllers/System/WorkflowController.php +++ b/app/Admin/Controllers/System/WorkflowController.php @@ -186,7 +186,10 @@ class WorkflowController extends AdminController if (! $employee) { return $this->response()->fail('当前登录账户未关联员工'); } - $log = WorkflowLog::findOrFail($request->input('id')); + $log = WorkflowLog::find($request->input('id')); + if (!$log) { + return $this->response()->fail('审核已取消'); + } try { DB::beginTransaction(); if (! $this->service->check($employee, $log, true)) { @@ -212,7 +215,10 @@ class WorkflowController extends AdminController if (! $employee) { return $this->response()->fail('当前登录账户未关联员工'); } - $log = WorkflowLog::findOrFail($request->input('id')); + $log = WorkflowLog::find($request->input('id')); + if (!$log) { + return $this->response()->fail('审核已取消'); + } try { DB::beginTransaction(); if (! $this->service->check($employee, $log, false, ['remarks' => $request->input('remarks')])) { diff --git a/app/Admin/Controllers/Train/BookController.php b/app/Admin/Controllers/Train/BookController.php index 3a3d864..b67d82e 100644 --- a/app/Admin/Controllers/Train/BookController.php +++ b/app/Admin/Controllers/Train/BookController.php @@ -25,7 +25,6 @@ class BookController extends AdminController $this->createTypeButton('drawer', 'lg')->visible(Admin::user()->can('admin.train.books.create')), ...$this->baseHeaderToolBar(), ]) - ->bulkActions([]) ->filter($this->baseFilter()->body([ amis()->GroupControl()->mode('horizontal')->body([ amisMake()->SelectControl()->name('category_id')->label(__('train_book.category_id')) @@ -47,8 +46,8 @@ class BookController extends AdminController amisMake()->TableColumn()->name('type')->label(__('train_book.type'))->set('type', 'mapping')->map(BookType::options()), amisMake()->TableColumn()->name('created_at')->label(__('train_book.created_at')), $this->rowActions([ - $this->rowShowButton()->visible(Admin::user()->can('admin.train.books.view')), - $this->rowEditButton()->visible(Admin::user()->can('admin.train.books.update')), + $this->rowShowTypeButton('drawer', 'lg')->visible(Admin::user()->can('admin.train.books.view')), + $this->rowEditTypeButton('drawer', 'lg')->closeOnOutside(false)->visible(Admin::user()->can('admin.train.books.update')), $this->rowDeleteButton()->visible(Admin::user()->can('admin.train.books.delete')), ]), ]); @@ -65,14 +64,24 @@ class BookController extends AdminController ->valueField('key') ->required(), amisMake()->TextControl()->name('title')->label(__('train_book.title'))->required(), - amisMake()->ImageControl()->name('cover_image')->label(__('train_book.cover_image')), + amisMake()->ImageControl()->name('cover_image')->label(__('train_book.cover_image'))->receiver(admin_url('upload_image') . '?full-url=1'), amisMake()->TextControl()->name('description')->label(__('train_book.description')), amisMake()->RadiosControl()->options(BookType::options())->name('type')->label(__('train_book.type')), Components::make()->fuEditorControl('content', __('train_book.content'))->visibleOn('${type == '.BookType::Text->value.'}'), - Components::make()->chunkFileControl('video', __('train_book.video'))->visibleOn('${type == '.BookType::Video->value.'}'), - // amisMake()->FileControl()->name('video')->label(__('train_book.video'))->visibleOn('${type == '.BookType::Video->value.'}'), - // amisMake()->FileControl()->multiple()->joinValues(false)->name('files')->label(__('train_book.files'))->visibleOn('${type == '.BookType::File->value.'}'), - Components::make()->chunkFileControl('files', __('train_book.files'))->multiple()->joinValues(false)->visibleOn('${type == '.BookType::File->value.'}'), + amisMake()->FileControl()->name('video')->label(__('train_book.video')) + ->receiver(admin_url('upload_file') . '?full-url=1') + ->startChunkApi(admin_url('start_chunk_upload_file')) + ->chunkApi(admin_url('save_chunk_upload_file')) + ->finishChunkApi(admin_url('finish_chunk_upload_file')) + ->visibleOn('${type == '.BookType::Video->value.'}'), + amisMake()->FileControl()->name('files')->label(__('train_book.files')) + ->receiver(admin_url('upload_file') . '?full-url=1') + ->multiple() + ->joinValues(false) + ->startChunkApi(admin_url('start_chunk_upload_file')) + ->chunkApi(admin_url('save_chunk_upload_file')) + ->finishChunkApi(admin_url('finish_chunk_upload_file')) + ->visibleOn('${type == '.BookType::File->value.'}'), ]); } diff --git a/app/Admin/Middleware/CheckPermission.php b/app/Admin/Middleware/CheckPermission.php index 664444a..2ccf127 100644 --- a/app/Admin/Middleware/CheckPermission.php +++ b/app/Admin/Middleware/CheckPermission.php @@ -16,6 +16,12 @@ class CheckPermission */ protected $exceptPaths = [ '/api/*', + '/start_chunk_upload_file', + '/save_chunk_upload_file', + '/finish_chunk_upload_file', + '/upload_file', + '/upload_image', + '/upload_rich' ]; /** diff --git a/app/Admin/Services/AgreementService.php b/app/Admin/Services/AgreementService.php index f34d862..e63f2a3 100644 --- a/app/Admin/Services/AgreementService.php +++ b/app/Admin/Services/AgreementService.php @@ -6,6 +6,9 @@ use App\Admin\Filters\AgreementFilter; use App\Models\{Agreement, WorkflowCheck}; use Illuminate\Support\Facades\{Validator, Storage}; use Illuminate\Support\Str; +use Slowlyo\OwlAdmin\Admin; +use App\Enums\CheckStatus; +use Slowlyo\OwlAdmin\Models\AdminUser; class AgreementService extends BaseService { @@ -15,6 +18,55 @@ class AgreementService extends BaseService protected string $modelFilterName = AgreementFilter::class; + public function list() + { + $query = $this->listQuery(); + if (request()->input('_all')) { + $list = (clone $query)->get(); + $items = $list->all(); + $total = $list->count(); + } else { + $list = (clone $query)->paginate(request()->input('perPage', 20)); + $items = $list->items(); + $total = $list->total(); + } + $user = Admin::user(); + foreach($items as &$item) { + $item->row_actions = $this->rowActions($user, $item); + } + + return compact('items', 'total'); + } + + public function rowActions(AdminUser $user, $model) + { + // view, edit, delete + // apply, cancel + $actions = []; + if ($user->can('admin.agreement.view')) { + array_push($actions, 'view'); + } + if ($user->can('admin.agreement.update') && $model->canUpdate()) { + array_push($actions, 'edit'); + } + if ($user->can('admin.agreement.delete')) { + array_push($actions, 'delete'); + } + if ($user->can('admin.agreement.download') && in_array($model->workflow->check_status, [CheckStatus::Success])) { + array_push($actions, 'download'); + } + + if (in_array($model->workflow->check_status, [CheckStatus::None, CheckStatus::Cancel, CheckStatus::Fail])) { + array_push($actions, 'apply'); + } + + if (in_array($model->workflow->check_status, [CheckStatus::Processing])) { + array_push($actions, 'cancel'); + } + + return $actions; + } + public function resloveData($data, $model = null) { if (isset($data['images']) && $data['images']) { diff --git a/app/Admin/Services/EmployeePromotionService.php b/app/Admin/Services/EmployeePromotionService.php index 6020808..a08eadb 100644 --- a/app/Admin/Services/EmployeePromotionService.php +++ b/app/Admin/Services/EmployeePromotionService.php @@ -10,6 +10,9 @@ use App\Models\EmployeePromotion; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Validator; use Illuminate\Support\Arr; +use Slowlyo\OwlAdmin\Admin; +use App\Enums\CheckStatus; +use Slowlyo\OwlAdmin\Models\AdminUser; class EmployeePromotionService extends BaseService { @@ -19,6 +22,47 @@ class EmployeePromotionService extends BaseService protected string $modelFilterName = EmployeePromotionFilter::class; + public function list() + { + $query = $this->listQuery(); + if (request()->input('_all')) { + $list = (clone $query)->get(); + $items = $list->all(); + $total = $list->count(); + } else { + $list = (clone $query)->paginate(request()->input('perPage', 20)); + $items = $list->items(); + $total = $list->total(); + } + $user = Admin::user(); + foreach($items as &$item) { + $item->row_actions = $this->rowActions($user, $item); + } + + return compact('items', 'total'); + } + + public function rowActions(AdminUser $user, $model) + { + // view, edit, delete + // apply, cancel + $actions = []; + if ($user->can('admin.hr.promotion.view')) { + array_push($actions, 'view'); + } + if ($user->can('admin.hr.promotion.update') && $model->canUpdate()) { + array_push($actions, 'edit'); + } + if ($user->can('admin.hr.promotion.delete') && $model->canUpdate()) { + array_push($actions, 'delete'); + } + if (in_array($model->promotion_status, [PromotionStatus::Processing])) { + array_push($actions, 'cancel'); + } + + return $actions; + } + public function resloveData($data, $model = null) { // 获取员工所在的门店 diff --git a/app/Admin/Services/EmployeeService.php b/app/Admin/Services/EmployeeService.php index 0420cd5..1481800 100644 --- a/app/Admin/Services/EmployeeService.php +++ b/app/Admin/Services/EmployeeService.php @@ -15,7 +15,7 @@ use App\Enums\EmployeeStatus; class EmployeeService extends BaseService { - protected array $withRelationships = ['jobs', 'adminUser']; + protected array $withRelationships = ['jobs', 'adminUser', 'store']; protected string $modelName = Employee::class; diff --git a/app/Admin/Services/EmployeeSignRepairService.php b/app/Admin/Services/EmployeeSignRepairService.php index 66e7a5e..9327c83 100644 --- a/app/Admin/Services/EmployeeSignRepairService.php +++ b/app/Admin/Services/EmployeeSignRepairService.php @@ -3,11 +3,12 @@ namespace App\Admin\Services; use App\Admin\Filters\EmployeeSignRepairFilter; -use App\Models\Employee; -use App\Models\{EmployeeSignRepair, EmployeeSign, EmployeeSignLog}; -use App\Models\WorkflowCheck; +use App\Models\{EmployeeSignRepair, Employee, WorkflowCheck, EmployeeSign, EmployeeSignLog}; use Illuminate\Support\Facades\Validator; use Illuminate\Validation\Rule; +use Slowlyo\OwlAdmin\Admin; +use App\Enums\CheckStatus; +use Slowlyo\OwlAdmin\Models\AdminUser; class EmployeeSignRepairService extends BaseService { @@ -17,6 +18,47 @@ class EmployeeSignRepairService extends BaseService protected string $modelFilterName = EmployeeSignRepairFilter::class; + public function list() + { + $query = $this->listQuery(); + if (request()->input('_all')) { + $list = (clone $query)->get(); + $items = $list->all(); + $total = $list->count(); + } else { + $list = (clone $query)->paginate(request()->input('perPage', 20)); + $items = $list->items(); + $total = $list->total(); + } + $user = Admin::user(); + foreach($items as &$item) { + $item->row_actions = $this->rowActions($user, $item); + } + + return compact('items', 'total'); + } + + public function rowActions(AdminUser $user, $model) + { + // view, edit, delete + // apply, cancel + $actions = []; + if ($user->can('admin.hr.repairs.view')) { + array_push($actions, 'view'); + } + if ($user->can('admin.hr.repairs.delete') && !in_array($model->workflow->check_status, [CheckStatus::Processing])) { + array_push($actions, 'delete'); + } + if (in_array($model->workflow->check_status, [CheckStatus::None, CheckStatus::Cancel, CheckStatus::Fail])) { + array_push($actions, 'apply'); + } + if (in_array($model->workflow->check_status, [CheckStatus::Processing])) { + array_push($actions, 'cancel'); + } + + return $actions; + } + public function resloveData($data, $model = null) { // 获取员工所在的门店 @@ -44,7 +86,6 @@ class EmployeeSignRepairService extends BaseService 'employee_id.required' => __('employee_sign_repair.employee_id').'必填', 'reason.required' => __('employee_sign_repair.reason').'必填', 'sign_time.required' => __('employee_sign_repair.sign_time').'必填', - 'date.unique' => __('employee_sign_repair.date').' 已经申请过了', ]; $validator = Validator::make($data, $model ? $updateRules : $createRules, $message); if ($validator->fails()) { diff --git a/app/Admin/Services/HolidayApplyService.php b/app/Admin/Services/HolidayApplyService.php index 90fdb4a..50fccf0 100644 --- a/app/Admin/Services/HolidayApplyService.php +++ b/app/Admin/Services/HolidayApplyService.php @@ -3,10 +3,11 @@ namespace App\Admin\Services; use App\Admin\Filters\HolidayApplyFilter; -use App\Models\Employee; -use App\Models\HolidayApply; +use App\Models\{HolidayApply, Employee}; use Carbon\Carbon; use Illuminate\Support\Facades\Validator; +use Slowlyo\OwlAdmin\Admin; +use App\Enums\CheckStatus; class HolidayApplyService extends BaseService { @@ -16,6 +17,47 @@ class HolidayApplyService extends BaseService protected string $modelFilterName = HolidayApplyFilter::class; + public function list() + { + $query = $this->listQuery(); + if (request()->input('_all')) { + $list = (clone $query)->get(); + $items = $list->all(); + $total = $list->count(); + } else { + $list = (clone $query)->paginate(request()->input('perPage', 20)); + $items = $list->items(); + $total = $list->total(); + } + $user = Admin::user(); + foreach($items as &$item) { + $item->row_actions = $this->rowActions($user, $item); + } + + return compact('items', 'total'); + } + + public function rowActions($user, $model) + { + // view, edit, delete + // apply, cancel + $actions = []; + if ($user->can('admin.hr.holiday.view')) { + array_push($actions, 'view'); + } + if ($user->can('admin.hr.holiday.delete') && !in_array($model->workflow->check_status, [CheckStatus::Processing])) { + array_push($actions, 'delete'); + } + if (in_array($model->workflow->check_status, [CheckStatus::None, CheckStatus::Cancel, CheckStatus::Fail])) { + array_push($actions, 'apply'); + } + if (in_array($model->workflow->check_status, [CheckStatus::Processing])) { + array_push($actions, 'cancel'); + } + + return $actions; + } + public function resloveData($data, $model = null) { // 获取员工所在的门店 diff --git a/app/Admin/Services/OfficalBusinessService.php b/app/Admin/Services/OfficalBusinessService.php index 53d2e5f..625a3b0 100644 --- a/app/Admin/Services/OfficalBusinessService.php +++ b/app/Admin/Services/OfficalBusinessService.php @@ -3,10 +3,11 @@ namespace App\Admin\Services; use App\Admin\Filters\OfficalBusinessFilter; -use App\Models\Employee; -use App\Models\OfficalBusiness; +use App\Models\{Employee, OfficalBusiness}; use Carbon\Carbon; use Illuminate\Support\Facades\Validator; +use Slowlyo\OwlAdmin\Admin; +use App\Enums\CheckStatus; class OfficalBusinessService extends BaseService { @@ -16,6 +17,47 @@ class OfficalBusinessService extends BaseService protected string $modelFilterName = OfficalBusinessFilter::class; + public function list() + { + $query = $this->listQuery(); + if (request()->input('_all')) { + $list = (clone $query)->get(); + $items = $list->all(); + $total = $list->count(); + } else { + $list = (clone $query)->paginate(request()->input('perPage', 20)); + $items = $list->items(); + $total = $list->total(); + } + $user = Admin::user(); + foreach($items as &$item) { + $item->row_actions = $this->rowActions($user, $item); + } + + return compact('items', 'total'); + } + + public function rowActions($user, $model) + { + // view, edit, delete + // apply, cancel + $actions = []; + if ($user->can('admin.hr.business.view')) { + array_push($actions, 'view'); + } + if ($user->can('admin.hr.business.delete') && !in_array($model->workflow->check_status, [CheckStatus::Processing])) { + array_push($actions, 'delete'); + } + if (in_array($model->workflow->check_status, [CheckStatus::None, CheckStatus::Cancel, CheckStatus::Fail])) { + array_push($actions, 'apply'); + } + if (in_array($model->workflow->check_status, [CheckStatus::Processing])) { + array_push($actions, 'cancel'); + } + + return $actions; + } + public function resloveData($data, $model = null) { // 获取员工所在的门店 diff --git a/app/Admin/Services/OvertimeApplyService.php b/app/Admin/Services/OvertimeApplyService.php index 20ae72c..f023f22 100644 --- a/app/Admin/Services/OvertimeApplyService.php +++ b/app/Admin/Services/OvertimeApplyService.php @@ -3,10 +3,11 @@ namespace App\Admin\Services; use App\Admin\Filters\OvertimeApplyFilter; -use App\Models\Employee; -use App\Models\OvertimeApply; +use App\Models\{Employee, OvertimeApply}; use Carbon\Carbon; use Illuminate\Support\Facades\Validator; +use Slowlyo\OwlAdmin\Admin; +use App\Enums\CheckStatus; class OvertimeApplyService extends BaseService { @@ -16,6 +17,47 @@ class OvertimeApplyService extends BaseService protected string $modelFilterName = OvertimeApplyFilter::class; + public function list() + { + $query = $this->listQuery(); + if (request()->input('_all')) { + $list = (clone $query)->get(); + $items = $list->all(); + $total = $list->count(); + } else { + $list = (clone $query)->paginate(request()->input('perPage', 20)); + $items = $list->items(); + $total = $list->total(); + } + $user = Admin::user(); + foreach($items as &$item) { + $item->row_actions = $this->rowActions($user, $item); + } + + return compact('items', 'total'); + } + + public function rowActions($user, $model) + { + // view, edit, delete + // apply, cancel + $actions = []; + if ($user->can('admin.hr.overtime.view')) { + array_push($actions, 'view'); + } + if ($user->can('admin.hr.overtime.delete') && !in_array($model->workflow->check_status, [CheckStatus::Processing])) { + array_push($actions, 'delete'); + } + if (in_array($model->workflow->check_status, [CheckStatus::None, CheckStatus::Cancel, CheckStatus::Fail])) { + array_push($actions, 'apply'); + } + if (in_array($model->workflow->check_status, [CheckStatus::Processing])) { + array_push($actions, 'cancel'); + } + + return $actions; + } + public function resloveData($data, $model = null) { // 获取员工所在的门店 diff --git a/app/Admin/Services/Train/BookService.php b/app/Admin/Services/Train/BookService.php index 4be10a3..0ef52de 100644 --- a/app/Admin/Services/Train/BookService.php +++ b/app/Admin/Services/Train/BookService.php @@ -16,37 +16,6 @@ class BookService extends BaseService protected string $modelFilterName = TrianBookFilter::class; - public function resloveData($data, $model = null) - { - if (isset($data['cover_image']) && $data['cover_image']) { - $image = $data['cover_image']; - $data['cover_image'] = $this->formatUrl($image); - } - if (isset($data['video']) && $data['video']) { - $video = is_array($data['video']) ? data_get($data, 'video.value') : $data['video']; - $data['video'] = $this->formatUrl($video); - } - if (isset($data['files']) && $data['files']) { - $files = []; - foreach ($data['files'] as $key => $value) { - if (is_array($value)) { - $path = data_get($value, 'value'); - $value['url'] = $this->formatUrl($path); - array_push($files, $value); - } else { - array_push($files, [ - 'id' => $key + 1, - 'name' => $value, - 'url' => $this->formatUrl($value), - 'state' => 'uploaded' - ]); - } - } - $data['files'] = $files; - } - return $data; - } - protected function formatUrl($str) { return Str::startsWith($str, ['http://', 'https://']) ? $str : Storage::url($str); @@ -58,10 +27,10 @@ class BookService extends BaseService 'title' => ['required'], 'category_id' => ['required'], 'type' => ['required'], - 'files' => ['array'], + 'files' => ['nullable', 'array'], ]; $updateRules = [ - 'files' => ['array'], + 'files' => ['nullable','array'], ]; $validator = Validator::make($data, $model ? $updateRules : $createRules); if ($validator->fails()) { diff --git a/app/Admin/Services/WorkFlowService.php b/app/Admin/Services/WorkFlowService.php index 59ad701..338b3bf 100644 --- a/app/Admin/Services/WorkFlowService.php +++ b/app/Admin/Services/WorkFlowService.php @@ -2,8 +2,7 @@ namespace App\Admin\Services; -use App\Enums\CheckStatus; -use App\Enums\CheckType; +use App\Enums\{CheckStatus, CheckType}; use App\Models\Employee; use App\Models\Keyword; use App\Models\Store; @@ -120,14 +119,17 @@ class WorkFlowService extends BaseService /** * 取消审核 - * 1. 删除未审核的流程 + * 1. 删除审核的流程 * 2. 更新申请记录的状态 */ public function cancel(WorkflowCheck $check) { - $check->logs()->whereIn('check_status', [CheckStatus::None, CheckStatus::Processing])->delete(); + $check->logs()->delete(); $check->update([ 'check_status' => CheckStatus::Cancel, + 'check_value' => null, + 'check_name' => null, + 'check_type' => null, ]); $check->subject->checkCancel(); @@ -159,6 +161,7 @@ class WorkFlowService extends BaseService $log->update($attributes); $check = $log->check; + $check->update(['check_name' => $user->name]); if ($status) { return $this->next($check); } else { @@ -175,8 +178,13 @@ class WorkFlowService extends BaseService { $log = $check->logs()->where('check_status', CheckStatus::None)->orderBy('sort')->first(); if ($log) { + $check->update([ + 'check_value' => $log->check_value, + 'check_name' => $log->check_name, + 'check_type' => $log->check_type, + ]); $log->update(['check_status' => CheckStatus::Processing]); - // 申请人自动审核通过 + // 自动审核通过 if ($this->authCheck($check->employee, $log)) { return $this->check($check->employee, $log, true, ['remarks' => '自动审核通过']); } @@ -190,15 +198,19 @@ class WorkFlowService extends BaseService /** * 是否有权限审核 + * 1. 申请人 == 审核人 + * 2. 申请人的职位 高于 审核人职位 */ public function authCheck(Employee $user, WorkflowLog $log) { - // if ($user->adminUser?->isAdministrator()) { - // return true; - // } + if ($user->adminUser?->isAdministrator()) { + return true; + } $checkValue = [$user->id]; - if ($user->jobs) { - foreach($user->jobs as $item) { + if ($user->jobs && $user->jobs->count() > 0) { + $max = $user->jobs->max('sort'); + $jobs = Keyword::where('parent_key', 'job')->where('sort', '<', $max)->get(); + foreach($user->jobs->merge($jobs) as $item) { array_push($checkValue, $user->store_id . '-' . $item->key); } } diff --git a/app/Admin/routes.php b/app/Admin/routes.php index 413751f..21a5356 100644 --- a/app/Admin/routes.php +++ b/app/Admin/routes.php @@ -212,7 +212,7 @@ Route::group([ $router->post('agreement/download', [AgreementController::class, 'download'])->name('agreement.download'); $router->resource('agreement', AgreementController::class); - //修改上传 + // 修改上传 $router->post('upload_file', [\App\Admin\Controllers\IndexController::class, 'uploadFile']); $router->post('upload_image', [\App\Admin\Controllers\IndexController::class, 'uploadImage']); $router->post('upload_rich', [\App\Admin\Controllers\IndexController::class, 'uploadRich']); diff --git a/app/Models/EmployeePromotion.php b/app/Models/EmployeePromotion.php index ada2aed..51fe428 100644 --- a/app/Models/EmployeePromotion.php +++ b/app/Models/EmployeePromotion.php @@ -23,8 +23,6 @@ class EmployeePromotion extends Model 'employee_data' => 'json', ]; - protected $appends = ['can_update']; - public function modelFilter() { return \App\Admin\Filters\EmployeePromotionFilter::class; @@ -52,11 +50,6 @@ class EmployeePromotion extends Model return in_array($this->promotion_status, [PromotionStatus::Employee, PromotionStatus::Invitor, PromotionStatus::Fail]); } - public function getCanUpdateAttribute() - { - return $this->canUpdate(); - } - public function store() { return $this->belongsTo(Store::class, 'store_id'); diff --git a/app/Models/EmployeeSignRepair.php b/app/Models/EmployeeSignRepair.php index 830db17..669d463 100644 --- a/app/Models/EmployeeSignRepair.php +++ b/app/Models/EmployeeSignRepair.php @@ -27,11 +27,6 @@ class EmployeeSignRepair extends Model 'sign_type' => SignType::class, ]; - public function canUpdate(): bool - { - return in_array($this->workflow?->check_status, [CheckStatus::None, CheckStatus::Fail, CheckStatus::Cancel]); - } - public function checkSuccess() { EmployeeSignService::make()->signDay($this->employee, $this->sign_time, $this->date, [ diff --git a/app/Models/Train/Book.php b/app/Models/Train/Book.php index f080eb0..ed6abf1 100644 --- a/app/Models/Train/Book.php +++ b/app/Models/Train/Book.php @@ -19,6 +19,7 @@ class Book extends Model protected $casts = [ 'type' => \App\Enums\BookType::class, + // [{id:"5ab12064fee5", name:"a.txt", value:"https://xx.com/a.txt", state:"uploaded"}] 'files' => 'json', ]; diff --git a/app/Models/WorkflowCheck.php b/app/Models/WorkflowCheck.php index 9d49a52..8a03fdd 100644 --- a/app/Models/WorkflowCheck.php +++ b/app/Models/WorkflowCheck.php @@ -18,12 +18,13 @@ class WorkflowCheck extends Model 'check_status' => CheckStatus::None, ]; - protected $fillable = ['subject_type', 'subject_id', 'subject_data', 'key', 'employee_id', 'check_status', 'checked_at', 'check_remarks']; + protected $fillable = ['subject_type', 'subject_id', 'subject_data', 'key', 'employee_id', 'check_status', 'checked_at', 'check_remarks', 'check_type', 'check_value', 'check_name']; protected $casts = [ 'subject_data' => 'json', 'check_status' => CheckStatus::class, 'checked_at' => 'datetime', + 'check_type' => CheckType::class, ]; public function modelFilter() diff --git a/config/admin.php b/config/admin.php index abf4eaf..f99d292 100644 --- a/config/admin.php +++ b/config/admin.php @@ -57,7 +57,6 @@ return [ ], ], 'except' => [ - ], ], diff --git a/database/migrations/2024_03_27_113404_create_workflows_table.php b/database/migrations/2024_03_27_113404_create_workflows_table.php index 2942f47..cc174d0 100644 --- a/database/migrations/2024_03_27_113404_create_workflows_table.php +++ b/database/migrations/2024_03_27_113404_create_workflows_table.php @@ -31,6 +31,11 @@ return new class extends Migration $table->unsignedInteger('check_status')->default(CheckStatus::None->value)->comment('审核状态'); $table->timestamp('checked_at')->nullable()->comment('审核通过时间'); $table->string('check_remarks')->nullable()->comment('审核未通过原因'); + + $table->string('check_type')->nullable()->comment('审核类型{job, user}'); + $table->string('check_value')->nullable()->comment('审核类型值'); + $table->string('check_name')->nullable()->comment('审核名称(展示用)'); + $table->timestamps(); $table->comment('审核申请'); }); diff --git a/database/seeders/AdminSeeder.php b/database/seeders/AdminSeeder.php index de75f3e..eeb9a3d 100644 --- a/database/seeders/AdminSeeder.php +++ b/database/seeders/AdminSeeder.php @@ -22,15 +22,15 @@ class AdminSeeder extends Seeder 'password' => bcrypt('admin'), 'name' => 'Administrator', ]); - // DB::table('employees')->truncate(); - // DB::table('employees')->insert([ - // 'name' => 'admin', - // 'phone' => '12345678900', - // 'admin_user_id' => 1, - // 'join_at' => $now, - // 'created_at' => $now, - // 'updated_at' => $now, - // ]); + DB::table('employees')->truncate(); + DB::table('employees')->insert([ + 'name' => 'admin', + 'phone' => '12345678900', + 'admin_user_id' => 1, + 'join_at' => $now, + 'created_at' => $now, + 'updated_at' => $now, + ]); // 创建初始角色 DB::table('admin_roles')->truncate(); diff --git a/database/seeders/WorkflowSeeder.php b/database/seeders/WorkflowSeeder.php index c5c3eec..76a2aa3 100644 --- a/database/seeders/WorkflowSeeder.php +++ b/database/seeders/WorkflowSeeder.php @@ -13,10 +13,10 @@ class WorkflowSeeder extends Seeder public function run(): void { $now = now(); - // $config = json_encode([ - // ['sort' => 1, 'type' => 'user', 'user' => 1, 'title' => '员工', 'value' => 1, 'subTitle' => 'Admin'], - // ]); - $config = null; + $config = json_encode([ + ['sort' => 1, 'type' => 'user', 'user' => 1, 'title' => '员工', 'value' => 1, 'subTitle' => 'Admin'], + ]); + // $config = null; Workflow::truncate(); Workflow::insert([ ['key' => 'employee_sign_repair', 'name' => '补卡申请', 'config' => $config, 'created_at' => now(), 'updated_at' => now()],