From c82b75876339051236b4e485e5aff29ab1f8bdbe Mon Sep 17 00:00:00 2001 From: yueyang <2495544247@qq.com> Date: Fri, 20 Nov 2026 09:50:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=86OA=E8=A1=A8=E4=BA=8C=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=88=B0=E5=AE=A1=E6=89=B9=E6=B1=87=E6=80=BB=20(#1292?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Controllers/ProcessDetails.php | 49 +++--- .../View/ProcessDetailsPageData.php | 26 +-- ...process-details-approval-detail.blade.php} | 51 +++--- .../process-details-content.blade.php | 164 +++++++----------- .../Business/ProcessDetailsPageTest.php | 66 +++---- .../ProcessDetailsPageDataTest.php | 31 ++-- 6 files changed, 167 insertions(+), 220 deletions(-) rename resources/views/business/pages/financial-operations/{process-details-pending-payment-detail.blade.php => process-details-approval-detail.blade.php} (86%) diff --git a/modules/EcommerceFinance/Http/Controllers/ProcessDetails.php b/modules/EcommerceFinance/Http/Controllers/ProcessDetails.php index 12a4e929..6fd3b6dd 100644 --- a/modules/EcommerceFinance/Http/Controllers/ProcessDetails.php +++ b/modules/EcommerceFinance/Http/Controllers/ProcessDetails.php @@ -46,6 +46,29 @@ class ProcessDetails extends Controller ); $backUrl = url('/' . company_id() . '/workspace/process-data/oa-process') . ($backFilters === [] ? '' : '?' . http_build_query($backFilters)); + $approvalSummaryFilters = array_filter( + $pageData['filters'], + static fn (mixed $value): bool => $value !== '' && $value !== null, + ); + $approvalSummaryUrl = url( + '/' . company_id() . '/workspace/process-data/oa-process/approval-summary', + ) . ($approvalSummaryFilters === [] + ? '' + : '?' . http_build_query($approvalSummaryFilters)); + + if (($pageData['approvalSummaryDetailMode'] ?? false) && $request->ajax()) { + return response() + ->view('business.pages.financial-operations.process-details-approval-detail', [ + ...$pageData, + 'pageUrl' => url( + '/' . company_id() + . '/workspace/process-data/oa-process/approval-summary', + ), + 'backUrl' => $backUrl, + 'approvalSummaryUrl' => $approvalSummaryUrl, + ]) + ->header('Cache-Control', 'no-store'); + } return view('business.pages.financial-operations.process-details', [ ...$pageData, @@ -53,6 +76,7 @@ class ProcessDetails extends Controller 'page' => ['slug' => 'oa-process', 'title' => 'OA流程'], 'pageUrl' => url('/' . company_id() . '/workspace/process-data/oa-process/approval-summary'), 'backUrl' => $backUrl, + 'approvalSummaryUrl' => $approvalSummaryUrl, ]); } @@ -65,37 +89,12 @@ class ProcessDetails extends Controller ); $backUrl = url('/' . company_id() . '/workspace/process-data/oa-process') . ($backFilters === [] ? '' : '?' . http_build_query($backFilters)); - $pendingPaymentSummaryFilters = array_filter( - array_merge($pageData['filters'], ['current_approver_name' => '']), - static fn (mixed $value): bool => $value !== '' && $value !== null, - ); - $pendingPaymentSummaryUrl = url( - '/' . company_id() . '/workspace/process-data/oa-process/pending-payment-summary', - ) . ($pendingPaymentSummaryFilters === [] - ? '' - : '?' . http_build_query($pendingPaymentSummaryFilters)); - - if (($pageData['pendingPaymentDetailMode'] ?? false) && $request->ajax()) { - return response() - ->view('business.pages.financial-operations.process-details-pending-payment-detail', [ - ...$pageData, - 'pageUrl' => url( - '/' . company_id() - . '/workspace/process-data/oa-process/pending-payment-summary', - ), - 'backUrl' => $backUrl, - 'pendingPaymentSummaryUrl' => $pendingPaymentSummaryUrl, - ]) - ->header('Cache-Control', 'no-store'); - } - return view('business.pages.financial-operations.process-details', [ ...$pageData, 'section' => ['slug' => 'process-data', 'title' => '流程数据'], 'page' => ['slug' => 'oa-process', 'title' => 'OA流程'], 'pageUrl' => url('/' . company_id() . '/workspace/process-data/oa-process/pending-payment-summary'), 'backUrl' => $backUrl, - 'pendingPaymentSummaryUrl' => $pendingPaymentSummaryUrl, ]); } diff --git a/modules/EcommerceFinance/View/ProcessDetailsPageData.php b/modules/EcommerceFinance/View/ProcessDetailsPageData.php index db36a90d..bb9875e4 100644 --- a/modules/EcommerceFinance/View/ProcessDetailsPageData.php +++ b/modules/EcommerceFinance/View/ProcessDetailsPageData.php @@ -134,10 +134,15 @@ class ProcessDetailsPageData public function approvalSummaryPage(Request $request): array { $filters = self::normalizeFilters($request); + $approvalSummaryDetailMode = $request->query('approval_view') === 'detail'; $page = max((int) $request->query('page', 1), 1); $perPage = self::normalizePerPage($request->query('per_page')); $paginationQuery = array_filter( - [...$filters, 'per_page' => $perPage], + [ + ...$filters, + 'approval_view' => $approvalSummaryDetailMode ? 'detail' : '', + 'per_page' => $perPage, + ], static fn (mixed $value): bool => $value !== '' && $value !== null, ); @@ -148,7 +153,9 @@ class ProcessDetailsPageData $filters['payment_state'] = ''; unset($paginationQuery['payment_state']); } - $result = $this->repository->paginateApprovals($filters, $page, $perPage); + $result = $approvalSummaryDetailMode + ? $this->repository->paginate($filters, $page, $perPage) + : $this->repository->paginateApprovals($filters, $page, $perPage); return [ 'processRows' => new LengthAwarePaginator( @@ -172,6 +179,7 @@ class ProcessDetailsPageData 'scope' => $result['scope'], 'error' => null, 'approvalSummaryMode' => true, + 'approvalSummaryDetailMode' => $approvalSummaryDetailMode, ]; } catch (Throwable $exception) { report($exception); @@ -200,6 +208,7 @@ class ProcessDetailsPageData 'scope' => $this->repository->scope(), 'error' => 'OA流程镜像尚未完成导入,请稍后重试。', 'approvalSummaryMode' => true, + 'approvalSummaryDetailMode' => $approvalSummaryDetailMode, ]; } } @@ -209,23 +218,16 @@ class ProcessDetailsPageData { $filters = self::normalizeFilters($request); $filters['payment_state'] = '待付款'; - $pendingPaymentDetailMode = $request->query('pending_view') === 'detail'; $page = max((int) $request->query('page', 1), 1); $perPage = self::normalizePerPage($request->query('per_page')); $paginationQuery = array_filter( - [ - ...$filters, - 'pending_view' => $pendingPaymentDetailMode ? 'detail' : '', - 'per_page' => $perPage, - ], + [...$filters, 'per_page' => $perPage], static fn (mixed $value): bool => $value !== '' && $value !== null, ); try { $options = $this->repository->filterOptions($filters); - $result = $pendingPaymentDetailMode - ? $this->repository->paginate($filters, $page, $perPage) - : $this->repository->paginatePendingPaymentApprovers($filters, $page, $perPage); + $result = $this->repository->paginatePendingPaymentApprovers($filters, $page, $perPage); return [ 'processRows' => new LengthAwarePaginator( @@ -250,7 +252,6 @@ class ProcessDetailsPageData 'error' => null, 'approvalSummaryMode' => false, 'pendingPaymentSummaryMode' => true, - 'pendingPaymentDetailMode' => $pendingPaymentDetailMode, ]; } catch (Throwable $exception) { report($exception); @@ -281,7 +282,6 @@ class ProcessDetailsPageData 'error' => 'OA流程镜像尚未完成导入,请稍后重试。', 'approvalSummaryMode' => false, 'pendingPaymentSummaryMode' => true, - 'pendingPaymentDetailMode' => $pendingPaymentDetailMode, ]; } } diff --git a/resources/views/business/pages/financial-operations/process-details-pending-payment-detail.blade.php b/resources/views/business/pages/financial-operations/process-details-approval-detail.blade.php similarity index 86% rename from resources/views/business/pages/financial-operations/process-details-pending-payment-detail.blade.php rename to resources/views/business/pages/financial-operations/process-details-approval-detail.blade.php index 3f72412e..cfa47b8d 100644 --- a/resources/views/business/pages/financial-operations/process-details-pending-payment-detail.blade.php +++ b/resources/views/business/pages/financial-operations/process-details-approval-detail.blade.php @@ -2,13 +2,9 @@ $filters ??= []; $summary ??= []; $error ??= null; - $pendingPaymentSummaryUrl ??= $pageUrl ?? '#'; + $approvalSummaryUrl ??= $pageUrl ?? '#'; $processRows ??= new \Illuminate\Pagination\LengthAwarePaginator([], 0, 50, 1); $perPageOptions = \Modules\EcommerceFinance\View\ProcessDetailsPageData::PER_PAGE_OPTIONS; - $currentApproverName = trim((string) ($filters['current_approver_name'] ?? '')); - $currentApproverLabel = $currentApproverName !== '' - ? $currentApproverName - : '未识别当前审批人'; $money = static fn (mixed $value): string => $value === null || $value === '' ? '-' : number_format((float) $value, 2); @@ -48,15 +44,14 @@ $processDetailsLastPage = max($processRows->lastPage(), 1); $processDetailsCurrentPage = min(max($processRows->currentPage(), 1), $processDetailsLastPage); $detailFilters = array_filter( - [...$filters, 'pending_view' => 'detail'], + [...$filters, 'approval_view' => 'detail'], static fn (mixed $value): bool => $value !== '' && $value !== null, ); @endphp