generated from liutk/owl-admin-base
编码格式化
parent
6a27c971e6
commit
c68fe05a28
|
|
@ -36,7 +36,7 @@ class LedgerController extends AdminController
|
||||||
['label' => '类型', 'content' => $item->type?->name ?? '-'],
|
['label' => '类型', 'content' => $item->type?->name ?? '-'],
|
||||||
['label' => '销售', 'content' => $item->sales],
|
['label' => '销售', 'content' => $item->sales],
|
||||||
['label' => $item->ledger_item_type_id === 'ledger_item_type_other' ? '支出' : '兑奖', 'content' => $item->expenditure],
|
['label' => $item->ledger_item_type_id === 'ledger_item_type_other' ? '支出' : '兑奖', 'content' => $item->expenditure],
|
||||||
])->collapse()->all()
|
])->collapse()->all(),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ class SalesStatisticController extends AdminController
|
||||||
|
|
||||||
return $lotteryTypes->map(function ($lotteryType) use ($statistics) {
|
return $lotteryTypes->map(function ($lotteryType) use ($statistics) {
|
||||||
$statistic = $statistics->get($lotteryType->value);
|
$statistic = $statistics->get($lotteryType->value);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => $lotteryType->name,
|
'name' => $lotteryType->name,
|
||||||
'sales' => trim_zeros($statistic->sales ?? '0.00'),
|
'sales' => trim_zeros($statistic->sales ?? '0.00'),
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ class StoreStatisticController extends AdminController
|
||||||
|
|
||||||
return $stores->map(function ($store) use ($statistics) {
|
return $stores->map(function ($store) use ($statistics) {
|
||||||
$statistic = $statistics->get($store->id);
|
$statistic = $statistics->get($store->id);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'title' => $store->title,
|
'title' => $store->title,
|
||||||
'sales' => trim_zeros($statistic->sales ?? '0'),
|
'sales' => trim_zeros($statistic->sales ?? '0'),
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ namespace App\Admin\Controllers\Hr;
|
||||||
|
|
||||||
use App\Admin\Controllers\AdminController;
|
use App\Admin\Controllers\AdminController;
|
||||||
use App\Admin\Services\HolidayApplyService;
|
use App\Admin\Services\HolidayApplyService;
|
||||||
|
use App\Enums\CheckStatus;
|
||||||
|
use App\Enums\EmployeeStatus;
|
||||||
|
use App\Traits\HasCheckActions;
|
||||||
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Form;
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||||
use Slowlyo\OwlAdmin\Admin;
|
|
||||||
use App\Enums\{CheckStatus, EmployeeStatus};
|
|
||||||
use App\Models\HolidayApply;
|
|
||||||
use App\Traits\HasCheckActions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请假管理
|
* 请假管理
|
||||||
|
|
@ -127,8 +127,8 @@ class HolidayController extends AdminController
|
||||||
'inited' => [
|
'inited' => [
|
||||||
'actions' => [
|
'actions' => [
|
||||||
['actionType' => 'reload', 'componentId' => $serviceId],
|
['actionType' => 'reload', 'componentId' => $serviceId],
|
||||||
]
|
],
|
||||||
]
|
],
|
||||||
])->body([
|
])->body([
|
||||||
$detail,
|
$detail,
|
||||||
amisMake()->Divider(),
|
amisMake()->Divider(),
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ namespace App\Admin\Controllers\Hr;
|
||||||
|
|
||||||
use App\Admin\Controllers\AdminController;
|
use App\Admin\Controllers\AdminController;
|
||||||
use App\Admin\Services\OfficalBusinessService;
|
use App\Admin\Services\OfficalBusinessService;
|
||||||
|
use App\Enums\CheckStatus;
|
||||||
|
use App\Enums\EmployeeStatus;
|
||||||
|
use App\Traits\HasCheckActions;
|
||||||
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Form;
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||||
use Slowlyo\OwlAdmin\Admin;
|
|
||||||
use App\Enums\{CheckStatus, EmployeeStatus};
|
|
||||||
use App\Models\OfficalBusiness;
|
|
||||||
use App\Traits\HasCheckActions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 出差报备
|
* 出差报备
|
||||||
|
|
@ -114,8 +114,8 @@ class OfficalBusinessController extends AdminController
|
||||||
'inited' => [
|
'inited' => [
|
||||||
'actions' => [
|
'actions' => [
|
||||||
['actionType' => 'reload', 'componentId' => $serviceId],
|
['actionType' => 'reload', 'componentId' => $serviceId],
|
||||||
]
|
],
|
||||||
]
|
],
|
||||||
])->body([
|
])->body([
|
||||||
$detail,
|
$detail,
|
||||||
amisMake()->Divider(),
|
amisMake()->Divider(),
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ namespace App\Admin\Controllers\Hr;
|
||||||
|
|
||||||
use App\Admin\Controllers\AdminController;
|
use App\Admin\Controllers\AdminController;
|
||||||
use App\Admin\Services\OvertimeApplyService;
|
use App\Admin\Services\OvertimeApplyService;
|
||||||
|
use App\Enums\CheckStatus;
|
||||||
|
use App\Enums\EmployeeStatus;
|
||||||
|
use App\Traits\HasCheckActions;
|
||||||
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Form;
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||||
use Slowlyo\OwlAdmin\Admin;
|
|
||||||
use App\Enums\{CheckStatus, EmployeeStatus};
|
|
||||||
use App\Models\OvertimeApply;
|
|
||||||
use App\Traits\HasCheckActions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加班管理
|
* 加班管理
|
||||||
|
|
@ -116,8 +116,8 @@ class OvertimeController extends AdminController
|
||||||
'inited' => [
|
'inited' => [
|
||||||
'actions' => [
|
'actions' => [
|
||||||
['actionType' => 'reload', 'componentId' => $serviceId],
|
['actionType' => 'reload', 'componentId' => $serviceId],
|
||||||
]
|
],
|
||||||
]
|
],
|
||||||
])->body([
|
])->body([
|
||||||
$detail,
|
$detail,
|
||||||
amisMake()->Divider(),
|
amisMake()->Divider(),
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ namespace App\Admin\Controllers\Hr;
|
||||||
|
|
||||||
use App\Admin\Controllers\AdminController;
|
use App\Admin\Controllers\AdminController;
|
||||||
use App\Admin\Services\EmployeePromotionService;
|
use App\Admin\Services\EmployeePromotionService;
|
||||||
|
use App\Enums\EmployeeStatus;
|
||||||
|
use App\Enums\PromotionStatus;
|
||||||
|
use App\Traits\HasCheckActions;
|
||||||
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Form;
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||||
use Slowlyo\OwlAdmin\Admin;
|
|
||||||
use App\Enums\{CheckStatus, PromotionStatus, EmployeeStatus};
|
|
||||||
use App\Models\EmployeePromotion;
|
|
||||||
use App\Traits\HasCheckActions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 升职申请
|
* 升职申请
|
||||||
|
|
@ -125,8 +125,8 @@ class PromotionController extends AdminController
|
||||||
'inited' => [
|
'inited' => [
|
||||||
'actions' => [
|
'actions' => [
|
||||||
['actionType' => 'reload', 'componentId' => $serviceId],
|
['actionType' => 'reload', 'componentId' => $serviceId],
|
||||||
]
|
],
|
||||||
]
|
],
|
||||||
])->body([
|
])->body([
|
||||||
$detail,
|
$detail,
|
||||||
amisMake()->Divider(),
|
amisMake()->Divider(),
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ namespace App\Admin\Controllers\Hr;
|
||||||
use App\Admin\Controllers\AdminController;
|
use App\Admin\Controllers\AdminController;
|
||||||
use App\Admin\Services\EmployeeRestService;
|
use App\Admin\Services\EmployeeRestService;
|
||||||
use App\Enums\EmployeeStatus;
|
use App\Enums\EmployeeStatus;
|
||||||
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Form;
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||||
use Slowlyo\OwlAdmin\Admin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 休息管理
|
* 休息管理
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,12 @@ namespace App\Admin\Controllers\Hr;
|
||||||
|
|
||||||
use App\Admin\Controllers\AdminController;
|
use App\Admin\Controllers\AdminController;
|
||||||
use App\Admin\Services\EmployeeSignService;
|
use App\Admin\Services\EmployeeSignService;
|
||||||
|
use App\Enums\SignStatus;
|
||||||
|
use App\Enums\SignTime;
|
||||||
|
use App\Enums\SignType;
|
||||||
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Form;
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||||
use Slowlyo\OwlAdmin\Admin;
|
|
||||||
use App\Enums\{SignType, SignStatus, SignTime};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考勤打卡
|
* 考勤打卡
|
||||||
|
|
@ -86,12 +88,13 @@ class SignController extends AdminController
|
||||||
amisMake()->TableColumn()->name('position.address')->label(__('employee_sign_log.position')),
|
amisMake()->TableColumn()->name('position.address')->label(__('employee_sign_log.position')),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->baseDetail()->title('')->onEvent([
|
return $this->baseDetail()->title('')->onEvent([
|
||||||
'inited' => [
|
'inited' => [
|
||||||
'actions' => [
|
'actions' => [
|
||||||
['actionType' => 'reload', 'componentId' => 'employee-sign-log-table'],
|
['actionType' => 'reload', 'componentId' => 'employee-sign-log-table'],
|
||||||
]
|
],
|
||||||
]
|
],
|
||||||
])->body([$detail, amisMake()->Divider()->title(__('employee_sign.log')), $logs]);
|
])->body([$detail, amisMake()->Divider()->title(__('employee_sign.log')), $logs]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,6 +102,7 @@ class SignController extends AdminController
|
||||||
{
|
{
|
||||||
$type = SignType::options();
|
$type = SignType::options();
|
||||||
$status = SignStatus::options();
|
$status = SignStatus::options();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
__('employee_sign.date') => data_get($row, 'date'),
|
__('employee_sign.date') => data_get($row, 'date'),
|
||||||
__('employee_sign.store_id') => data_get($row, 'store.title'),
|
__('employee_sign.store_id') => data_get($row, 'store.title'),
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ class SignLogController extends AdminController
|
||||||
{
|
{
|
||||||
$with = $request->input('with', []);
|
$with = $request->input('with', []);
|
||||||
$list = EmployeeSignLog::with($with)->filter($request->all())->orderBy('time', 'asc')->get();
|
$list = EmployeeSignLog::with($with)->filter($request->all())->orderBy('time', 'asc')->get();
|
||||||
|
|
||||||
return $this->response()->success($list);
|
return $this->response()->success($list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,13 @@ namespace App\Admin\Controllers\Hr;
|
||||||
|
|
||||||
use App\Admin\Controllers\AdminController;
|
use App\Admin\Controllers\AdminController;
|
||||||
use App\Admin\Services\EmployeeSignRepairService;
|
use App\Admin\Services\EmployeeSignRepairService;
|
||||||
|
use App\Enums\CheckStatus;
|
||||||
|
use App\Enums\EmployeeStatus;
|
||||||
|
use App\Enums\SignTime;
|
||||||
|
use App\Traits\HasCheckActions;
|
||||||
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Form;
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
||||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||||
use Slowlyo\OwlAdmin\Admin;
|
|
||||||
use App\Enums\{EmployeeStatus, SignTime, CheckStatus};
|
|
||||||
use App\Models\EmployeeSignRepair;
|
|
||||||
use App\Traits\HasCheckActions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 补卡申请
|
* 补卡申请
|
||||||
|
|
@ -48,7 +49,7 @@ class SignRepairController extends AdminController
|
||||||
amisMake()->SelectControl()->name('check_status')->label(__('employee_sign_repair.check_status'))
|
amisMake()->SelectControl()->name('check_status')->label(__('employee_sign_repair.check_status'))
|
||||||
->options(CheckStatus::options())
|
->options(CheckStatus::options())
|
||||||
->columnRatio(3)
|
->columnRatio(3)
|
||||||
->clearable()
|
->clearable(),
|
||||||
]),
|
]),
|
||||||
]))
|
]))
|
||||||
->columns([
|
->columns([
|
||||||
|
|
@ -72,7 +73,7 @@ class SignRepairController extends AdminController
|
||||||
->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::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'),
|
||||||
$this->applyAction(),
|
$this->applyAction(),
|
||||||
$this->cancelAction(),
|
$this->cancelAction(),
|
||||||
])
|
]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->baseList($crud);
|
return $this->baseList($crud);
|
||||||
|
|
@ -121,8 +122,8 @@ class SignRepairController extends AdminController
|
||||||
'inited' => [
|
'inited' => [
|
||||||
'actions' => [
|
'actions' => [
|
||||||
['actionType' => 'reload', 'componentId' => $serviceId],
|
['actionType' => 'reload', 'componentId' => $serviceId],
|
||||||
]
|
],
|
||||||
]
|
],
|
||||||
])->body([
|
])->body([
|
||||||
$detail,
|
$detail,
|
||||||
amisMake()->Divider(),
|
amisMake()->Divider(),
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ class AdminUserController extends AdminController
|
||||||
amis()->SwitchControl()->saveImmediately()->mode('inline')->disabledOn('${id === 1}')
|
amis()->SwitchControl()->saveImmediately()->mode('inline')->disabledOn('${id === 1}')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $column->type('status')->source([
|
return $column->type('status')->source([
|
||||||
0 => ['label' => '未锁定', 'icon' => 'fa fa-times-circle', 'color' => '#30bf13'],
|
0 => ['label' => '未锁定', 'icon' => 'fa fa-times-circle', 'color' => '#30bf13'],
|
||||||
1 => ['label' => '已锁定', 'icon' => 'fa fa-check-circle', 'color' => '#f70e47'],
|
1 => ['label' => '已锁定', 'icon' => 'fa fa-check-circle', 'color' => '#f70e47'],
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,10 @@ namespace App\Admin\Controllers\System;
|
||||||
use App\Admin\Controllers\AdminController;
|
use App\Admin\Controllers\AdminController;
|
||||||
use App\Admin\Services\WorkFlowService;
|
use App\Admin\Services\WorkFlowService;
|
||||||
use App\Enums\CheckType;
|
use App\Enums\CheckType;
|
||||||
|
use App\Models\Employee;
|
||||||
use App\Models\Keyword;
|
use App\Models\Keyword;
|
||||||
use App\Models\{Employee, WorkflowLog, WorkflowCheck};
|
use App\Models\WorkflowCheck;
|
||||||
|
use App\Models\WorkflowLog;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Slowlyo\OwlAdmin\Admin;
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
|
|
@ -113,9 +115,11 @@ class WorkflowController extends AdminController
|
||||||
return $this->response()->fail($this->service->getError());
|
return $this->response()->fail($this->service->getError());
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
|
|
||||||
return $this->response()->success();
|
return $this->response()->success();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
|
||||||
return $this->response()->fail($e->getMessage());
|
return $this->response()->fail($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -130,9 +134,11 @@ class WorkflowController extends AdminController
|
||||||
return $this->response()->fail($this->service->getError());
|
return $this->response()->fail($this->service->getError());
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
|
|
||||||
return $this->response()->success();
|
return $this->response()->success();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
|
||||||
return $this->response()->fail($e->getMessage());
|
return $this->response()->fail($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -151,9 +157,11 @@ class WorkflowController extends AdminController
|
||||||
return $this->response()->fail($this->service->getError());
|
return $this->response()->fail($this->service->getError());
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
|
|
||||||
return $this->response()->success();
|
return $this->response()->success();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
|
||||||
return $this->response()->fail($e->getMessage());
|
return $this->response()->fail($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -175,9 +183,11 @@ class WorkflowController extends AdminController
|
||||||
return $this->response()->fail($this->service->getError());
|
return $this->response()->fail($this->service->getError());
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
|
|
||||||
return $this->response()->success();
|
return $this->response()->success();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
|
||||||
return $this->response()->fail($e->getMessage());
|
return $this->response()->fail($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -185,6 +195,7 @@ class WorkflowController extends AdminController
|
||||||
public function logs(Request $request)
|
public function logs(Request $request)
|
||||||
{
|
{
|
||||||
$list = WorkflowLog::with(['checkUser'])->where('check_id', $request->input('id'))->sort()->get();
|
$list = WorkflowLog::with(['checkUser'])->where('check_id', $request->input('id'))->sort()->get();
|
||||||
|
|
||||||
return $this->response()->success($list);
|
return $this->response()->success($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace App\Admin\Filters;
|
namespace App\Admin\Filters;
|
||||||
|
|
||||||
use EloquentFilter\ModelFilter;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use EloquentFilter\ModelFilter;
|
||||||
|
|
||||||
class EmployeeSignLogFilter extends ModelFilter
|
class EmployeeSignLogFilter extends ModelFilter
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace App\Admin\Filters;
|
namespace App\Admin\Filters;
|
||||||
|
|
||||||
use EloquentFilter\ModelFilter;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use EloquentFilter\ModelFilter;
|
||||||
|
|
||||||
class EmployeeSignRepairFilter extends ModelFilter
|
class EmployeeSignRepairFilter extends ModelFilter
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Admin\Filters;
|
namespace App\Admin\Filters;
|
||||||
|
|
||||||
use EloquentFilter\ModelFilter;
|
use EloquentFilter\ModelFilter;
|
||||||
use Carbon\Carbon;
|
|
||||||
|
|
||||||
class HolidayApplyFilter extends ModelFilter
|
class HolidayApplyFilter extends ModelFilter
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace App\Admin\Filters;
|
namespace App\Admin\Filters;
|
||||||
|
|
||||||
use EloquentFilter\ModelFilter;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use EloquentFilter\ModelFilter;
|
||||||
|
|
||||||
class OfficalBusinessFilter extends ModelFilter
|
class OfficalBusinessFilter extends ModelFilter
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace App\Admin\Filters;
|
namespace App\Admin\Filters;
|
||||||
|
|
||||||
use EloquentFilter\ModelFilter;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use EloquentFilter\ModelFilter;
|
||||||
|
|
||||||
class OvertimeApplyFilter extends ModelFilter
|
class OvertimeApplyFilter extends ModelFilter
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Admin\Filters;
|
namespace App\Admin\Filters;
|
||||||
|
|
||||||
use EloquentFilter\ModelFilter;
|
use EloquentFilter\ModelFilter;
|
||||||
use Carbon\Carbon;
|
|
||||||
|
|
||||||
class WorkflowCheckFilter extends ModelFilter
|
class WorkflowCheckFilter extends ModelFilter
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
namespace App\Admin\Middleware;
|
namespace App\Admin\Middleware;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Slowlyo\OwlAdmin\Admin;
|
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
|
|
||||||
class Authenticate
|
class Authenticate
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,12 @@
|
||||||
namespace App\Admin\Services;
|
namespace App\Admin\Services;
|
||||||
|
|
||||||
use App\Admin\Filters\EmployeePromotionFilter;
|
use App\Admin\Filters\EmployeePromotionFilter;
|
||||||
use App\Models\{EmployeePromotion, Employee};
|
|
||||||
use Illuminate\Support\Facades\{Validator, DB};
|
|
||||||
use App\Admin\WorkflowService;
|
use App\Admin\WorkflowService;
|
||||||
use App\Enums\PromotionStatus;
|
use App\Enums\PromotionStatus;
|
||||||
|
use App\Models\Employee;
|
||||||
|
use App\Models\EmployeePromotion;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
class EmployeePromotionService extends BaseService
|
class EmployeePromotionService extends BaseService
|
||||||
{
|
{
|
||||||
|
|
@ -22,6 +24,7 @@ class EmployeePromotionService extends BaseService
|
||||||
if (isset($data['employee_id'])) {
|
if (isset($data['employee_id'])) {
|
||||||
$data['store_id'] = Employee::where('id', $data['employee_id'])->value('store_id');
|
$data['store_id'] = Employee::where('id', $data['employee_id'])->value('store_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,6 +85,7 @@ class EmployeePromotionService extends BaseService
|
||||||
DB::commit();
|
DB::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
|
||||||
return $this->setError($e->getMessage());
|
return $this->setError($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,6 +105,7 @@ class EmployeePromotionService extends BaseService
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return $validator->errors()->first();
|
return $validator->errors()->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,11 @@
|
||||||
namespace App\Admin\Services;
|
namespace App\Admin\Services;
|
||||||
|
|
||||||
use App\Admin\Filters\EmployeeSignRepairFilter;
|
use App\Admin\Filters\EmployeeSignRepairFilter;
|
||||||
use App\Models\{EmployeeSignRepair, WorkflowCheck};
|
|
||||||
use Illuminate\Validation\Rule;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use App\Models\Employee;
|
use App\Models\Employee;
|
||||||
use App\Enums\CheckStatus;
|
use App\Models\EmployeeSignRepair;
|
||||||
|
use App\Models\WorkflowCheck;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class EmployeeSignRepairService extends BaseService
|
class EmployeeSignRepairService extends BaseService
|
||||||
{
|
{
|
||||||
|
|
@ -40,6 +39,7 @@ class EmployeeSignRepairService extends BaseService
|
||||||
if (! isset($data['store_id']) && isset($data['employee_id'])) {
|
if (! isset($data['store_id']) && isset($data['employee_id'])) {
|
||||||
$data['store_id'] = Employee::where('id', $data['employee_id'])->value('store_id');
|
$data['store_id'] = Employee::where('id', $data['employee_id'])->value('store_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ class EmployeeSignRepairService extends BaseService
|
||||||
'reason' => ['required'],
|
'reason' => ['required'],
|
||||||
];
|
];
|
||||||
$updateRules = [
|
$updateRules = [
|
||||||
'date' => [$unique->ignore($model?->id)]
|
'date' => [$unique->ignore($model?->id)],
|
||||||
];
|
];
|
||||||
$message = [
|
$message = [
|
||||||
'date.required' => __('employee_sign_repair.date').'必填',
|
'date.required' => __('employee_sign_repair.date').'必填',
|
||||||
|
|
@ -72,12 +72,13 @@ class EmployeeSignRepairService extends BaseService
|
||||||
'employee_id.required' => __('employee_sign_repair.employee_id').'必填',
|
'employee_id.required' => __('employee_sign_repair.employee_id').'必填',
|
||||||
'reason.required' => __('employee_sign_repair.reason').'必填',
|
'reason.required' => __('employee_sign_repair.reason').'必填',
|
||||||
'repair_type.required' => __('employee_sign_repair.repair_type').'必填',
|
'repair_type.required' => __('employee_sign_repair.repair_type').'必填',
|
||||||
'date.unique' => __('employee_sign_repair.date') . ' 已经申请过了'
|
'date.unique' => __('employee_sign_repair.date').' 已经申请过了',
|
||||||
];
|
];
|
||||||
$validator = Validator::make($data, $model ? $updateRules : $createRules, $message);
|
$validator = Validator::make($data, $model ? $updateRules : $createRules, $message);
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return $validator->errors()->first();
|
return $validator->errors()->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@
|
||||||
namespace App\Admin\Services;
|
namespace App\Admin\Services;
|
||||||
|
|
||||||
use App\Admin\Filters\EmployeeSignFilter;
|
use App\Admin\Filters\EmployeeSignFilter;
|
||||||
use App\Models\EmployeeSign;
|
|
||||||
use App\Models\EmployeeSignLog;
|
|
||||||
use App\Models\EmployeeRest;
|
|
||||||
use App\Models\Employee;
|
|
||||||
use App\Enums\SignType;
|
|
||||||
use App\Enums\SignStatus;
|
use App\Enums\SignStatus;
|
||||||
use App\Enums\SignTime;
|
use App\Enums\SignTime;
|
||||||
|
use App\Enums\SignType;
|
||||||
|
use App\Models\Employee;
|
||||||
|
use App\Models\EmployeeRest;
|
||||||
|
use App\Models\EmployeeSign;
|
||||||
|
use App\Models\EmployeeSignLog;
|
||||||
|
|
||||||
class EmployeeSignService extends BaseService
|
class EmployeeSignService extends BaseService
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,10 @@
|
||||||
namespace App\Admin\Services;
|
namespace App\Admin\Services;
|
||||||
|
|
||||||
use App\Admin\Filters\HolidayApplyFilter;
|
use App\Admin\Filters\HolidayApplyFilter;
|
||||||
use App\Models\{HolidayApply, Employee};
|
use App\Models\Employee;
|
||||||
use Illuminate\Validation\Rule;
|
use App\Models\HolidayApply;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
class HolidayApplyService extends BaseService
|
class HolidayApplyService extends BaseService
|
||||||
{
|
{
|
||||||
|
|
@ -29,6 +28,7 @@ class HolidayApplyService extends BaseService
|
||||||
$data['start_at'] = Carbon::createFromFormat('Y-m-d', data_get($dates, 0))->startOfDay();
|
$data['start_at'] = Carbon::createFromFormat('Y-m-d', data_get($dates, 0))->startOfDay();
|
||||||
$data['end_at'] = Carbon::createFromFormat('Y-m-d', data_get($dates, 1))->endOfDay();
|
$data['end_at'] = Carbon::createFromFormat('Y-m-d', data_get($dates, 1))->endOfDay();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,6 +48,7 @@ class HolidayApplyService extends BaseService
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return $validator->errors()->first();
|
return $validator->errors()->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,11 +3,10 @@
|
||||||
namespace App\Admin\Services;
|
namespace App\Admin\Services;
|
||||||
|
|
||||||
use App\Admin\Filters\OfficalBusinessFilter;
|
use App\Admin\Filters\OfficalBusinessFilter;
|
||||||
use App\Models\{OfficalBusiness, Employee};
|
use App\Models\Employee;
|
||||||
use Illuminate\Validation\Rule;
|
use App\Models\OfficalBusiness;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
class OfficalBusinessService extends BaseService
|
class OfficalBusinessService extends BaseService
|
||||||
{
|
{
|
||||||
|
|
@ -30,6 +29,7 @@ class OfficalBusinessService extends BaseService
|
||||||
$data['start_at'] = $start;
|
$data['start_at'] = $start;
|
||||||
$data['end_at'] = $end;
|
$data['end_at'] = $end;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,6 +48,7 @@ class OfficalBusinessService extends BaseService
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return $validator->errors()->first();
|
return $validator->errors()->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,11 +3,10 @@
|
||||||
namespace App\Admin\Services;
|
namespace App\Admin\Services;
|
||||||
|
|
||||||
use App\Admin\Filters\OvertimeApplyFilter;
|
use App\Admin\Filters\OvertimeApplyFilter;
|
||||||
use App\Models\{OvertimeApply, Employee};
|
use App\Models\Employee;
|
||||||
use Illuminate\Validation\Rule;
|
use App\Models\OvertimeApply;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
class OvertimeApplyService extends BaseService
|
class OvertimeApplyService extends BaseService
|
||||||
{
|
{
|
||||||
|
|
@ -32,6 +31,7 @@ class OvertimeApplyService extends BaseService
|
||||||
$data['date'] = $start->format('Y-m-d');
|
$data['date'] = $start->format('Y-m-d');
|
||||||
$data['hours'] = $start->diffInHours($end);
|
$data['hours'] = $start->diffInHours($end);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,6 +49,7 @@ class OvertimeApplyService extends BaseService
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return $validator->errors()->first();
|
return $validator->errors()->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5,7 +5,6 @@ namespace App\Admin\Services;
|
||||||
use App\Admin\Filters\EmployeeFilter;
|
use App\Admin\Filters\EmployeeFilter;
|
||||||
use App\Models\Employee;
|
use App\Models\Employee;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Validation\Rule;
|
|
||||||
|
|
||||||
class StoreEmployeeService extends BaseService
|
class StoreEmployeeService extends BaseService
|
||||||
{
|
{
|
||||||
|
|
@ -45,14 +44,17 @@ class StoreEmployeeService extends BaseService
|
||||||
foreach ($employees as $employee) {
|
foreach ($employees as $employee) {
|
||||||
if ($employee->store_id > 0 && $employee->store_id != $storeId) {
|
if ($employee->store_id > 0 && $employee->store_id != $storeId) {
|
||||||
$this->setError($employee->name.' 已经有门店了');
|
$this->setError($employee->name.' 已经有门店了');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($employee->master_store_id > 0) {
|
if ($employee->master_store_id > 0) {
|
||||||
$this->setError($employee->name.' 已经是店长了');
|
$this->setError($employee->name.' 已经是店长了');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Employee::whereIn('id', $data['employee_id'])->update(['store_id' => $storeId]);
|
Employee::whereIn('id', $data['employee_id'])->update(['store_id' => $storeId]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,6 +62,7 @@ class StoreEmployeeService extends BaseService
|
||||||
{
|
{
|
||||||
$id = explode(',', $ids);
|
$id = explode(',', $ids);
|
||||||
Employee::whereIn('id', $id)->update(['store_id' => 0]);
|
Employee::whereIn('id', $id)->update(['store_id' => 0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -75,6 +78,7 @@ class StoreEmployeeService extends BaseService
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return $validator->errors()->first();
|
return $validator->errors()->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ namespace App\Admin\Services;
|
||||||
use App\Admin\Filters\StoreFilter;
|
use App\Admin\Filters\StoreFilter;
|
||||||
use App\Models\Employee;
|
use App\Models\Employee;
|
||||||
use App\Models\Store;
|
use App\Models\Store;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,17 @@
|
||||||
|
|
||||||
namespace App\Admin\Services;
|
namespace App\Admin\Services;
|
||||||
|
|
||||||
use App\Enums\{CheckType, CheckStatus};
|
use App\Contracts\Checkable;
|
||||||
use App\Models\{Employee, Store, Keyword, Workflow, WorkflowCheck, WorkflowLog};
|
use App\Enums\CheckStatus;
|
||||||
|
use App\Enums\CheckType;
|
||||||
|
use App\Models\Employee;
|
||||||
|
use App\Models\Keyword;
|
||||||
|
use App\Models\Store;
|
||||||
|
use App\Models\Workflow;
|
||||||
|
use App\Models\WorkflowCheck;
|
||||||
|
use App\Models\WorkflowLog;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
use App\Contracts\Checkable;
|
|
||||||
|
|
||||||
class WorkFlowService extends BaseService
|
class WorkFlowService extends BaseService
|
||||||
{
|
{
|
||||||
|
|
@ -23,8 +29,7 @@ class WorkFlowService extends BaseService
|
||||||
*
|
*
|
||||||
* @param WorkflowCheck $check 待审核记录
|
* @param WorkflowCheck $check 待审核记录
|
||||||
* @param Employee $user 申请人
|
* @param Employee $user 申请人
|
||||||
*
|
* @return bool true: 成功, false: 失败, $this->getError(): 错误消息
|
||||||
* @return boolean true: 成功, false: 失败, $this->getError(): 错误消息
|
|
||||||
*/
|
*/
|
||||||
public function apply(WorkflowCheck $check, Employee $user)
|
public function apply(WorkflowCheck $check, Employee $user)
|
||||||
{
|
{
|
||||||
|
|
@ -39,6 +44,7 @@ class WorkFlowService extends BaseService
|
||||||
// 没有配置审核流程, 直接通过
|
// 没有配置审核流程, 直接通过
|
||||||
if (! $workflow || ! $workflow->config) {
|
if (! $workflow || ! $workflow->config) {
|
||||||
$this->success();
|
$this->success();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$jobs = Keyword::where('parent_key', 'job')->get();
|
$jobs = Keyword::where('parent_key', 'job')->get();
|
||||||
|
|
@ -78,11 +84,12 @@ class WorkFlowService extends BaseService
|
||||||
'check_type' => $item['type'],
|
'check_type' => $item['type'],
|
||||||
'check_value' => $checkValue,
|
'check_value' => $checkValue,
|
||||||
'check_name' => $checkName,
|
'check_name' => $checkName,
|
||||||
'sort' => $item['sort']
|
'sort' => $item['sort'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// 开启第一个审核流程
|
// 开启第一个审核流程
|
||||||
$this->next($check);
|
$this->next($check);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,8 +98,9 @@ class WorkFlowService extends BaseService
|
||||||
$check->update([
|
$check->update([
|
||||||
'check_status' => CheckStatus::Success,
|
'check_status' => CheckStatus::Success,
|
||||||
'checked_at' => data_get($options, 'checked_at', now()),
|
'checked_at' => data_get($options, 'checked_at', now()),
|
||||||
'check_remarks' => data_get($options, 'remarks')
|
'check_remarks' => data_get($options, 'remarks'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,6 +111,7 @@ class WorkFlowService extends BaseService
|
||||||
'check_remarks' => data_get($options, 'remarks'),
|
'check_remarks' => data_get($options, 'remarks'),
|
||||||
'checked_at' => data_get($options, 'checked_at', now()),
|
'checked_at' => data_get($options, 'checked_at', now()),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +119,6 @@ class WorkFlowService extends BaseService
|
||||||
* 取消审核
|
* 取消审核
|
||||||
* 1. 删除未审核的流程
|
* 1. 删除未审核的流程
|
||||||
* 2. 更新申请记录的状态
|
* 2. 更新申请记录的状态
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function cancel(WorkflowCheck $check)
|
public function cancel(WorkflowCheck $check)
|
||||||
{
|
{
|
||||||
|
|
@ -127,9 +135,9 @@ class WorkFlowService extends BaseService
|
||||||
*
|
*
|
||||||
* @param Employee $user 审核人
|
* @param Employee $user 审核人
|
||||||
* @param WorkflowLog $log 审核流水记录
|
* @param WorkflowLog $log 审核流水记录
|
||||||
* @param boolean $status 通过/不通过
|
* @param bool $status 通过/不通过
|
||||||
* @param array $options {remarks: 不通过原因, time: 审核时间(默认当前时间)}
|
* @param array $options {remarks: 不通过原因, time: 审核时间(默认当前时间)}
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function check(Employee $user, WorkflowLog $log, $status, $options = [])
|
public function check(Employee $user, WorkflowLog $log, $status, $options = [])
|
||||||
{
|
{
|
||||||
|
|
@ -156,8 +164,7 @@ class WorkFlowService extends BaseService
|
||||||
/**
|
/**
|
||||||
* 开启下一个审核流程
|
* 开启下一个审核流程
|
||||||
*
|
*
|
||||||
* @param WorkflowCheck $check
|
* @return bool
|
||||||
* @return boolean
|
|
||||||
*/
|
*/
|
||||||
public function next(WorkflowCheck $check)
|
public function next(WorkflowCheck $check)
|
||||||
{
|
{
|
||||||
|
|
@ -195,6 +202,7 @@ class WorkFlowService extends BaseService
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ use App\Admin\Controllers\Finance\StoreStatisticController;
|
||||||
use App\Admin\Controllers\Hr\EmployeeController;
|
use App\Admin\Controllers\Hr\EmployeeController;
|
||||||
use App\Admin\Controllers\Hr\HolidayController;
|
use App\Admin\Controllers\Hr\HolidayController;
|
||||||
use App\Admin\Controllers\Hr\OfficalBusinessController;
|
use App\Admin\Controllers\Hr\OfficalBusinessController;
|
||||||
use App\Admin\Controllers\Hr\PromotionController;
|
|
||||||
use App\Admin\Controllers\Hr\OvertimeController;
|
use App\Admin\Controllers\Hr\OvertimeController;
|
||||||
|
use App\Admin\Controllers\Hr\PromotionController;
|
||||||
use App\Admin\Controllers\Hr\RestController;
|
use App\Admin\Controllers\Hr\RestController;
|
||||||
use App\Admin\Controllers\Hr\SignController;
|
use App\Admin\Controllers\Hr\SignController;
|
||||||
use App\Admin\Controllers\Hr\SignLogController;
|
use App\Admin\Controllers\Hr\SignLogController;
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use App\Admin\Services\EmployeeSignService;
|
use App\Admin\Services\EmployeeSignService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class EmployeeSign extends Command
|
class EmployeeSign extends Command
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
class Complaint extends Model
|
class Complaint extends Model
|
||||||
{
|
{
|
||||||
use Filterable, HasFactory, HasDateTimeFormatter;
|
use Filterable, HasDateTimeFormatter, HasFactory;
|
||||||
|
|
||||||
protected $attributes = [
|
protected $attributes = [
|
||||||
'anonymous' => false,
|
'anonymous' => false,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||||
*/
|
*/
|
||||||
class Employee extends Model implements AuthenticatableContract
|
class Employee extends Model implements AuthenticatableContract
|
||||||
{
|
{
|
||||||
use Authenticatable, HasApiTokens, Filterable, HasDateTimeFormatter;
|
use Authenticatable, Filterable, HasApiTokens, HasDateTimeFormatter;
|
||||||
|
|
||||||
const JOB_KEY = 'job';
|
const JOB_KEY = 'job';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,18 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use App\Enums\PromotionStatus;
|
use App\Enums\PromotionStatus;
|
||||||
|
use App\Traits\HasCheckable;
|
||||||
use App\Traits\HasDateTimeFormatter;
|
use App\Traits\HasDateTimeFormatter;
|
||||||
use EloquentFilter\Filterable;
|
use EloquentFilter\Filterable;
|
||||||
use App\Traits\HasCheckable;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工升职申请
|
* 员工升职申请
|
||||||
*/
|
*/
|
||||||
class EmployeePromotion extends Model
|
class EmployeePromotion extends Model
|
||||||
{
|
{
|
||||||
use Filterable, HasDateTimeFormatter, HasCheckable;
|
use Filterable, HasCheckable, HasDateTimeFormatter;
|
||||||
|
|
||||||
protected $fillable = ['store_id', 'employee_id', 'invitor_id', 'job_id', 'promotion_status', 'employee_data', 'remarks'];
|
protected $fillable = ['store_id', 'employee_id', 'invitor_id', 'job_id', 'promotion_status', 'employee_data', 'remarks'];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,15 @@ namespace App\Models;
|
||||||
use App\Enums\SignStatus;
|
use App\Enums\SignStatus;
|
||||||
use App\Enums\SignType;
|
use App\Enums\SignType;
|
||||||
use App\Traits\HasDateTimeFormatter;
|
use App\Traits\HasDateTimeFormatter;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use EloquentFilter\Filterable;
|
use EloquentFilter\Filterable;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工-打卡情况
|
* 员工-打卡情况
|
||||||
*/
|
*/
|
||||||
class EmployeeSign extends Model
|
class EmployeeSign extends Model
|
||||||
{
|
{
|
||||||
use HasDateTimeFormatter, Filterable;
|
use Filterable, HasDateTimeFormatter;
|
||||||
|
|
||||||
protected $table = 'employee_sign_dates';
|
protected $table = 'employee_sign_dates';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Enums\{SignType, SignTime};
|
use App\Enums\SignTime;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use App\Enums\SignType;
|
||||||
use App\Traits\HasDateTimeFormatter;
|
use App\Traits\HasDateTimeFormatter;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use EloquentFilter\Filterable;
|
use EloquentFilter\Filterable;
|
||||||
use App\Admin\Filters\EmployeeSignLogFilter;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工-打卡流水
|
* 员工-打卡流水
|
||||||
*/
|
*/
|
||||||
class EmployeeSignLog extends Model
|
class EmployeeSignLog extends Model
|
||||||
{
|
{
|
||||||
use HasDateTimeFormatter, HasFactory, Filterable;
|
use Filterable, HasDateTimeFormatter, HasFactory;
|
||||||
|
|
||||||
protected $table = 'employee_sign_logs';
|
protected $table = 'employee_sign_logs';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,18 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use App\Enums\{SignTime};
|
use App\Enums\{SignTime};
|
||||||
|
use App\Traits\HasCheckable;
|
||||||
use App\Traits\HasDateTimeFormatter;
|
use App\Traits\HasDateTimeFormatter;
|
||||||
use EloquentFilter\Filterable;
|
use EloquentFilter\Filterable;
|
||||||
use App\Traits\HasCheckable;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 补卡申请
|
* 补卡申请
|
||||||
*/
|
*/
|
||||||
class EmployeeSignRepair extends Model
|
class EmployeeSignRepair extends Model
|
||||||
{
|
{
|
||||||
use HasDateTimeFormatter, Filterable, HasCheckable;
|
use Filterable, HasCheckable, HasDateTimeFormatter;
|
||||||
|
|
||||||
protected $table = 'employee_sign_repairs';
|
protected $table = 'employee_sign_repairs';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
class Feedback extends Model
|
class Feedback extends Model
|
||||||
{
|
{
|
||||||
use Filterable, HasFactory, HasDateTimeFormatter;
|
use Filterable, HasDateTimeFormatter, HasFactory;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'employee_id', 'content',
|
'employee_id', 'content',
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use App\Enums\{CheckStatus};
|
||||||
use App\Traits\HasCheckable;
|
use App\Traits\HasCheckable;
|
||||||
use App\Traits\HasDateTimeFormatter;
|
use App\Traits\HasDateTimeFormatter;
|
||||||
use EloquentFilter\Filterable;
|
use EloquentFilter\Filterable;
|
||||||
use App\Enums\{CheckStatus};
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请假申请
|
* 请假申请
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
class Ledger extends Model
|
class Ledger extends Model
|
||||||
{
|
{
|
||||||
use Filterable, HasDateTimeFormatter, HasFactory, HasCheckable;
|
use Filterable, HasCheckable, HasDateTimeFormatter, HasFactory;
|
||||||
|
|
||||||
protected $appends = ['ledger_difference'];
|
protected $appends = ['ledger_difference'];
|
||||||
|
|
||||||
|
|
@ -53,6 +53,7 @@ class Ledger extends Model
|
||||||
if (is_numeric($attributes['ledger_amount'])) {
|
if (is_numeric($attributes['ledger_amount'])) {
|
||||||
return bcsub($attributes['handover_amount'], $attributes['ledger_amount'], 2);
|
return bcsub($attributes['handover_amount'], $attributes['ledger_amount'], 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ namespace App\Models;
|
||||||
|
|
||||||
use App\Traits\HasDateTimeFormatter;
|
use App\Traits\HasDateTimeFormatter;
|
||||||
use EloquentFilter\Filterable;
|
use EloquentFilter\Filterable;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,18 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use App\Enums\{CheckStatus};
|
||||||
use App\Traits\HasCheckable;
|
use App\Traits\HasCheckable;
|
||||||
use App\Traits\HasDateTimeFormatter;
|
use App\Traits\HasDateTimeFormatter;
|
||||||
use EloquentFilter\Filterable;
|
use EloquentFilter\Filterable;
|
||||||
use App\Enums\{CheckStatus};
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 出差报备
|
* 出差报备
|
||||||
*/
|
*/
|
||||||
class OfficalBusiness extends Model
|
class OfficalBusiness extends Model
|
||||||
{
|
{
|
||||||
use HasCheckable, HasDateTimeFormatter, Filterable;
|
use Filterable, HasCheckable, HasDateTimeFormatter;
|
||||||
|
|
||||||
protected $table = 'offical_business';
|
protected $table = 'offical_business';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,18 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use App\Enums\{CheckStatus};
|
||||||
use App\Traits\HasCheckable;
|
use App\Traits\HasCheckable;
|
||||||
use App\Traits\HasDateTimeFormatter;
|
use App\Traits\HasDateTimeFormatter;
|
||||||
use EloquentFilter\Filterable;
|
use EloquentFilter\Filterable;
|
||||||
use App\Enums\{CheckStatus};
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加班申请
|
* 加班申请
|
||||||
*/
|
*/
|
||||||
class OvertimeApply extends Model
|
class OvertimeApply extends Model
|
||||||
{
|
{
|
||||||
use Filterable, HasDateTimeFormatter, HasCheckable;
|
use Filterable, HasCheckable, HasDateTimeFormatter;
|
||||||
|
|
||||||
protected $fillable = ['store_id', 'employee_id', 'date', 'start_at', 'end_at', 'hours', 'reason'];
|
protected $fillable = ['store_id', 'employee_id', 'date', 'start_at', 'end_at', 'hours', 'reason'];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
class Reimbursement extends Model
|
class Reimbursement extends Model
|
||||||
{
|
{
|
||||||
use Filterable, HasDateTimeFormatter, HasFactory, HasCheckable;
|
use Filterable, HasCheckable, HasDateTimeFormatter, HasFactory;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'employee_id',
|
'employee_id',
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ use App\Enums\BusinessStatus;
|
||||||
use App\Traits\HasDateTimeFormatter;
|
use App\Traits\HasDateTimeFormatter;
|
||||||
use EloquentFilter\Filterable;
|
use EloquentFilter\Filterable;
|
||||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 门店
|
* 门店
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Enums\StoreMasterCommissionApprovalStatus;
|
|
||||||
use App\Traits\HasCheckable;
|
use App\Traits\HasCheckable;
|
||||||
use App\Traits\HasDateTimeFormatter;
|
use App\Traits\HasDateTimeFormatter;
|
||||||
use EloquentFilter\Filterable;
|
use EloquentFilter\Filterable;
|
||||||
|
|
@ -12,7 +11,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
class StoreMasterCommission extends Model
|
class StoreMasterCommission extends Model
|
||||||
{
|
{
|
||||||
use Filterable, HasDateTimeFormatter, HasFactory, HasCheckable;
|
use Filterable, HasCheckable, HasDateTimeFormatter, HasFactory;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'month',
|
'month',
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,17 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use App\Models\Employee;
|
|
||||||
use App\Enums\CheckStatus;
|
use App\Enums\CheckStatus;
|
||||||
use App\Traits\HasDateTimeFormatter;
|
use App\Traits\HasDateTimeFormatter;
|
||||||
use EloquentFilter\Filterable;
|
use EloquentFilter\Filterable;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核申请
|
* 审核申请
|
||||||
*/
|
*/
|
||||||
class WorkflowCheck extends Model
|
class WorkflowCheck extends Model
|
||||||
{
|
{
|
||||||
use HasDateTimeFormatter, Filterable;
|
use Filterable, HasDateTimeFormatter;
|
||||||
|
|
||||||
protected $attributes = [
|
protected $attributes = [
|
||||||
'check_status' => CheckStatus::None,
|
'check_status' => CheckStatus::None,
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ trait HasCheckActions
|
||||||
->label('取消审核')
|
->label('取消审核')
|
||||||
->level('link')
|
->level('link')
|
||||||
->api(amisMake()->BaseApi()->url(admin_url('api/workflow/cancel'))->method('post')->data([
|
->api(amisMake()->BaseApi()->url(admin_url('api/workflow/cancel'))->method('post')->data([
|
||||||
'id' => '${workflow.id}'
|
'id' => '${workflow.id}',
|
||||||
]))
|
]))
|
||||||
->confirmText(__('admin.confirm'))
|
->confirmText(__('admin.confirm'))
|
||||||
->visibleOn('${workflow.check_status == '.CheckStatus::Processing->value.'}');
|
->visibleOn('${workflow.check_status == '.CheckStatus::Processing->value.'}');
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
namespace App\Traits;
|
namespace App\Traits;
|
||||||
|
|
||||||
use App\Enums\CheckStatus;
|
use App\Models\WorkflowCheck;
|
||||||
use App\Models\{WorkflowCheck, Employee};
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
trait HasCheckable
|
trait HasCheckable
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ if (! function_exists('trim_zeros')) {
|
||||||
$pos = strpos($var, '.');
|
$pos = strpos($var, '.');
|
||||||
if ($pos !== false) {
|
if ($pos !== false) {
|
||||||
if ($pos === 0) {
|
if ($pos === 0) {
|
||||||
$var = "0".$var;
|
$var = '0'.$var;
|
||||||
}
|
}
|
||||||
$var = rtrim(rtrim($var, '0'), '.');
|
$var = rtrim(rtrim($var, '0'), '.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ return [
|
||||||
'image' => 'temporary/images',
|
'image' => 'temporary/images',
|
||||||
'file' => 'temporary/file',
|
'file' => 'temporary/file',
|
||||||
'rich' => 'temporary/rich',
|
'rich' => 'temporary/rich',
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'https' => env('ADMIN_HTTPS', false),
|
'https' => env('ADMIN_HTTPS', false),
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,8 @@
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Enums\ComplaintStatus;
|
use App\Enums\ComplaintStatus;
|
||||||
use App\Models\Employee;
|
|
||||||
use App\Models\Complaint;
|
use App\Models\Complaint;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Complaint>
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Complaint>
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ class EmployeeFactory extends Factory
|
||||||
'password' => AdminUser::where('id', 1)->value('password'),
|
'password' => AdminUser::where('id', 1)->value('password'),
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'phone' => $phone,
|
'phone' => $phone,
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,11 @@
|
||||||
|
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use App\Enums\SignTime;
|
||||||
use App\Models\EmployeeSignLog;
|
use App\Enums\SignType;
|
||||||
use App\Models\Employee;
|
use App\Models\Employee;
|
||||||
use App\Enums\{SignType, SignTime};
|
use App\Models\EmployeeSignLog;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\EmployeeSign>
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\EmployeeSign>
|
||||||
|
|
@ -13,6 +14,7 @@ use App\Enums\{SignType, SignTime};
|
||||||
class EmployeeSignLogFactory extends Factory
|
class EmployeeSignLogFactory extends Factory
|
||||||
{
|
{
|
||||||
protected $model = EmployeeSignLog::class;
|
protected $model = EmployeeSignLog::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the model's default state.
|
* Define the model's default state.
|
||||||
*
|
*
|
||||||
|
|
@ -23,6 +25,7 @@ class EmployeeSignLogFactory extends Factory
|
||||||
$employee = Employee::where('store_id', '>', 0)->inRandomOrder()->first();
|
$employee = Employee::where('store_id', '>', 0)->inRandomOrder()->first();
|
||||||
$type = $this->faker->randomElement([SignType::Normal, SignType::Outside]);
|
$type = $this->faker->randomElement([SignType::Normal, SignType::Outside]);
|
||||||
$time = $this->faker->randomElement(SignTime::class);
|
$time = $this->faker->randomElement(SignTime::class);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'store_id' => $employee->store_id,
|
'store_id' => $employee->store_id,
|
||||||
'employee_id' => $employee->id,
|
'employee_id' => $employee->id,
|
||||||
|
|
@ -30,7 +33,7 @@ class EmployeeSignLogFactory extends Factory
|
||||||
'sign_time' => $time,
|
'sign_time' => $time,
|
||||||
'remarks' => $type == SignType::Outside ? '我在外面的' : '',
|
'remarks' => $type == SignType::Outside ? '我在外面的' : '',
|
||||||
'position' => ['province' => '重庆', 'city' => '重庆市', 'address' => '重庆市南川区东城街道办事处东环路三号'],
|
'position' => ['province' => '重庆', 'city' => '重庆市', 'address' => '重庆市南川区东城街道办事处东环路三号'],
|
||||||
'time' => $this->faker->dateTimeBetween('-7 days', 'now')
|
'time' => $this->faker->dateTimeBetween('-7 days', 'now'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,8 @@
|
||||||
|
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\Employee;
|
|
||||||
use App\Models\Feedback;
|
use App\Models\Feedback;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Feedback>
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Feedback>
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ class StoreFactory extends Factory
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
{
|
{
|
||||||
$master = Employee::where('store_id', 0)->inRandomOrder()->first();
|
$master = Employee::where('store_id', 0)->inRandomOrder()->first();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'title' => $this->faker->word(),
|
'title' => $this->faker->word(),
|
||||||
'master_id' => $master->id,
|
'master_id' => $master->id,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Enums\CheckStatus;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use App\Enums\CheckStatus;
|
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,9 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Employee;
|
use App\Models\Employee;
|
||||||
|
use App\Models\EmployeeSign;
|
||||||
|
use App\Models\EmployeeSignLog;
|
||||||
use App\Models\Store;
|
use App\Models\Store;
|
||||||
use App\Models\{EmployeeSign, EmployeeSignLog};
|
|
||||||
use Database\Factories\EmployeeFactory;
|
use Database\Factories\EmployeeFactory;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class WorkflowSeeder extends Seeder
|
||||||
{
|
{
|
||||||
$now = now();
|
$now = now();
|
||||||
$config = json_encode([
|
$config = json_encode([
|
||||||
["sort" => 1, "type" => "user", "user" => 1, "title" => "员工", "value" => 1, "subTitle" => "Admin"],
|
['sort' => 1, 'type' => 'user', 'user' => 1, 'title' => '员工', 'value' => 1, 'subTitle' => 'Admin'],
|
||||||
]);
|
]);
|
||||||
Workflow::truncate();
|
Workflow::truncate();
|
||||||
Workflow::insert([
|
Workflow::insert([
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue