table repair_type => sign_time

main
panliang 2024-04-18 12:41:42 +08:00
parent afa6924680
commit b5adac501f
6 changed files with 12 additions and 12 deletions

View File

@ -57,7 +57,7 @@ class SignRepairController extends AdminController
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('repair_type')->label(__('employee_sign_repair.repair_type'))
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'))
@ -96,7 +96,7 @@ class SignRepairController extends AdminController
->label(__('employee_sign_repair.date'))
->maxDate('now')
->required(),
amisMake()->SelectControl()->options(SignTime::options())->name('repair_type')->label(__('employee_sign_repair.repair_type'))->required(),
amisMake()->SelectControl()->options(SignTime::options())->name('sign_time')->label(__('employee_sign_repair.sign_time'))->required(),
amisMake()->TextControl()->name('reason')->label(__('employee_sign_repair.reason'))->required(),
]);
}
@ -110,7 +110,7 @@ class SignRepairController extends AdminController
['label' => __('employee_sign_repair.store_id'), 'content' => '${store.title}'],
['label' => __('employee_sign_repair.employee_id'), 'content' => '${employee.name}'],
['label' => __('employee_sign_repair.date'), 'content' => '${date}'],
['label' => __('employee_sign_repair.repair_type'), 'content' => amisMake()->Mapping()->name('repair_type')->map(SignTime::options())],
['label' => __('employee_sign_repair.sign_time'), 'content' => amisMake()->Mapping()->name('sign_time')->map(SignTime::options())],
['label' => __('employee_sign_repair.reason'), 'content' => '${reason}'],
['label' => __('employee_sign_repair.created_at'), 'content' => '${created_at}'],
['label' => __('workflow_log.check_status'), 'content' => amisMake()->Mapping()->name('workflow.check_status')->map(CheckStatus::options())],

View File

@ -31,7 +31,7 @@ class EmployeeSignRepairService extends BaseService
{
$createRules = [
'employee_id' => ['required'],
'repair_type' => ['required'],
'sign_time' => ['required'],
'date' => ['required'],
'store_id' => ['required'],
'reason' => ['required'],
@ -43,7 +43,7 @@ class EmployeeSignRepairService extends BaseService
'store_id.required' => __('employee_sign_repair.store_id').'必填',
'employee_id.required' => __('employee_sign_repair.employee_id').'必填',
'reason.required' => __('employee_sign_repair.reason').'必填',
'repair_type.required' => __('employee_sign_repair.repair_type').'必填',
'sign_time.required' => __('employee_sign_repair.sign_time').'必填',
'date.unique' => __('employee_sign_repair.date').' 已经申请过了',
];
$validator = Validator::make($data, $model ? $updateRules : $createRules, $message);
@ -53,7 +53,7 @@ class EmployeeSignRepairService extends BaseService
if (EmployeeSignLog::filter([
'date' => $data['date'],
'employee_id' => $data['employee_id'],
'sign_time' => $data['repair_type']
'sign_time' => $data['sign_time']
])->exists()) {
return '已经打过卡了';
}

View File

@ -24,7 +24,7 @@ class EmployeeSignRepairResource extends JsonResource
'store' => StoreResource::make($this->whenLoaded('store')),
'reason' => $this->reason,
'repair_type' => $this->repair_type,
'sign_time' => $this->sign_time,
'sign_type' => $this->sign_type,
'outside_remarks' => $this->outside_remarks,
'created_at' => $this->created_at->timestamp,

View File

@ -19,11 +19,11 @@ class EmployeeSignRepair extends Model
protected $table = 'employee_sign_repairs';
protected $fillable = ['date', 'store_id', 'employee_id', 'reason', 'repair_type', 'sign_type', 'outside_remarks'];
protected $fillable = ['date', 'store_id', 'employee_id', 'reason', 'sign_time', 'sign_type', 'outside_remarks'];
protected $casts = [
'date' => 'datetime',
'repair_type' => SignTime::class,
'sign_time' => SignTime::class,
'sign_type' => SignType::class,
];
@ -34,7 +34,7 @@ class EmployeeSignRepair extends Model
public function checkSuccess()
{
EmployeeSignService::make()->signDay($this->employee, $this->repair_type, $this->date, [
EmployeeSignService::make()->signDay($this->employee, $this->sign_time, $this->date, [
'type' => $this->sign_type,
'remarks' => $this->reason,
'position' => ['address' => '无'],

View File

@ -58,7 +58,7 @@ return new class extends Migration
$table->foreignId('store_id')->comment('门店, stores.id');
$table->foreignId('employee_id')->comment('员工, employees.id');
$table->string('reason')->comment('补卡原因');
$table->unsignedInteger('repair_type')->default(SignTime::Morning)->comment('上班/下班');
$table->unsignedInteger('sign_time')->default(SignTime::Morning)->comment('上班/下班');
$table->unsignedInteger('sign_type')->default(SignType::Normal)->comment('类别(1: 正常打卡, 2: 外勤)');
$table->string('outside_remarks')->nullable()->comment('外勤备注');

View File

@ -9,7 +9,7 @@ return [
'store_id' => '门店',
'employee_id' => '员工',
'reason' => '补卡原因',
'repair_type' => '上班/下班',
'sign_time' => '上班/下班',
'check_status' => '审核状态',
'checked_at' => '审核通过时间',
'check_remarks' => '审核未通过原因',