generated from liutk/owl-admin-base
审批状态-待提审
parent
d591be918b
commit
fe3ea9d90b
|
|
@ -67,10 +67,10 @@ class HolidayController extends AdminController
|
|||
$this->rowShowButton()->visible(Admin::user()->can('admin.hr.holiday.view')),
|
||||
$this->rowEditTypeButton('drawer', 'xl')
|
||||
->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.')}'),
|
||||
->visibleOn('${OR(workflow.check_status == '.CheckStatus::Pending->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.')}'),
|
||||
->visibleOn('${OR(workflow.check_status == '.CheckStatus::Pending->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'),
|
||||
$this->applyAction(),
|
||||
$this->cancelAction(),
|
||||
]),
|
||||
|
|
@ -144,4 +144,4 @@ class HolidayController extends AdminController
|
|||
]
|
||||
])->body([$detail, amisMake()->Divider(), $table]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ class OfficalBusinessController extends AdminController
|
|||
$this->rowShowButton()->visible(Admin::user()->can('admin.hr.business.view')),
|
||||
$this->rowEditTypeButton('drawer', 'xl')
|
||||
->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.')}'),
|
||||
->visibleOn('${OR(workflow.check_status == '.CheckStatus::Pending->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.')}'),
|
||||
->visibleOn('${OR(workflow.check_status == '.CheckStatus::Pending->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'),
|
||||
$this->applyAction(),
|
||||
$this->cancelAction(),
|
||||
]),
|
||||
|
|
@ -131,4 +131,4 @@ class OfficalBusinessController extends AdminController
|
|||
]
|
||||
])->body([$detail, amisMake()->Divider(), $table]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,10 +62,10 @@ class OvertimeController extends AdminController
|
|||
$this->rowShowButton()->visible(Admin::user()->can('admin.hr.overtime.view')),
|
||||
$this->rowEditTypeButton('drawer', 'xl')
|
||||
->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.')}'),
|
||||
->visibleOn('${OR(workflow.check_status == '.CheckStatus::Pending->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.')}'),
|
||||
->visibleOn('${OR(workflow.check_status == '.CheckStatus::Pending->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'),
|
||||
$this->applyAction(),
|
||||
$this->cancelAction(),
|
||||
]),
|
||||
|
|
@ -133,4 +133,4 @@ class OvertimeController extends AdminController
|
|||
]
|
||||
])->body([$detail, amisMake()->Divider(), $table]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ class SignRepairController extends AdminController
|
|||
$this->rowShowButton()->visible(Admin::user()->can('admin.hr.repairs.view')),
|
||||
$this->rowEditTypeButton('drawer', 'xl')
|
||||
->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.')}'),
|
||||
->visibleOn('${OR(workflow.check_status == '.CheckStatus::Pending->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.')}'),
|
||||
->visibleOn('${OR(workflow.check_status == '.CheckStatus::Pending->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'),
|
||||
$this->applyAction(),
|
||||
$this->cancelAction(),
|
||||
])
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ class WorkFlowService extends BaseService
|
|||
* 发起审核申请
|
||||
* 1. 待审核 Model 实现 Checkable
|
||||
* 2. 生成全部的审核流程
|
||||
*
|
||||
*
|
||||
* @param WorkflowCheck $check 待审核记录
|
||||
* @param Employee $user 申请人
|
||||
*
|
||||
*
|
||||
* @return boolean true: 成功, false: 失败, $this->getError(): 错误消息
|
||||
*/
|
||||
public function apply(WorkflowCheck $check, Employee $user)
|
||||
|
|
@ -110,11 +110,11 @@ class WorkFlowService extends BaseService
|
|||
* 取消审核
|
||||
* 1. 删除未审核的流程
|
||||
* 2. 更新申请记录的状态
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function cancel(WorkflowCheck $check)
|
||||
{
|
||||
$check->logs()->whereIn('check_status', [CheckStatus::None, CheckStatus::Processing])->delete();
|
||||
$check->logs()->whereIn('check_status', [CheckStatus::Pending, CheckStatus::Processing])->delete();
|
||||
$check->update([
|
||||
'check_status' => CheckStatus::Cancel,
|
||||
]);
|
||||
|
|
@ -124,7 +124,7 @@ class WorkFlowService extends BaseService
|
|||
|
||||
/**
|
||||
* 审核单个流程
|
||||
*
|
||||
*
|
||||
* @param Employee $user 审核人
|
||||
* @param WorkflowLog $log 审核流水记录
|
||||
* @param boolean $status 通过/不通过
|
||||
|
|
@ -155,13 +155,13 @@ class WorkFlowService extends BaseService
|
|||
|
||||
/**
|
||||
* 开启下一个审核流程
|
||||
*
|
||||
*
|
||||
* @param WorkflowCheck $check
|
||||
* @return boolean
|
||||
*/
|
||||
public function next(WorkflowCheck $check)
|
||||
{
|
||||
$log = $check->logs()->where('check_status', CheckStatus::None)->orderBy('sort')->first();
|
||||
$log = $check->logs()->where('check_status', CheckStatus::Pending)->orderBy('sort')->first();
|
||||
if ($log) {
|
||||
$log->update(['check_status' => CheckStatus::Processing]);
|
||||
// 申请人自动审核通过
|
||||
|
|
|
|||
|
|
@ -7,10 +7,14 @@ namespace App\Enums;
|
|||
*/
|
||||
enum CheckStatus: int
|
||||
{
|
||||
/**
|
||||
* 待提审
|
||||
*/
|
||||
case None = 0;
|
||||
/**
|
||||
* 待审核
|
||||
*/
|
||||
case None = 1;
|
||||
case Pending = 1;
|
||||
/**
|
||||
* 审核中
|
||||
*/
|
||||
|
|
@ -31,7 +35,8 @@ enum CheckStatus: int
|
|||
public static function options(): array
|
||||
{
|
||||
return [
|
||||
self::None->value => '待审核',
|
||||
self::None->value => '待提审',
|
||||
self::Pending->value => '待审核',
|
||||
self::Processing->value => '审核中',
|
||||
self::Success->value => '审核通过',
|
||||
self::Fail->value => '审核不通过',
|
||||
|
|
|
|||
|
|
@ -15,7 +15,11 @@ use EloquentFilter\Filterable;
|
|||
class WorkflowCheck extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, Filterable;
|
||||
|
||||
|
||||
protected $attributes = [
|
||||
'check_status' => CheckStatus::Pending,
|
||||
];
|
||||
|
||||
protected $fillable = ['subject_type', 'subject_id', 'subject_data', 'key', 'employee_id', 'check_status', 'checked_at', 'check_remarks'];
|
||||
|
||||
protected $casts = [
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ trait HasCheckActions
|
|||
'user' => '${employee_id}',
|
||||
]))
|
||||
->confirmText(__('admin.confirm'))
|
||||
->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}');
|
||||
->visibleOn('${OR(workflow.check_status == '.CheckStatus::Pending->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ return new class extends Migration
|
|||
$table->morphs('subject');
|
||||
$table->json('subject_data')->nullable('审核内容');
|
||||
$table->foreignId('employee_id')->nullable()->comment('申请人, employees.id');
|
||||
$table->unsignedInteger('check_status')->default(CheckStatus::None->value)->comment('审核状态');
|
||||
$table->unsignedInteger('check_status')->default(CheckStatus::Pending->value)->comment('审核状态');
|
||||
$table->timestamp('checked_at')->nullable()->comment('审核通过时间');
|
||||
$table->string('check_remarks')->nullable()->comment('审核未通过原因');
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ return new class extends Migration
|
|||
$table->unsignedBigInteger('check_user_id')->nullable()->comment('实际审核人(admin_users.id)');
|
||||
$table->timestamp('checked_at')->nullable()->comment('审核时间');
|
||||
$table->string('remarks')->nullable()->comment('审核备注');
|
||||
$table->unsignedTinyInteger('check_status')->default(CheckStatus::None->value)->comment('审核状态');
|
||||
$table->unsignedTinyInteger('check_status')->default(CheckStatus::Pending->value)->comment('审核状态');
|
||||
$table->unsignedInteger('sort')->default(0)->comment('顺序(asc)');
|
||||
$table->timestamps();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue