From 48220ec13e65352a54b4ed3c66d2212c15c1d989 Mon Sep 17 00:00:00 2001 From: limeng <1131177064@qq.com> Date: Tue, 24 Nov 2026 16:59:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8A=A5=E4=BB=B7=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E4=B8=A4=E7=BA=A7=E5=AE=A1=E6=A0=B8=E5=B9=B6=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=AF=8F=E9=98=B6=E6=AE=B5=E4=BB=BB=E4=B8=80=E4=BA=BA=E9=80=9A?= =?UTF-8?q?=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Business/CourierOnboardings.php | 2 +- .../Business/CourierQuoteChanges.php | 33 +++- .../SystemSettings/WorkflowReviewers.php | 8 +- app/Models/Business/CourierQuoteChange.php | 2 + .../Business/CourierQuoteChangeEvent.php | 1 + app/Support/CourierQuoteChangeService.php | 31 +++- .../CourierQuoteWorkflowPermissions.php | 37 ++++- app/Support/CourierRequoteService.php | 4 +- docs/报价历史批量审核.md | 4 +- .../partials/stock-quote-review.blade.php | 4 +- .../quote-change-history.blade.php | 8 +- .../quote-change-show.blade.php | 13 +- .../quote-workflow-permissions.blade.php | 15 +- .../CourierQuoteWorkflowPermissionsTest.php | 156 ++++++++++++++++++ 14 files changed, 271 insertions(+), 47 deletions(-) diff --git a/app/Http/Controllers/Business/CourierOnboardings.php b/app/Http/Controllers/Business/CourierOnboardings.php index edcb781b..487795bf 100644 --- a/app/Http/Controllers/Business/CourierOnboardings.php +++ b/app/Http/Controllers/Business/CourierOnboardings.php @@ -101,7 +101,7 @@ class CourierOnboardings extends Controller } $requotes = $this->requotes(); $open = $requotes->openChange($onboarding); - if ($open !== null && ($open->status === \App\Models\Business\CourierQuoteChange::STATUS_PENDING_REVIEW || $open->created_by !== user_id())) { + if ($open !== null && (in_array($open->status, [\App\Models\Business\CourierQuoteChange::STATUS_PENDING_REVIEW, \App\Models\Business\CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW], true) || $open->created_by !== user_id())) { return redirect()->route('business.courier-quote-changes.show', $open) ->with('success', "已有未完成的变价单 {$open->number},请先查看该单;待审核单可由发起人撤回修改。"); } diff --git a/app/Http/Controllers/Business/CourierQuoteChanges.php b/app/Http/Controllers/Business/CourierQuoteChanges.php index f5b6631c..63040157 100644 --- a/app/Http/Controllers/Business/CourierQuoteChanges.php +++ b/app/Http/Controllers/Business/CourierQuoteChanges.php @@ -48,20 +48,28 @@ class CourierQuoteChanges extends Controller $quoteReviewer = $this->canReview(); $admin = $this->canAdminister(); - $selfReview = app(CourierQuoteWorkflowPermissions::class)->allowsSelfReview((int) user_id()); - $reviewableIds = $changes->filter(fn ($change) => ($change->isStockQuote() ? $admin : $quoteReviewer) - && ($change->created_by !== user_id() || ($change->isStockQuote() ? config('courier_onboarding.allow_same_reviewer') : $selfReview)))->pluck('id')->all(); + $permissions = app(CourierQuoteWorkflowPermissions::class); + $workflow = $permissions->settings(); + $stageAccess = []; + $reviewableIds = $changes->filter(function ($change) use ($permissions, &$stageAccess) { + if (!in_array($change->status, [CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW], true)) return false; + // 本页同环节和同自审条件仅核验一次;下个请求重新读取权限和花名册。 + $key = $change->status . ':' . (int) $change->isStockQuote() . ':' . (int) ($change->created_by === user_id()); + return $stageAccess[$key] ??= $permissions->canReviewChange($change, (int) user_id()); + })->pluck('id')->all(); return view('business.pages.courier-payables.quote-change-history', [ 'changes' => $changes, 'canReview' => $quoteReviewer || $admin, 'reviewableChangeIds' => $reviewableIds, 'filters' => $filters, + 'quoteWorkflow' => $workflow, 'carrierOptions' => CourierQuoteChange::query()->whereNotNull('carrier_name')->distinct()->orderBy('carrier_name')->pluck('carrier_name')->all(), 'changeTypeOptions' => CourierQuoteChange::query()->whereNotNull('change_type')->distinct()->orderBy('change_type')->pluck('change_type')->all(), 'statusOptions' => [ CourierQuoteChange::STATUS_DRAFT => '草稿', - CourierQuoteChange::STATUS_PENDING_REVIEW => '待审核', + CourierQuoteChange::STATUS_PENDING_REVIEW => $workflow['staged'] ? '待初审' : '待审核', + CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW => '待复审', CourierQuoteChange::STATUS_RETURNED => '已退回', CourierQuoteChange::STATUS_APPROVED => '已审核', ], @@ -72,7 +80,7 @@ class CourierQuoteChanges extends Controller private function historyFilters(Request $request): array { $status = (string) $request->input('status', ''); - $allowed = [CourierQuoteChange::STATUS_DRAFT, CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_RETURNED, CourierQuoteChange::STATUS_APPROVED]; + $allowed = [CourierQuoteChange::STATUS_DRAFT, CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW, CourierQuoteChange::STATUS_RETURNED, CourierQuoteChange::STATUS_APPROVED]; return [ 'carrier' => mb_substr(trim((string) $request->input('carrier', '')), 0, 100), @@ -130,10 +138,8 @@ class CourierQuoteChanges extends Controller ? $this->requotes->reviewWarnings($quoteChange, $requoteDiff) : [], 'voidedBy' => $quoteChange->version?->voided_by ? user_model_class()::query()->find($quoteChange->version->voided_by)?->name : null, - 'canReview' => $reviewAllowed && ($quoteChange->created_by !== user_id() - || ($quoteChange->isStockQuote() ? config('courier_onboarding.allow_same_reviewer') - : app(CourierQuoteWorkflowPermissions::class)->allowsSelfReview((int) user_id()))), - 'canWithdraw' => ! $quoteChange->isStockQuote() && $quoteChange->status === CourierQuoteChange::STATUS_PENDING_REVIEW + 'canReview' => app(CourierQuoteWorkflowPermissions::class)->canReviewChange($quoteChange, (int) user_id()), + 'canWithdraw' => ! $quoteChange->isStockQuote() && in_array($quoteChange->status, [CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW], true) && $quoteChange->created_by === user_id() && app(CourierQuoteWorkflowPermissions::class)->can('initiators', (int) user_id()), 'canManageSignature' => $canManageSignature, 'canCorrectPeriods' => $reviewAllowed && !$quoteChange->isStockQuote() @@ -250,6 +256,11 @@ class CourierQuoteChanges extends Controller } $change = $this->service->approve($quoteChange, user_id(), $request->boolean('stock_signature_verified')); + if ($change->status === CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW) { + return redirect()->route('business.courier-quote-changes.show', $change) + ->with('success', '初审通过,已转复审。任意一名指定复审人员通过后才生成生效报价版本。'); + } + $message = "审核完成,已生成新报价版本 {$change->version->version_code}。"; if ($change->isStockQuote()) { @@ -490,6 +501,10 @@ class CourierQuoteChanges extends Controller private function canReview(?CourierQuoteChange $change = null): bool { + if ($change && (app(CourierQuoteWorkflowPermissions::class)->settings()['staged'] + || $change->status === CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW)) { + return app(CourierQuoteWorkflowPermissions::class)->canReviewChange($change, (int) user_id()); + } return $change?->isStockQuote() ? $this->canAdminister() : app(CourierQuoteWorkflowPermissions::class)->can('reviewers', (int) user_id()); } diff --git a/app/Http/Controllers/SystemSettings/WorkflowReviewers.php b/app/Http/Controllers/SystemSettings/WorkflowReviewers.php index 51daa349..94698caa 100644 --- a/app/Http/Controllers/SystemSettings/WorkflowReviewers.php +++ b/app/Http/Controllers/SystemSettings/WorkflowReviewers.php @@ -58,11 +58,15 @@ class WorkflowReviewers extends Controller $data = $request->validate([ 'initiators' => ['required', 'array', 'min:1', 'max:10'], 'initiators.*' => ['required', 'string', 'max:100', 'distinct'], - 'reviewers' => ['required', 'array', 'min:1', 'max:10'], + 'reviewers' => ['required_without:first_reviewers', 'array', 'min:1', 'max:10'], 'reviewers.*' => ['required', 'string', 'max:100', 'distinct'], + 'first_reviewers' => ['required_with:final_reviewers', 'array', 'min:1', 'max:10'], + 'first_reviewers.*' => ['required', 'string', 'max:100', 'distinct'], + 'final_reviewers' => ['required_with:first_reviewers', 'array', 'min:1', 'max:10'], + 'final_reviewers.*' => ['required', 'string', 'max:100', 'distinct'], ]); app(CourierQuoteWorkflowPermissions::class)->save($data, user()->name, (int) user_id()); - return redirect()->route('system-settings.workflow-reviewers.index')->with('success', '报价变价发起和审核人员已保存,立即对未完成变价生效。'); + return redirect()->route('system-settings.workflow-reviewers.index')->with('success', '报价发起和审核人员已保存,立即对未完成报价生效。'); } } diff --git a/app/Models/Business/CourierQuoteChange.php b/app/Models/Business/CourierQuoteChange.php index 16f37d1c..6fb7d8a5 100644 --- a/app/Models/Business/CourierQuoteChange.php +++ b/app/Models/Business/CourierQuoteChange.php @@ -10,6 +10,7 @@ class CourierQuoteChange extends Model { public const STATUS_DRAFT = 'draft'; public const STATUS_PENDING_REVIEW = 'pending_review'; + public const STATUS_PENDING_FINAL_REVIEW = 'pending_final_review'; public const STATUS_RETURNED = 'returned'; public const STATUS_APPROVED = 'approved'; @@ -104,6 +105,7 @@ class CourierQuoteChange extends Model return match ($this->status) { self::STATUS_DRAFT => '草稿', self::STATUS_PENDING_REVIEW => '待审核', + self::STATUS_PENDING_FINAL_REVIEW => '待复审', self::STATUS_RETURNED => '已退回', self::STATUS_APPROVED => '已审核', default => $this->status, diff --git a/app/Models/Business/CourierQuoteChangeEvent.php b/app/Models/Business/CourierQuoteChangeEvent.php index 77c940c5..428c0a6a 100644 --- a/app/Models/Business/CourierQuoteChangeEvent.php +++ b/app/Models/Business/CourierQuoteChangeEvent.php @@ -34,6 +34,7 @@ class CourierQuoteChangeEvent extends Model 'withdrawn' => '撤回修改', 'returned' => '退回修改', 'approved' => '审核通过', + 'first_approved' => '初审通过', 'voided' => '版本作废', 'period_end_updated' => '设置执行截止日期', 'periods_corrected' => '更正执行区间', diff --git a/app/Support/CourierQuoteChangeService.php b/app/Support/CourierQuoteChangeService.php index 2ebd3e0f..c28f04ea 100644 --- a/app/Support/CourierQuoteChangeService.php +++ b/app/Support/CourierQuoteChangeService.php @@ -139,11 +139,12 @@ final class CourierQuoteChangeService return DB::transaction(function () use ($change, $userId): CourierQuoteChange { $change = CourierQuoteChange::query()->lockForUpdate()->findOrFail($change->id); abort_unless(! $change->isStockQuote() && $change->created_by === $userId, 403, '只有变价发起人可以撤回自己的待审核单。'); - if ($change->status !== CourierQuoteChange::STATUS_PENDING_REVIEW || $change->version()->exists()) { + if (!in_array($change->status, [CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW], true) || $change->version()->exists()) { throw ValidationException::withMessages(['status' => '只有尚未审核通过的待审核变价单可以撤回,请刷新状态。']); } + $from = $change->status; $change->update(['status' => CourierQuoteChange::STATUS_DRAFT, 'submitted_by' => null, 'submitted_at' => null]); - $this->recordEvent($change, 'withdrawn', CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_DRAFT, + $this->recordEvent($change, 'withdrawn', $from, CourierQuoteChange::STATUS_DRAFT, '发起人撤回审核,修改后需重新提交。', $userId); return $change->fresh(['items', 'events']); @@ -153,17 +154,19 @@ final class CourierQuoteChangeService public function returnForChanges(CourierQuoteChange $change, string $note, int $userId): CourierQuoteChange { app(CourierQuoteWorkflowPermissions::class)->assertReviewer($change, $userId); - if ($change->status !== CourierQuoteChange::STATUS_PENDING_REVIEW) { + if (!in_array($change->status, [CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW], true)) { throw ValidationException::withMessages(['status' => '只有待审核的变更单可以退回。']); } return DB::transaction(function () use ($change, $note, $userId): CourierQuoteChange { $change = CourierQuoteChange::query()->lockForUpdate()->findOrFail($change->id); - if ($change->status !== CourierQuoteChange::STATUS_PENDING_REVIEW) { + app(CourierQuoteWorkflowPermissions::class)->assertReviewer($change, $userId); + if (!in_array($change->status, [CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW], true)) { throw ValidationException::withMessages(['status' => '只有待审核的变更单可以退回,请刷新状态。']); } + $from = $change->status; $change->update(['status' => CourierQuoteChange::STATUS_RETURNED]); - $this->recordEvent($change, 'returned', CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_RETURNED, $note, $userId); + $this->recordEvent($change, 'returned', $from, CourierQuoteChange::STATUS_RETURNED, $note, $userId); return $change->fresh(['items', 'events']); }); @@ -172,11 +175,11 @@ final class CourierQuoteChangeService public function approve(CourierQuoteChange $change, int $userId, bool $historicalDocumentsConfirmed = false): CourierQuoteChange { app(CourierQuoteWorkflowPermissions::class)->assertReviewer($change, $userId); - if ($change->status !== CourierQuoteChange::STATUS_PENDING_REVIEW) { + if (!in_array($change->status, [CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW], true)) { throw ValidationException::withMessages(['status' => '只有待审核的变更单可以审核通过。']); } - $allowsSelfReview = $change->isStockQuote() ? config('courier_onboarding.allow_same_reviewer') + $allowsSelfReview = $change->isStockQuote() && !app(CourierQuoteWorkflowPermissions::class)->settings()['staged'] ? config('courier_onboarding.allow_same_reviewer') : app(CourierQuoteWorkflowPermissions::class)->allowsSelfReview($userId); if ($change->created_by === $userId && ! $allowsSelfReview) { throw ValidationException::withMessages(['approval' => '发起人不能审核自己提交的报价变更。']); @@ -186,9 +189,11 @@ final class CourierQuoteChangeService return DB::transaction(function () use ($change, $source, $userId, $historicalDocumentsConfirmed): CourierQuoteChange { $change = CourierQuoteChange::query()->lockForUpdate()->findOrFail($change->id); - if ($change->status !== CourierQuoteChange::STATUS_PENDING_REVIEW) { + app(CourierQuoteWorkflowPermissions::class)->assertReviewer($change, $userId); + if (!in_array($change->status, [CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW], true)) { throw ValidationException::withMessages(['status' => '只有待审核的变更单可以审核通过,请刷新状态。']); } + $from = $change->status; if ($change->isStockQuote()) { \App\Models\Common\Company::whereKey(company_id())->lockForUpdate()->firstOrFail(); $entry = CourierStockQuoteEntry::findOrFail(data_get($change->quote_payload, 'stock_quote_entry_id')); @@ -200,6 +205,14 @@ final class CourierQuoteChangeService throw ValidationException::withMessages(['stock_signature_verified' => '尚未上传历史签署资料,请补充资料或取消历史资料核验;不影响存量报价审核生效。']); } $historicalSigned = $hasHistoricalFiles && $historicalDocumentsConfirmed; + $workflow = app(CourierQuoteWorkflowPermissions::class)->settings(); + if ($workflow['staged'] && $change->status === CourierQuoteChange::STATUS_PENDING_REVIEW) { + $change->update(['status' => CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW]); + $this->recordEvent($change, 'first_approved', $from, CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW, + '初审通过,等待任意一名指定复审人员审核;尚未生成生效报价版本。', $userId, + ['first_reviewers' => $workflow['first_reviewers'], 'final_reviewers' => $workflow['final_reviewers']]); + return $change->fresh(['items', 'events', 'version']); + } $source = CourierQuoteNotes::apply($source, $change->quote_payload['quote_notes'] ?? []); $values = $source['values']; $formulas = $source['formulas']; @@ -265,7 +278,7 @@ final class CourierQuoteChangeService $eventNote .= ' 该报价为历史生效;补差明细尚未生成,原运费保持不变。'; } - $this->recordEvent($change, 'approved', CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_APPROVED, $eventNote, $userId, [ + $this->recordEvent($change, 'approved', $from, CourierQuoteChange::STATUS_APPROVED, $eventNote, $userId, [ ...$this->changeDetails($change), 'version_code' => $version->version_code, 'historical_documents_confirmed' => $historicalSigned, diff --git a/app/Support/CourierQuoteWorkflowPermissions.php b/app/Support/CourierQuoteWorkflowPermissions.php index 57344e56..6decb3b0 100644 --- a/app/Support/CourierQuoteWorkflowPermissions.php +++ b/app/Support/CourierQuoteWorkflowPermissions.php @@ -28,7 +28,9 @@ final class CourierQuoteWorkflowPermissions $settings = json_decode($value ?? '', true); $settings = is_array($settings) ? $settings : []; - return ['configured' => $value !== null] + $settings + ['initiators' => [], 'reviewers' => [], 'self_reviewers' => []]; + return ['configured' => $value !== null, + 'staged' => !empty($settings['first_reviewers']) && !empty($settings['final_reviewers'])] + + $settings + ['initiators' => [], 'reviewers' => [], 'self_reviewers' => [], 'first_reviewers' => [], 'final_reviewers' => []]; } public function history(): array @@ -39,7 +41,11 @@ final class CourierQuoteWorkflowPermissions public function save(array $data, string $actor, ?int $actorId): void { - $next = ['initiators' => [], 'reviewers' => []]; + $staged = array_key_exists('first_reviewers', $data) || array_key_exists('final_reviewers', $data); + if (!$staged && $this->settings()['staged']) { + throw ValidationException::withMessages(['first_reviewers' => '请同时设置报价初审、复审人员。']); + } + $next = $staged ? ['initiators' => [], 'first_reviewers' => [], 'final_reviewers' => []] : ['initiators' => [], 'reviewers' => []]; foreach (array_keys($next) as $stage) { $ids = $data[$stage] ?? []; if (! is_array($ids) || count($ids) < 1 || count($ids) > 10 || count(array_unique($ids)) !== count($ids)) { @@ -54,6 +60,13 @@ final class CourierQuoteWorkflowPermissions $next[$stage][] = ['dingtalk_user_id' => (string) $id, 'display_name' => $person['display_name']]; } } + if ($staged) { + if (array_intersect($data['first_reviewers'], $data['final_reviewers'])) { + throw ValidationException::withMessages(['final_reviewers' => '初审和复审请选择不同人员。']); + } + $next['reviewers'] = [...$next['first_reviewers'], ...$next['final_reviewers']]; + $data['reviewers'] = array_column($next['reviewers'], 'dingtalk_user_id'); + } // 未指定时保留已授权的本人单据审核权限;移出审核名单时同步撤销。 $selfIds = $data['self_reviewers'] ?? array_intersect( array_column($this->settings()['self_reviewers'], 'dingtalk_user_id'), $data['reviewers'] @@ -130,15 +143,29 @@ final class CourierQuoteWorkflowPermissions public function assertReviewer(CourierQuoteChange $change, int $userId): void { abort_unless((int) $change->company_id === (int) company_id(), 403); - $allowed = $change->isStockQuote() + $settings = $this->settings(); + $staged = $settings['staged'] || $change->status === CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW; + $allowed = $staged ? ($settings['staged'] && $this->can($change->status === CourierQuoteChange::STATUS_PENDING_REVIEW ? 'first_reviewers' : 'final_reviewers', $userId)) + : ($change->isStockQuote() ? in_array(SystemAccess::roleName(User::find($userId)), [SystemAccess::ADMIN, SystemAccess::SUPER_ADMIN], true) - : $this->can('reviewers', $userId); + : $this->can('reviewers', $userId)); abort_unless($allowed, 403, '你不是该报价变价的指定审核人员。'); - if (! $change->isStockQuote() && $change->created_by === $userId && ! $this->allowsSelfReview($userId)) { + if (($staged || !$change->isStockQuote()) && $change->created_by === $userId && ! $this->allowsSelfReview($userId)) { throw ValidationException::withMessages(['approval' => '发起人不能审核自己提交的报价变更。']); } } + public function canReviewChange(CourierQuoteChange $change, int $userId): bool + { + try { + $this->assertReviewer($change, $userId); + return $change->created_by !== $userId || $this->allowsSelfReview($userId) + || (!$this->settings()['staged'] && $change->isStockQuote() && config('courier_onboarding.allow_same_reviewer')); + } catch (ValidationException | \Symfony\Component\HttpKernel\Exception\HttpException) { + return false; + } + } + private function account(string $id): ?User { $identities = DingTalkIdentity::query()->where('dingtalk_user_id', $id)->with('user')->limit(2)->get(); diff --git a/app/Support/CourierRequoteService.php b/app/Support/CourierRequoteService.php index 4692d547..85c3b97c 100644 --- a/app/Support/CourierRequoteService.php +++ b/app/Support/CourierRequoteService.php @@ -92,7 +92,7 @@ final class CourierRequoteService { return CourierQuoteChange::query() ->where('carrier_name', $onboarding->courier_name) - ->whereIn('status', [CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_RETURNED, CourierQuoteChange::STATUS_DRAFT]) + ->whereIn('status', [CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW, CourierQuoteChange::STATUS_RETURNED, CourierQuoteChange::STATUS_DRAFT]) ->whereNotNull('quote_payload') ->where('change_type', '!=', '存量报价') ->latest('id') @@ -170,7 +170,7 @@ final class CourierRequoteService $open = $this->openChange($onboarding); abort_if($open !== null && $open->created_by !== $userId, 403, '只有变价发起人可以修改或重新提交该变价单。'); - if ($open !== null && $open->status === CourierQuoteChange::STATUS_PENDING_REVIEW) { + if ($open !== null && in_array($open->status, [CourierQuoteChange::STATUS_PENDING_REVIEW, CourierQuoteChange::STATUS_PENDING_FINAL_REVIEW], true)) { throw ValidationException::withMessages(['status' => "已有待审核的变价单 {$open->number},审核完成后再发起新的变价。"]); } diff --git a/docs/报价历史批量审核.md b/docs/报价历史批量审核.md index 8d63e272..48316d43 100644 --- a/docs/报价历史批量审核.md +++ b/docs/报价历史批量审核.md @@ -2,7 +2,9 @@ 报价管理 → 报价历史中,有报价审核权限的账号可勾选本页待审核记录,或用表头勾选框全选本页可审核项,点击“批量审核通过”。确认窗口列出变更单号、快递、变更类型和执行期间;核对原报价、计费规则及实际执行日期后提交。已审核和受自审限制的记录不显示勾选框。 -批量接口沿用当前公司和报价管理页级权限,同时检查管理员/超级管理员审核身份;仅处理明确提交的记录ID,最多100条,不隐式选择其他页或其他公司。逐条调用现有单条审核入口,保留自审限制、报价期间冲突校验、版本生成、审核日志和原签署后续流程。单条失败不撤销其他成功项;完成后显示成功/未通过数量及每条结果,返回原页码。 +批量接口沿用当前公司和报价管理页级权限,按配置检查当前环节指定人员;仅处理明确提交的记录ID,最多100条,不隐式选择其他页或其他公司。逐条调用现有单条审核入口,保留自审限制、报价期间冲突校验、版本生成、审核日志和原签署后续流程。单条失败不撤销其他成功项;完成后显示成功/未通过数量及每条结果,返回原页码。 + +在系统设置 → 流程审核权限设置中配置报价初审、复审名单后,所有未完成存量报价和变价统一两级审核。每环节任意一人通过即可;初审只转为待复审,复审通过才生成版本并执行原签署后续流程。管理员身份不能越过指定名单。退回或撤回后重新提交必须重走初审;待复审的后台变价仍视为未完成,不能再次发起同一快递变价。既有已完成报价和审计记录保留。 存量报价仍按既有规则审核生效,不自动发起签署;历史签署资料必须逐份核对,不接受批量标记为已经核验。非存量变价沿用原单条审核的签署准备与推送流程。 diff --git a/resources/views/business/pages/courier-payables/partials/stock-quote-review.blade.php b/resources/views/business/pages/courier-payables/partials/stock-quote-review.blade.php index 7ae666d2..bc5c9bf5 100644 --- a/resources/views/business/pages/courier-payables/partials/stock-quote-review.blade.php +++ b/resources/views/business/pages/courier-payables/partials/stock-quote-review.blade.php @@ -16,13 +16,13 @@ @if(collect($stockEntry->files)->contains('source', 'workbook_embedded'))
工作表内嵌图片已按原始字节独立留存,未裁剪、未压缩。提取成功不代表已核对一致;后续调价仍保留本版原件。
@endif - @if($canReview && $change->status === 'pending_review') + @if($canReview && in_array($change->status, ['pending_review', 'pending_final_review']))存量报价审核通过后按实际执行日期生效,无需签章。历史签署资料可另行核验归档,不影响报价生效。
+存量报价最终审核通过后按实际执行日期生效,无需签章。历史签署资料可另行核验归档,不影响报价生效。
| @endif | 变更单号 | 原报价 | 快递公司 | 变更类型 | 明细 | 生效日期 | 生效方式 | 追溯核算 | 状态 | 新版本 | 更新时间 | 操作 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @if(in_array($change->id, $reviewableChangeIds, true) && $change->status === 'pending_review')@else—@endif | @endif{{ $change->number }} | {{ $change->source_quote_id }} | {{ $change->carrier_name }} | {{ $change->change_type }} | {{ $change->items->count() }} 项 | {{ $change->effective_date->toDateString() }} | {{ $change->isRetrospective() ? '追溯变价' : '正常生效' }} | {{ $change->recalculationStatusLabel() }} | {{ $change->statusLabel() }} | {{ $change->version?->version_code ?? '—' }} | {{ $change->updated_at?->format('Y-m-d H:i') }} | 查看@if($change->isEditable() && $change->created_by===user_id()) · 编辑@endif |
| @if(in_array($change->id, $reviewableChangeIds, true) && in_array($change->status, ['pending_review', 'pending_final_review']))@else—@endif | @endif{{ $change->number }} | {{ $change->source_quote_id }} | {{ $change->carrier_name }} | {{ $change->change_type }} | {{ $change->items->count() }} 项 | {{ $change->effective_date->toDateString() }} | {{ $change->isRetrospective() ? '追溯变价' : '正常生效' }} | {{ $change->recalculationStatusLabel() }} | {{ ($quoteWorkflow['staged'] ?? false) && $change->status === 'pending_review' ? '待初审' : $change->statusLabel() }} | {{ $change->version?->version_code ?? '—' }} | {{ $change->updated_at?->format('Y-m-d H:i') }} | 查看@if($change->isEditable() && $change->created_by===user_id()) · 编辑@endif |