feat: 将OA表二调整到审批汇总 (#1292)
This commit is contained in:
parent
2d53ddc943
commit
c82b758763
@ -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,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
<section
|
||||
class="process-details-pending-detail"
|
||||
data-pending-payment-detail-page
|
||||
data-approver="{{ $currentApproverLabel }}"
|
||||
class="process-details-summary-detail"
|
||||
data-approval-summary-detail-page
|
||||
data-summary-rows="{{ (int) ($summary['rows'] ?? 0) }}"
|
||||
data-summary-approvals="{{ (int) ($summary['approvals'] ?? 0) }}"
|
||||
data-summary-amount="{{ number_format((float) ($summary['amount_total'] ?? 0), 2, '.', '') }}"
|
||||
@ -66,15 +61,15 @@
|
||||
<div class="process-details-alert" role="alert">{{ $error }}</div>
|
||||
@endif
|
||||
|
||||
<div class="process-details-pending-detail__heading">
|
||||
<div class="process-details-summary-detail__heading">
|
||||
<div>
|
||||
<span class="process-details-pending-detail__eyebrow">表二 · 待付款明细</span>
|
||||
<strong>{{ $currentApproverLabel }}</strong>
|
||||
<span class="process-details-summary-detail__eyebrow">表二 · 费用明细</span>
|
||||
<strong>审批汇总</strong>
|
||||
</div>
|
||||
<a
|
||||
class="process-details-pending-detail__summary-link"
|
||||
href="{{ $pendingPaymentSummaryUrl }}"
|
||||
data-pending-payment-summary-tab
|
||||
class="process-details-summary-detail__summary-link"
|
||||
href="{{ $approvalSummaryUrl }}"
|
||||
data-approval-summary-tab
|
||||
>
|
||||
<span class="material-icons-outlined" aria-hidden="true">table_rows</span>
|
||||
返回表一
|
||||
@ -83,7 +78,7 @@
|
||||
|
||||
<div class="process-details-table-card">
|
||||
<div class="process-details-table-wrap">
|
||||
<table class="process-details-table process-details-pending-detail__table">
|
||||
<table class="process-details-table process-details-summary-detail__table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
@ -151,7 +146,7 @@
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="26" class="process-details-empty">
|
||||
当前审批人和筛选条件下没有待付款明细。
|
||||
当前筛选条件下没有审批费用明细。
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
@ -164,12 +159,12 @@
|
||||
<span>共 <b>{{ number_format($processRows->total()) }}</b> 行</span>
|
||||
<span>第 <b>{{ number_format($processDetailsCurrentPage) }}</b> / {{ number_format($processDetailsLastPage) }} 页</span>
|
||||
<span>本页 <b>{{ number_format($processRows->count()) }}</b> 行</span>
|
||||
<form class="process-details-page-size" method="GET" action="{{ $pageUrl ?? '' }}" data-pending-payment-detail-form>
|
||||
<form class="process-details-page-size" method="GET" action="{{ $pageUrl ?? '' }}" data-approval-summary-detail-form>
|
||||
@foreach ($detailFilters as $filterName => $filterValue)
|
||||
<input type="hidden" name="{{ $filterName }}" value="{{ $filterValue }}">
|
||||
@endforeach
|
||||
<label for="process-details-pending-detail-per-page">每页</label>
|
||||
<select id="process-details-pending-detail-per-page" name="per_page" onchange="this.form.requestSubmit ? this.form.requestSubmit() : this.form.submit()">
|
||||
<label for="process-details-approval-detail-per-page">每页</label>
|
||||
<select id="process-details-approval-detail-per-page" name="per_page" onchange="this.form.requestSubmit ? this.form.requestSubmit() : this.form.submit()">
|
||||
@foreach ($perPageOptions as $perPageOption)
|
||||
<option value="{{ $perPageOption }}" @selected($processRows->perPage() === $perPageOption)>
|
||||
{{ $perPageOption }}
|
||||
@ -180,7 +175,7 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<nav class="process-details-pagination" aria-label="当前审批人待付款明细分页">
|
||||
<nav class="process-details-pagination" aria-label="审批费用明细分页">
|
||||
@if ($processRows->onFirstPage())
|
||||
<span class="process-details-page-link is-disabled" aria-disabled="true" title="首页">
|
||||
<span class="material-icons-outlined" aria-hidden="true">first_page</span>
|
||||
@ -189,10 +184,10 @@
|
||||
<span class="material-icons-outlined" aria-hidden="true">chevron_left</span>
|
||||
</span>
|
||||
@else
|
||||
<a class="process-details-page-link" href="{{ $processRows->url(1) }}" title="首页" aria-label="首页" data-pending-payment-detail-link>
|
||||
<a class="process-details-page-link" href="{{ $processRows->url(1) }}" title="首页" aria-label="首页" data-approval-summary-detail-link>
|
||||
<span class="material-icons-outlined" aria-hidden="true">first_page</span>
|
||||
</a>
|
||||
<a class="process-details-page-link" href="{{ $processRows->previousPageUrl() }}" title="上一页" aria-label="上一页" data-pending-payment-detail-link>
|
||||
<a class="process-details-page-link" href="{{ $processRows->previousPageUrl() }}" title="上一页" aria-label="上一页" data-approval-summary-detail-link>
|
||||
<span class="material-icons-outlined" aria-hidden="true">chevron_left</span>
|
||||
</a>
|
||||
@endif
|
||||
@ -202,10 +197,10 @@
|
||||
</span>
|
||||
|
||||
@if ($processRows->hasMorePages())
|
||||
<a class="process-details-page-link" href="{{ $processRows->nextPageUrl() }}" title="下一页" aria-label="下一页" data-pending-payment-detail-link>
|
||||
<a class="process-details-page-link" href="{{ $processRows->nextPageUrl() }}" title="下一页" aria-label="下一页" data-approval-summary-detail-link>
|
||||
<span class="material-icons-outlined" aria-hidden="true">chevron_right</span>
|
||||
</a>
|
||||
<a class="process-details-page-link" href="{{ $processRows->url($processDetailsLastPage) }}" title="末页" aria-label="末页" data-pending-payment-detail-link>
|
||||
<a class="process-details-page-link" href="{{ $processRows->url($processDetailsLastPage) }}" title="末页" aria-label="末页" data-approval-summary-detail-link>
|
||||
<span class="material-icons-outlined" aria-hidden="true">last_page</span>
|
||||
</a>
|
||||
@else
|
||||
@ -218,13 +213,13 @@
|
||||
@endif
|
||||
|
||||
@if ($processDetailsLastPage > 1)
|
||||
<form class="process-details-page-jump" method="GET" action="{{ $pageUrl ?? '' }}" data-pending-payment-detail-form>
|
||||
<form class="process-details-page-jump" method="GET" action="{{ $pageUrl ?? '' }}" data-approval-summary-detail-form>
|
||||
<input type="hidden" name="per_page" value="{{ $processRows->perPage() }}">
|
||||
@foreach ($detailFilters as $filterName => $filterValue)
|
||||
<input type="hidden" name="{{ $filterName }}" value="{{ $filterValue }}">
|
||||
@endforeach
|
||||
<label for="process-details-pending-detail-page">跳到</label>
|
||||
<input id="process-details-pending-detail-page" type="number" name="page" min="1" max="{{ $processDetailsLastPage }}" value="{{ $processDetailsCurrentPage }}" inputmode="numeric" aria-label="跳到第几页">
|
||||
<label for="process-details-approval-detail-page">跳到</label>
|
||||
<input id="process-details-approval-detail-page" type="number" name="page" min="1" max="{{ $processDetailsLastPage }}" value="{{ $processDetailsCurrentPage }}" inputmode="numeric" aria-label="跳到第几页">
|
||||
<button type="submit">确定</button>
|
||||
</form>
|
||||
@endif
|
||||
@ -11,9 +11,9 @@
|
||||
$mirrorStaleAfterMinutes = $mirrorStaleAfterMinutes ?? ($pageData['mirrorStaleAfterMinutes'] ?? 15);
|
||||
$approvalSummaryMode = $approvalSummaryMode ?? ($pageData['approvalSummaryMode'] ?? false);
|
||||
$pendingPaymentSummaryMode = $pendingPaymentSummaryMode ?? ($pageData['pendingPaymentSummaryMode'] ?? false);
|
||||
$pendingPaymentDetailMode = $pendingPaymentDetailMode ?? ($pageData['pendingPaymentDetailMode'] ?? false);
|
||||
$approvalSummaryDetailMode = $approvalSummaryDetailMode ?? ($pageData['approvalSummaryDetailMode'] ?? false);
|
||||
$summaryMode = $approvalSummaryMode || $pendingPaymentSummaryMode;
|
||||
$summaryRowUnit = $pendingPaymentDetailMode
|
||||
$summaryRowUnit = $approvalSummaryDetailMode
|
||||
? '行'
|
||||
: ($pendingPaymentSummaryMode ? '个审批人' : ($approvalSummaryMode ? '个审批' : '行'));
|
||||
$backUrl = $backUrl ?? null;
|
||||
@ -81,21 +81,13 @@
|
||||
. ($exportFilters === [] ? '' : '?' . http_build_query($exportFilters));
|
||||
$approvalSummaryUrl = url('/' . company_id() . '/workspace/process-data/oa-process/approval-summary')
|
||||
. ($exportFilters === [] ? '' : '?' . http_build_query($exportFilters));
|
||||
$approvalSummaryDetailFilters = array_merge($exportFilters, ['approval_view' => 'detail']);
|
||||
$approvalSummaryDetailUrl = url(
|
||||
'/' . company_id() . '/workspace/process-data/oa-process/approval-summary',
|
||||
) . '?' . http_build_query($approvalSummaryDetailFilters);
|
||||
$pendingPaymentSummaryFilters = array_merge($exportFilters, ['payment_state' => '待付款']);
|
||||
$pendingPaymentSummaryUrl = url('/' . company_id() . '/workspace/process-data/oa-process/pending-payment-summary')
|
||||
. '?' . http_build_query($pendingPaymentSummaryFilters);
|
||||
$pendingPaymentSummaryBaseFilters = $filters;
|
||||
unset($pendingPaymentSummaryBaseFilters['current_approver_name']);
|
||||
$pendingPaymentSummaryBaseFilters['payment_state'] = '待付款';
|
||||
$pendingPaymentSummaryBaseFilters = array_filter(
|
||||
$pendingPaymentSummaryBaseFilters,
|
||||
static fn (mixed $value): bool => $value !== '' && $value !== null,
|
||||
);
|
||||
$pendingPaymentSummaryViewUrl ??= url(
|
||||
'/' . company_id() . '/workspace/process-data/oa-process/pending-payment-summary',
|
||||
) . ($pendingPaymentSummaryBaseFilters === []
|
||||
? ''
|
||||
: '?' . http_build_query($pendingPaymentSummaryBaseFilters));
|
||||
@endphp
|
||||
|
||||
@if ($summaryMode)
|
||||
@ -675,30 +667,30 @@
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.process-details-pending-detail-host {
|
||||
.process-details-summary-detail-host {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.process-details-pending-detail-host[hidden],
|
||||
.process-details-pending-summary-panel[hidden] {
|
||||
.process-details-summary-detail-host[hidden],
|
||||
.process-details-summary-panel[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.process-details-pending-detail-host.is-loading {
|
||||
.process-details-summary-detail-host.is-loading {
|
||||
min-height: 12rem;
|
||||
opacity: .58;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.process-details-pending-detail {
|
||||
.process-details-summary-detail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: .75rem;
|
||||
}
|
||||
|
||||
.process-details-pending-detail__heading {
|
||||
.process-details-summary-detail__heading {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
@ -710,25 +702,25 @@
|
||||
background: rgba(255, 253, 248, .9);
|
||||
}
|
||||
|
||||
.process-details-pending-detail__heading > div {
|
||||
.process-details-summary-detail__heading > div {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: .35rem .7rem;
|
||||
}
|
||||
|
||||
.process-details-pending-detail__eyebrow {
|
||||
.process-details-summary-detail__eyebrow {
|
||||
color: var(--vip-content-accent-dark, #856632);
|
||||
font-size: .72rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.process-details-pending-detail__heading strong {
|
||||
.process-details-summary-detail__heading strong {
|
||||
color: var(--vip-content-ink, #171717);
|
||||
font-size: .9rem;
|
||||
}
|
||||
|
||||
.process-details-pending-detail__summary-link {
|
||||
.process-details-summary-detail__summary-link {
|
||||
display: inline-flex;
|
||||
min-height: 1.9rem;
|
||||
align-items: center;
|
||||
@ -742,14 +734,14 @@
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.process-details-pending-detail__summary-link:hover,
|
||||
.process-details-pending-detail__summary-link:focus-visible {
|
||||
.process-details-summary-detail__summary-link:hover,
|
||||
.process-details-summary-detail__summary-link:focus-visible {
|
||||
border-color: var(--vip-content-accent-dark, #856632);
|
||||
background: var(--vip-content-accent-soft, #F7F0DE);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.process-details-pending-detail__table {
|
||||
.process-details-summary-detail__table {
|
||||
min-width: 118rem;
|
||||
}
|
||||
|
||||
@ -1279,38 +1271,27 @@
|
||||
<span class="material-icons-outlined" aria-hidden="true">{{ $pendingPaymentSummaryMode ? 'pending_actions' : 'fact_check' }}</span>
|
||||
{{ $pendingPaymentSummaryMode ? '待付款汇总' : '审批汇总' }}
|
||||
</span>
|
||||
@if ($pendingPaymentSummaryMode)
|
||||
<nav class="process-details-summary-tabs" aria-label="待付款汇总表切换">
|
||||
@if ($approvalSummaryMode)
|
||||
<nav class="process-details-summary-tabs" aria-label="审批汇总表切换">
|
||||
<a
|
||||
class="process-details-summary-tabs__tab"
|
||||
href="{{ $pendingPaymentSummaryViewUrl }}"
|
||||
data-pending-payment-summary-tab
|
||||
aria-selected="{{ $pendingPaymentDetailMode ? 'false' : 'true' }}"
|
||||
href="{{ $approvalSummaryUrl }}"
|
||||
data-approval-summary-tab
|
||||
aria-selected="{{ $approvalSummaryDetailMode ? 'false' : 'true' }}"
|
||||
>
|
||||
<span class="material-icons-outlined" aria-hidden="true">groups</span>
|
||||
表一 · 审批人汇总
|
||||
<span class="material-icons-outlined" aria-hidden="true">fact_check</span>
|
||||
表一 · 审批单汇总
|
||||
</a>
|
||||
<a
|
||||
class="process-details-summary-tabs__tab"
|
||||
href="{{ $approvalSummaryDetailUrl }}"
|
||||
data-approval-summary-detail-tab
|
||||
data-approval-summary-detail-link
|
||||
aria-selected="{{ $approvalSummaryDetailMode ? 'true' : 'false' }}"
|
||||
>
|
||||
<span class="material-icons-outlined" aria-hidden="true">receipt_long</span>
|
||||
表二 · 费用明细
|
||||
</a>
|
||||
@if ($pendingPaymentDetailMode)
|
||||
<a
|
||||
class="process-details-summary-tabs__tab"
|
||||
href="{{ request()->fullUrl() }}"
|
||||
data-pending-payment-detail-tab
|
||||
aria-selected="true"
|
||||
>
|
||||
<span class="material-icons-outlined" aria-hidden="true">receipt_long</span>
|
||||
表二 · 待付款明细
|
||||
</a>
|
||||
@else
|
||||
<span
|
||||
class="process-details-summary-tabs__tab"
|
||||
data-pending-payment-detail-tab
|
||||
aria-selected="false"
|
||||
aria-disabled="true"
|
||||
>
|
||||
<span class="material-icons-outlined" aria-hidden="true">receipt_long</span>
|
||||
表二 · 待付款明细
|
||||
</span>
|
||||
@endif
|
||||
</nav>
|
||||
@endif
|
||||
<a class="process-details-detail-heading__back" href="{{ $backUrl ?: $pageUrl }}">
|
||||
@ -1556,8 +1537,8 @@
|
||||
审批中的流程在出现结构化付款事实前显示“待付款”,已有付款事实时显示“已付款”。
|
||||
当前审批人、进入时间和已等待时长来自钉钉在途任务同步;页面每小时最多定向刷新当前页审批中的流程一次,
|
||||
已完成流程不重复回查,其他时间直接显示最近镜像,已等待按实际小时显示。
|
||||
@if ($pendingPaymentDetailMode)
|
||||
表二展示当前审批人名下待付款审批的费用明细;同一审批有多条费用时按明细行分别展示。
|
||||
@if ($approvalSummaryDetailMode)
|
||||
表二按表一的筛选条件展示审批费用明细;同一审批有多条费用时按明细行分别展示。
|
||||
@elseif ($pendingPaymentSummaryMode)
|
||||
待付款汇总按审批编号去重;同一审批有多个并行当前审批人时,分别计入每名审批人,金额和明细行数也分别展示在对应审批人名下。
|
||||
@endif
|
||||
@ -1567,12 +1548,12 @@
|
||||
</div>
|
||||
</details>
|
||||
|
||||
@if ($pendingPaymentDetailMode)
|
||||
<div data-pending-payment-detail-host>
|
||||
@include('business.pages.financial-operations.process-details-pending-payment-detail')
|
||||
@if ($approvalSummaryDetailMode)
|
||||
<div data-approval-summary-detail-host>
|
||||
@include('business.pages.financial-operations.process-details-approval-detail')
|
||||
</div>
|
||||
@else
|
||||
<div class="process-details-pending-summary-panel" data-pending-payment-summary-panel>
|
||||
<div class="process-details-summary-panel" data-approval-summary-panel>
|
||||
<div class="process-details-table-card">
|
||||
<div class="process-details-table-wrap">
|
||||
<table class="process-details-table{{ $summaryMode ? ' is-approval-summary' : '' }}">
|
||||
@ -1632,36 +1613,10 @@
|
||||
@if ($pendingPaymentSummaryMode)
|
||||
@php
|
||||
$approverName = (string) ($row->current_approver_name ?? '');
|
||||
$approverFilters = array_filter(
|
||||
array_merge($filters, [
|
||||
'payment_state' => '待付款',
|
||||
'current_approver_name' => $approverName === '未识别当前审批人' ? '' : $approverName,
|
||||
'pending_view' => 'detail',
|
||||
]),
|
||||
static fn (mixed $value): bool => $value !== '' && $value !== null,
|
||||
);
|
||||
$approverDetailUrl = url(
|
||||
'/' . company_id()
|
||||
. '/workspace/process-data/oa-process/pending-payment-summary',
|
||||
)
|
||||
. ($approverFilters === [] ? '' : '?' . http_build_query($approverFilters));
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $approverName }}</td>
|
||||
<td class="num">
|
||||
@if ($approverName === '未识别当前审批人')
|
||||
{{ number_format((int) ($row->pending_approvals ?? 0)) }}
|
||||
@else
|
||||
<a
|
||||
class="process-details-approver-count"
|
||||
href="{{ $approverDetailUrl }}"
|
||||
title="在本页查看该审批人的待付款明细"
|
||||
data-pending-payment-detail-link
|
||||
>
|
||||
{{ number_format((int) ($row->pending_approvals ?? 0)) }}
|
||||
</a>
|
||||
@endif
|
||||
</td>
|
||||
<td class="num">{{ number_format((int) ($row->pending_approvals ?? 0)) }}</td>
|
||||
<td class="num">{{ number_format((int) ($row->pending_rows ?? 0)) }}</td>
|
||||
<td class="num">{{ $money($row->amount_total ?? null) }}</td>
|
||||
<td>{{ $dateTimeText($row->earliest_task_started_at ?? null) }}</td>
|
||||
@ -1809,10 +1764,10 @@
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
@if ($pendingPaymentSummaryMode)
|
||||
@if ($approvalSummaryMode)
|
||||
<div
|
||||
class="process-details-pending-detail-host"
|
||||
data-pending-payment-detail-host
|
||||
class="process-details-summary-detail-host"
|
||||
data-approval-summary-detail-host
|
||||
hidden
|
||||
></div>
|
||||
@endif
|
||||
@ -1989,10 +1944,10 @@
|
||||
|
||||
(() => {
|
||||
const root = document.querySelector('.process-details-page');
|
||||
const summaryPanel = root?.querySelector('[data-pending-payment-summary-panel]');
|
||||
const detailHost = root?.querySelector('[data-pending-payment-detail-host]');
|
||||
const summaryTab = root?.querySelector('[data-pending-payment-summary-tab]');
|
||||
const detailTab = root?.querySelector('[data-pending-payment-detail-tab]');
|
||||
const summaryPanel = root?.querySelector('[data-approval-summary-panel]');
|
||||
const detailHost = root?.querySelector('[data-approval-summary-detail-host]');
|
||||
const summaryTab = root?.querySelector('[data-approval-summary-tab]');
|
||||
const detailTab = root?.querySelector('[data-approval-summary-detail-tab]');
|
||||
if (!root || !summaryPanel || !detailHost || !summaryTab || !detailTab) return;
|
||||
|
||||
const countFormatter = new Intl.NumberFormat('zh-CN');
|
||||
@ -2011,7 +1966,6 @@
|
||||
const setTabState = (detailMode) => {
|
||||
summaryTab.setAttribute('aria-selected', detailMode ? 'false' : 'true');
|
||||
detailTab.setAttribute('aria-selected', detailMode ? 'true' : 'false');
|
||||
detailTab.setAttribute('aria-disabled', detailMode ? 'false' : 'true');
|
||||
};
|
||||
|
||||
const setSummaryValue = (name, value) => {
|
||||
@ -2020,7 +1974,7 @@
|
||||
};
|
||||
|
||||
const applyDetailSummary = () => {
|
||||
const detail = detailHost.querySelector('[data-pending-payment-detail-page]');
|
||||
const detail = detailHost.querySelector('[data-approval-summary-detail-page]');
|
||||
if (!detail) return;
|
||||
setSummaryValue('rows', countFormatter.format(Number(detail.dataset.summaryRows || 0)));
|
||||
setSummaryValue('approvals', countFormatter.format(Number(detail.dataset.summaryApprovals || 0)));
|
||||
@ -2057,7 +2011,7 @@
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
if (!response.ok) throw new Error('pending payment detail unavailable');
|
||||
if (!response.ok) throw new Error('approval summary detail unavailable');
|
||||
return response.text();
|
||||
})
|
||||
.then((html) => {
|
||||
@ -2065,7 +2019,7 @@
|
||||
applyDetailSummary();
|
||||
if (pushHistory) {
|
||||
window.history.pushState(
|
||||
{ pendingPaymentView: 'detail' },
|
||||
{ approvalSummaryView: 'detail' },
|
||||
'',
|
||||
url,
|
||||
);
|
||||
@ -2079,7 +2033,7 @@
|
||||
.catch(() => {
|
||||
detailHost.innerHTML = `
|
||||
<div class="process-details-alert" role="alert">
|
||||
待付款明细载入失败,请稍后重试。
|
||||
审批费用明细载入失败,请稍后重试。
|
||||
</div>
|
||||
`;
|
||||
})
|
||||
@ -2091,12 +2045,12 @@
|
||||
};
|
||||
|
||||
root.addEventListener('click', (event) => {
|
||||
const summaryLink = event.target.closest('a[data-pending-payment-summary-tab]');
|
||||
const summaryLink = event.target.closest('a[data-approval-summary-tab]');
|
||||
if (summaryLink) {
|
||||
event.preventDefault();
|
||||
restoreSummary();
|
||||
window.history.pushState(
|
||||
{ pendingPaymentView: 'summary' },
|
||||
{ approvalSummaryView: 'summary' },
|
||||
'',
|
||||
summaryLink.href,
|
||||
);
|
||||
@ -2109,14 +2063,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const detailLink = event.target.closest('a[data-pending-payment-detail-link]');
|
||||
const detailLink = event.target.closest('a[data-approval-summary-detail-link]');
|
||||
if (!detailLink) return;
|
||||
event.preventDefault();
|
||||
showDetail(detailLink.href);
|
||||
});
|
||||
|
||||
root.addEventListener('submit', (event) => {
|
||||
const form = event.target.closest('form[data-pending-payment-detail-form]');
|
||||
const form = event.target.closest('form[data-approval-summary-detail-form]');
|
||||
if (!form) return;
|
||||
event.preventDefault();
|
||||
const url = new URL(form.action, window.location.href);
|
||||
@ -2128,7 +2082,7 @@
|
||||
|
||||
window.addEventListener('popstate', () => {
|
||||
const url = new URL(window.location.href);
|
||||
if (url.searchParams.get('pending_view') !== 'detail') {
|
||||
if (url.searchParams.get('approval_view') !== 'detail') {
|
||||
restoreSummary();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -274,6 +274,9 @@ class ProcessDetailsPageTest extends FeatureTestCase
|
||||
->assertSee('审批汇总')
|
||||
->assertSee('public/css/fonts/material-icons/style.css', false)
|
||||
->assertSeeInOrder(['审批汇总', '返回 OA 流程'])
|
||||
->assertSee('表一 · 审批单汇总')
|
||||
->assertSee('表二 · 费用明细')
|
||||
->assertSee('data-approval-summary-detail-link', false)
|
||||
->assertSee($businessId)
|
||||
->assertSee('<th>审批编号</th>', false)
|
||||
->assertSee('<th>提交人</th>', false)
|
||||
@ -303,6 +306,18 @@ class ProcessDetailsPageTest extends FeatureTestCase
|
||||
]))
|
||||
. '"',
|
||||
false,
|
||||
)
|
||||
->assertSee(
|
||||
'href="'
|
||||
. e(url('/1/workspace/process-data/oa-process/approval-summary')
|
||||
. '?'
|
||||
. http_build_query([
|
||||
'status' => '审批中',
|
||||
'current_approver_name' => '王五',
|
||||
'approval_view' => 'detail',
|
||||
]))
|
||||
. '"',
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@ -376,25 +391,11 @@ class ProcessDetailsPageTest extends FeatureTestCase
|
||||
->assertSee('1天6小时')
|
||||
->assertSee('1,200.50')
|
||||
->assertSee('同一审批有多个并行当前审批人时,分别计入每名审批人')
|
||||
->assertSee(
|
||||
'href="'
|
||||
. e(url('/1/workspace/process-data/oa-process/pending-payment-summary')
|
||||
. '?'
|
||||
. http_build_query([
|
||||
'status' => '审批中',
|
||||
'payment_state' => '待付款',
|
||||
'current_approver_name' => '王五',
|
||||
'pending_view' => 'detail',
|
||||
]))
|
||||
. '"',
|
||||
false,
|
||||
)
|
||||
->assertSee('data-pending-payment-detail-link', false)
|
||||
->assertSee('表一 · 审批人汇总')
|
||||
->assertSee('表二 · 待付款明细');
|
||||
->assertDontSee('data-pending-payment-detail-link', false)
|
||||
->assertDontSee('表二 · 待付款明细');
|
||||
}
|
||||
|
||||
public function test_pending_payment_summary_detail_stays_inside_the_subpage(): void
|
||||
public function test_approval_summary_detail_stays_inside_the_subpage(): void
|
||||
{
|
||||
$this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail());
|
||||
|
||||
@ -405,18 +406,18 @@ class ProcessDetailsPageTest extends FeatureTestCase
|
||||
$repository = Mockery::mock(DingProcessDetailMirrorRepository::class);
|
||||
$repository->shouldReceive('filterOptions')->once()
|
||||
->with(Mockery::on(static fn (array $filters): bool =>
|
||||
($filters['payment_state'] ?? '') === '待付款'
|
||||
($filters['status'] ?? '') === '审批中'
|
||||
&& ($filters['current_approver_name'] ?? '') === '王五'
|
||||
))
|
||||
->andReturn([
|
||||
'document_types' => ['公摊日常报销'],
|
||||
'statuses' => ['审批中'],
|
||||
'payment_states' => ['待付款'],
|
||||
'payment_states' => ['待付款', '已付款'],
|
||||
'current_approvers' => ['王五'],
|
||||
]);
|
||||
$repository->shouldReceive('paginate')->once()
|
||||
->with(Mockery::on(static fn (array $filters): bool =>
|
||||
($filters['payment_state'] ?? '') === '待付款'
|
||||
($filters['status'] ?? '') === '审批中'
|
||||
&& ($filters['current_approver_name'] ?? '') === '王五'
|
||||
), 1, 50)
|
||||
->andReturn([
|
||||
@ -465,15 +466,15 @@ class ProcessDetailsPageTest extends FeatureTestCase
|
||||
$this->app->instance(DingProcessDetailMirrorRepository::class, $repository);
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('business.process-details.pending-payment-summary', [
|
||||
->get(route('business.process-details.approval-summary', [
|
||||
'status' => '审批中',
|
||||
'payment_state' => '待付款',
|
||||
'current_approver_name' => '王五',
|
||||
'pending_view' => 'detail',
|
||||
'approval_view' => 'detail',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('表二 · 待付款明细')
|
||||
->assertSee('data-pending-payment-detail-page', false)
|
||||
->assertSee('表一 · 审批单汇总')
|
||||
->assertSee('表二 · 费用明细')
|
||||
->assertSee('data-approval-summary-detail-page', false)
|
||||
->assertSee('返回表一')
|
||||
->assertSee('202611181944000459490')
|
||||
->assertSee('财务中心')
|
||||
@ -490,18 +491,18 @@ class ProcessDetailsPageTest extends FeatureTestCase
|
||||
->assertSee('TEST-ACCOUNT-0001')
|
||||
->assertSee(
|
||||
'href="'
|
||||
. e(url('/1/workspace/process-data/oa-process/pending-payment-summary')
|
||||
. e(url('/1/workspace/process-data/oa-process/approval-summary')
|
||||
. '?'
|
||||
. http_build_query([
|
||||
'status' => '审批中',
|
||||
'payment_state' => '待付款',
|
||||
'current_approver_name' => '王五',
|
||||
]))
|
||||
. '"',
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
public function test_pending_payment_summary_detail_returns_a_local_fragment(): void
|
||||
public function test_approval_summary_detail_returns_a_local_fragment(): void
|
||||
{
|
||||
$this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail());
|
||||
|
||||
@ -509,7 +510,7 @@ class ProcessDetailsPageTest extends FeatureTestCase
|
||||
$repository->shouldReceive('filterOptions')->once()->andReturn([
|
||||
'document_types' => [],
|
||||
'statuses' => ['审批中'],
|
||||
'payment_states' => ['待付款'],
|
||||
'payment_states' => ['待付款', '已付款'],
|
||||
'current_approvers' => ['王五'],
|
||||
]);
|
||||
$repository->shouldReceive('paginate')->once()->andReturn([
|
||||
@ -540,16 +541,15 @@ class ProcessDetailsPageTest extends FeatureTestCase
|
||||
|
||||
$response = $this->loginAs()
|
||||
->withHeader('X-Requested-With', 'XMLHttpRequest')
|
||||
->get(route('business.process-details.pending-payment-summary', [
|
||||
->get(route('business.process-details.approval-summary', [
|
||||
'status' => '审批中',
|
||||
'payment_state' => '待付款',
|
||||
'current_approver_name' => '王五',
|
||||
'pending_view' => 'detail',
|
||||
'approval_view' => 'detail',
|
||||
]));
|
||||
|
||||
$response->assertOk()
|
||||
->assertHeader('Cache-Control', 'no-store, private')
|
||||
->assertSee('data-pending-payment-detail-page', false)
|
||||
->assertSee('data-approval-summary-detail-page', false)
|
||||
->assertSee('202611181944000459490')
|
||||
->assertDontSee('data-oa-refresh-button', false);
|
||||
}
|
||||
|
||||
@ -228,6 +228,7 @@ class ProcessDetailsPageDataTest extends TestCase
|
||||
);
|
||||
|
||||
$this->assertTrue($data['approvalSummaryMode']);
|
||||
$this->assertFalse($data['approvalSummaryDetailMode']);
|
||||
$this->assertArrayNotHasKey('approvalBusinessId', $data);
|
||||
$this->assertSame('', $data['filters']['business_id']);
|
||||
$this->assertSame(200, $data['processRows']->perPage());
|
||||
@ -288,38 +289,36 @@ class ProcessDetailsPageDataTest extends TestCase
|
||||
);
|
||||
|
||||
$this->assertTrue($data['pendingPaymentSummaryMode']);
|
||||
$this->assertFalse($data['pendingPaymentDetailMode']);
|
||||
$this->assertFalse($data['approvalSummaryMode']);
|
||||
$this->assertSame('待付款', $data['filters']['payment_state']);
|
||||
$this->assertSame($summaryRow, $data['processRows']->items()[0]);
|
||||
$this->assertSame(1, $data['summary']['approvers']);
|
||||
}
|
||||
|
||||
public function test_pending_payment_summary_detail_uses_approver_detail_rows(): void
|
||||
public function test_approval_summary_detail_uses_approval_detail_rows(): void
|
||||
{
|
||||
$detailRow = (object) [
|
||||
'business_id' => '202601011200000000001',
|
||||
'current_approver_name' => '王五',
|
||||
'amount' => 800,
|
||||
];
|
||||
$repository = $this->createMock(DingProcessDetailMirrorRepository::class);
|
||||
$repository->expects($this->once())
|
||||
->method('filterOptions')
|
||||
->with($this->callback(static fn (array $filters): bool =>
|
||||
$filters['payment_state'] === '待付款'
|
||||
&& $filters['current_approver_name'] === '王五'
|
||||
$filters['status'] === '审批中'
|
||||
&& $filters['payment_state'] === ''
|
||||
))
|
||||
->willReturn([
|
||||
'document_types' => [],
|
||||
'statuses' => ['审批中'],
|
||||
'payment_states' => ['待付款'],
|
||||
'current_approvers' => ['王五'],
|
||||
'payment_states' => ['待付款', '已付款'],
|
||||
'current_approvers' => [],
|
||||
]);
|
||||
$repository->expects($this->once())
|
||||
->method('paginate')
|
||||
->with($this->callback(static fn (array $filters): bool =>
|
||||
$filters['payment_state'] === '待付款'
|
||||
&& $filters['current_approver_name'] === '王五'
|
||||
$filters['status'] === '审批中'
|
||||
&& $filters['payment_state'] === ''
|
||||
), 2, 50)
|
||||
->willReturn([
|
||||
'data' => [$detailRow],
|
||||
@ -338,24 +337,24 @@ class ProcessDetailsPageDataTest extends TestCase
|
||||
'scope' => 'personal_permission',
|
||||
]);
|
||||
|
||||
$data = (new ProcessDetailsPageData($repository))->pendingPaymentSummaryPage(
|
||||
$data = (new ProcessDetailsPageData($repository))->approvalSummaryPage(
|
||||
Request::create(
|
||||
'/1/workspace/process-data/oa-process/pending-payment-summary',
|
||||
'/1/workspace/process-data/oa-process/approval-summary',
|
||||
'GET',
|
||||
[
|
||||
'status' => '审批中',
|
||||
'current_approver_name' => '王五',
|
||||
'pending_view' => 'detail',
|
||||
'approval_view' => 'detail',
|
||||
'page' => 2,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertTrue($data['pendingPaymentSummaryMode']);
|
||||
$this->assertTrue($data['pendingPaymentDetailMode']);
|
||||
$this->assertTrue($data['approvalSummaryMode']);
|
||||
$this->assertTrue($data['approvalSummaryDetailMode']);
|
||||
$this->assertArrayNotHasKey('pendingPaymentSummaryMode', $data);
|
||||
$this->assertSame($detailRow, $data['processRows']->items()[0]);
|
||||
$this->assertStringContainsString(
|
||||
'pending_view=detail',
|
||||
'approval_view=detail',
|
||||
$data['processRows']->url(3),
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user