generated from liutk/owl-admin-base
admin check_status map
parent
db7395fe36
commit
adc8cfcb9c
|
|
@ -108,7 +108,7 @@ class AgreementController extends AdminController
|
||||||
['label' => __('agreement.employee_id'), 'content' => '${employee.name}'],
|
['label' => __('agreement.employee_id'), 'content' => '${employee.name}'],
|
||||||
['label' => __('agreement.store_id'), 'content' => '${store.title}'],
|
['label' => __('agreement.store_id'), 'content' => '${store.title}'],
|
||||||
['label' => __('agreement.created_at'), 'content' => '${created_at}'],
|
['label' => __('agreement.created_at'), 'content' => '${created_at}'],
|
||||||
['label' => __('agreement.remarks'), 'content' => '${remarks}', 'span' => 3],
|
['label' => __('agreement.remarks'), 'content' => '${remarks}', 'span' => 2],
|
||||||
['label' => __('agreement.images'), 'content' => amisMake()->Images()->name('images')->enlargeAble(), 'span' => 3],
|
['label' => __('agreement.images'), 'content' => amisMake()->Images()->name('images')->enlargeAble(), 'span' => 3],
|
||||||
['label' => __('workflow_log.check_status'), 'content' => amisMake()->Mapping()->name('workflow.check_status')->map(CheckStatus::options())],
|
['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.checked_at'), 'content' => '${workflow.checked_at}'],
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,10 @@ class AgreementService extends BaseService
|
||||||
if ($user->can('admin.agreement.view')) {
|
if ($user->can('admin.agreement.view')) {
|
||||||
array_push($actions, 'view');
|
array_push($actions, 'view');
|
||||||
}
|
}
|
||||||
if ($user->can('admin.agreement.update') && $model->canUpdate()) {
|
if ($user->can('admin.agreement.update') && !in_array($model->workflow->check_status, [CheckStatus::Processing])) {
|
||||||
array_push($actions, 'edit');
|
array_push($actions, 'edit');
|
||||||
}
|
}
|
||||||
if ($user->can('admin.agreement.delete')) {
|
if ($user->can('admin.agreement.delete') && !in_array($model->workflow->check_status, [CheckStatus::Processing])) {
|
||||||
array_push($actions, 'delete');
|
array_push($actions, 'delete');
|
||||||
}
|
}
|
||||||
if ($user->can('admin.agreement.download') && in_array($model->workflow->check_status, [CheckStatus::Success])) {
|
if ($user->can('admin.agreement.download') && in_array($model->workflow->check_status, [CheckStatus::Success])) {
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class EmployeePromotionService extends BaseService
|
||||||
if ($user->can('admin.hr.promotion.update') && !in_array($model->promotion_status, [PromotionStatus::Processing])) {
|
if ($user->can('admin.hr.promotion.update') && !in_array($model->promotion_status, [PromotionStatus::Processing])) {
|
||||||
array_push($actions, 'edit');
|
array_push($actions, 'edit');
|
||||||
}
|
}
|
||||||
if ($user->can('admin.hr.promotion.delete') && !in_array($model->promotion_status, [PromotionStatus::Processing, PromotionStatus::Fail])) {
|
if ($user->can('admin.hr.promotion.delete') && !in_array($model->promotion_status, [PromotionStatus::Processing])) {
|
||||||
array_push($actions, 'delete');
|
array_push($actions, 'delete');
|
||||||
}
|
}
|
||||||
if (in_array($model->promotion_status, [PromotionStatus::Processing])) {
|
if (in_array($model->promotion_status, [PromotionStatus::Processing])) {
|
||||||
|
|
@ -174,9 +174,6 @@ class EmployeePromotionService extends BaseService
|
||||||
{
|
{
|
||||||
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
||||||
foreach ($list as $item) {
|
foreach ($list as $item) {
|
||||||
if (!$item->canUpdate()) {
|
|
||||||
throw new RuntimeException($item->promotion_status->text() . ', 无法删除');
|
|
||||||
}
|
|
||||||
$item->delete();
|
$item->delete();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
use Slowlyo\OwlAdmin\Admin;
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
use App\Enums\CheckStatus;
|
use App\Enums\CheckStatus;
|
||||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
use App\Models\AdminUser;
|
||||||
use App\Exceptions\RuntimeException;
|
use App\Exceptions\RuntimeException;
|
||||||
|
|
||||||
class EmployeeSignRepairService extends BaseService
|
class EmployeeSignRepairService extends BaseService
|
||||||
|
|
|
||||||
|
|
@ -28,15 +28,27 @@ enum CheckStatus: int
|
||||||
*/
|
*/
|
||||||
case Cancel = 5;
|
case Cancel = 5;
|
||||||
|
|
||||||
public static function options(): array
|
public static function options($index = 1): array
|
||||||
{
|
{
|
||||||
return [
|
$maps = [
|
||||||
self::None->value => '待提审',
|
// 申请人看到的状态
|
||||||
self::Processing->value => '审核中',
|
1 => [
|
||||||
self::Success->value => '已通过',
|
self::None->value => '待提审',
|
||||||
self::Fail->value => '已拒绝',
|
self::Processing->value => '审核中',
|
||||||
// self::Cancel->value => '已取消',
|
self::Success->value => '已通过',
|
||||||
|
self::Fail->value => '未通过',
|
||||||
|
// self::Cancel->value => '已取消',
|
||||||
|
],
|
||||||
|
// 审核人看到的状态
|
||||||
|
2 => [
|
||||||
|
self::None->value => '未开始',
|
||||||
|
self::Processing->value => '待审核',
|
||||||
|
self::Success->value => '已通过',
|
||||||
|
self::Fail->value => '未通过',
|
||||||
|
// self::Cancel->value => '已取消',
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
return data_get($maps, $index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function labelMap(): array
|
public static function labelMap(): array
|
||||||
|
|
@ -50,8 +62,8 @@ enum CheckStatus: int
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function text()
|
public function text($index = 1)
|
||||||
{
|
{
|
||||||
return data_get(self::options(), $this->value);
|
return data_get(self::options($index), $this->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ enum PromotionStatus: int
|
||||||
self::Employee->value => '待补充',
|
self::Employee->value => '待补充',
|
||||||
self::Invitor->value => '待推荐',
|
self::Invitor->value => '待推荐',
|
||||||
self::Processing->value => '审核中',
|
self::Processing->value => '审核中',
|
||||||
self::Success->value => '审核通过',
|
self::Success->value => '已通过',
|
||||||
self::Fail->value => '审核不通过',
|
self::Fail->value => '未通过',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
||||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Laravel\Sanctum\HasApiTokens;
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
use App\Models\AdminUser;
|
||||||
use App\Enums\UserRole;
|
use App\Enums\UserRole;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ trait HasCheckActions
|
||||||
amis()->TableColumn()->name('batch_id')->label(__('workflow_log.batch_id')),
|
amis()->TableColumn()->name('batch_id')->label(__('workflow_log.batch_id')),
|
||||||
amis()->TableColumn()->name('check_name')->label(__('workflow_log.check_name')),
|
amis()->TableColumn()->name('check_name')->label(__('workflow_log.check_name')),
|
||||||
amis()->TableColumn()->name('check_user.name')->label(__('workflow_log.check_user_id')),
|
amis()->TableColumn()->name('check_user.name')->label(__('workflow_log.check_user_id')),
|
||||||
amis()->TableColumn()->name('check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()),
|
amis()->TableColumn()->name('check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options(2)),
|
||||||
amis()->TableColumn()->name('checked_at')->label(__('workflow_log.checked_at')),
|
amis()->TableColumn()->name('checked_at')->label(__('workflow_log.checked_at')),
|
||||||
amis()->TableColumn()->name('remarks')->label(__('workflow_log.remarks')),
|
amis()->TableColumn()->name('remarks')->label(__('workflow_log.remarks')),
|
||||||
])->itemActions([
|
])->itemActions([
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,5 @@ return [
|
||||||
'employee_id' => '上传人',
|
'employee_id' => '上传人',
|
||||||
'images' => '合同图片',
|
'images' => '合同图片',
|
||||||
'remarks' => '备注',
|
'remarks' => '备注',
|
||||||
'store_id' => '合同',
|
'store_id' => '门店',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue