Compare commits

..

No commits in common. "6b9787b3b6eb1333f26f45a24ec83544a1d24344" and "bb5afea754859547aa299a075cc47e0448ea5f58" have entirely different histories.

2 changed files with 4 additions and 20 deletions

View File

@ -9,7 +9,6 @@ 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 Slowlyo\OwlAdmin\Models\AdminUser;
use App\Exceptions\RuntimeException;
class EmployeeSignRepairService extends BaseService class EmployeeSignRepairService extends BaseService
{ {
@ -75,7 +74,7 @@ class EmployeeSignRepairService extends BaseService
$createRules = [ $createRules = [
'employee_id' => ['required'], 'employee_id' => ['required'],
'sign_time' => ['required'], 'sign_time' => ['required'],
'date' => ['required', 'date'], 'date' => ['required'],
'store_id' => ['required'], 'store_id' => ['required'],
'reason' => ['required'], 'reason' => ['required'],
]; ];
@ -104,22 +103,4 @@ class EmployeeSignRepairService extends BaseService
return true; return true;
} }
public function delete(string $ids): mixed
{
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
foreach ($list as $item) {
$workflow = $item->workflow;
if ($workflow) {
if ($workflow->check_status == CheckStatus::Processing) {
throw new RuntimeException(CheckStatus::Processing->text() . ', 无法删除');
}
if ($workflow->check_status == CheckStatus::Success) {
throw new RuntimeException(CheckStatus::Success->text() . ', 无法删除');
}
}
$item->delete();
}
return true;
}
} }

View File

@ -89,6 +89,9 @@ class SignRepairController extends Controller
{ {
$user = $this->guard()->user(); $user = $this->guard()->user();
$model = EmployeeSignRepair::with(['workflow'])->where('employee_id', $user->id)->findOrFail($id); $model = EmployeeSignRepair::with(['workflow'])->where('employee_id', $user->id)->findOrFail($id);
if (!$model->canUpdate()) {
throw new RuntimeException('审核中, 无法删除');
}
try { try {
DB::beginTransaction(); DB::beginTransaction();