Merge remote-tracking branch 'origin/main' into feature/limeng-planting-workbench-ui
This commit is contained in:
commit
41d44982d7
@ -65,6 +65,29 @@ 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,
|
||||
@ -72,6 +95,7 @@ class ProcessDetails extends Controller
|
||||
'page' => ['slug' => 'oa-process', 'title' => 'OA流程'],
|
||||
'pageUrl' => url('/' . company_id() . '/workspace/process-data/oa-process/pending-payment-summary'),
|
||||
'backUrl' => $backUrl,
|
||||
'pendingPaymentSummaryUrl' => $pendingPaymentSummaryUrl,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -209,16 +209,23 @@ 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, 'per_page' => $perPage],
|
||||
[
|
||||
...$filters,
|
||||
'pending_view' => $pendingPaymentDetailMode ? 'detail' : '',
|
||||
'per_page' => $perPage,
|
||||
],
|
||||
static fn (mixed $value): bool => $value !== '' && $value !== null,
|
||||
);
|
||||
|
||||
try {
|
||||
$options = $this->repository->filterOptions($filters);
|
||||
$result = $this->repository->paginatePendingPaymentApprovers($filters, $page, $perPage);
|
||||
$result = $pendingPaymentDetailMode
|
||||
? $this->repository->paginate($filters, $page, $perPage)
|
||||
: $this->repository->paginatePendingPaymentApprovers($filters, $page, $perPage);
|
||||
|
||||
return [
|
||||
'processRows' => new LengthAwarePaginator(
|
||||
@ -243,6 +250,7 @@ class ProcessDetailsPageData
|
||||
'error' => null,
|
||||
'approvalSummaryMode' => false,
|
||||
'pendingPaymentSummaryMode' => true,
|
||||
'pendingPaymentDetailMode' => $pendingPaymentDetailMode,
|
||||
];
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
@ -273,6 +281,7 @@ class ProcessDetailsPageData
|
||||
'error' => 'OA流程镜像尚未完成导入,请稍后重试。',
|
||||
'approvalSummaryMode' => false,
|
||||
'pendingPaymentSummaryMode' => true,
|
||||
'pendingPaymentDetailMode' => $pendingPaymentDetailMode,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -3086,7 +3086,21 @@
|
||||
filterSearch.addEventListener('input', showFilterOptions);
|
||||
filterSearch.addEventListener('keydown', (event) => {
|
||||
if (event.key !== 'Enter' || !activeFilter) return;
|
||||
if (event.isComposing || event.keyCode === 229) return;
|
||||
event.preventDefault();
|
||||
const normalizedQuery = filterSearch.value.trim().toLocaleLowerCase('zh-CN');
|
||||
if (normalizedQuery !== '') {
|
||||
const matchingValues = activeFilter.values.filter(
|
||||
(value) => value.toLocaleLowerCase('zh-CN').includes(normalizedQuery),
|
||||
);
|
||||
if (matchingValues.length === 0) return;
|
||||
activeFilter.selection = new Set(matchingValues);
|
||||
activeFilter.state.filter = matchingValues.length === activeFilter.values.length
|
||||
? null
|
||||
: new Set(matchingValues);
|
||||
activeFilter.applyTable();
|
||||
filterCount.textContent = `全部账户 · 已选 ${activeFilter.selection.size} / ${activeFilter.values.length}`;
|
||||
}
|
||||
activeFilter.applyServer();
|
||||
});
|
||||
sortButtons.forEach((button) => {
|
||||
|
||||
@ -11,8 +11,11 @@
|
||||
$mirrorStaleAfterMinutes = $mirrorStaleAfterMinutes ?? ($pageData['mirrorStaleAfterMinutes'] ?? 15);
|
||||
$approvalSummaryMode = $approvalSummaryMode ?? ($pageData['approvalSummaryMode'] ?? false);
|
||||
$pendingPaymentSummaryMode = $pendingPaymentSummaryMode ?? ($pageData['pendingPaymentSummaryMode'] ?? false);
|
||||
$pendingPaymentDetailMode = $pendingPaymentDetailMode ?? ($pageData['pendingPaymentDetailMode'] ?? false);
|
||||
$summaryMode = $approvalSummaryMode || $pendingPaymentSummaryMode;
|
||||
$summaryRowUnit = $pendingPaymentSummaryMode ? '个审批人' : ($approvalSummaryMode ? '个审批' : '行');
|
||||
$summaryRowUnit = $pendingPaymentDetailMode
|
||||
? '行'
|
||||
: ($pendingPaymentSummaryMode ? '个审批人' : ($approvalSummaryMode ? '个审批' : '行'));
|
||||
$backUrl = $backUrl ?? null;
|
||||
$perPageOptions = \Modules\EcommerceFinance\View\ProcessDetailsPageData::PER_PAGE_OPTIONS;
|
||||
$scopeLabel ??= (($scope ?? null) === 'personal_permission'
|
||||
@ -81,6 +84,18 @@
|
||||
$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)
|
||||
@ -615,6 +630,129 @@
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.process-details-summary-tabs {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: .25rem;
|
||||
min-height: 2rem;
|
||||
padding: .15rem;
|
||||
border: 1px solid var(--vip-border, #D8D2C7);
|
||||
border-radius: .5rem;
|
||||
background: #faf9f6;
|
||||
}
|
||||
|
||||
.process-details-summary-tabs__tab {
|
||||
display: inline-flex;
|
||||
min-height: 1.65rem;
|
||||
align-items: center;
|
||||
gap: .3rem;
|
||||
padding: 0 .65rem;
|
||||
border: 0;
|
||||
border-radius: .35rem;
|
||||
background: transparent;
|
||||
color: var(--vip-content-muted, #595959);
|
||||
font: inherit;
|
||||
font-size: .72rem;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.process-details-summary-tabs__tab:hover,
|
||||
.process-details-summary-tabs__tab:focus-visible {
|
||||
color: var(--vip-content-accent-dark, #856632);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.process-details-summary-tabs__tab[aria-selected="true"] {
|
||||
background: #fff;
|
||||
color: var(--vip-content-accent-dark, #856632);
|
||||
box-shadow: inset 0 -2px 0 var(--vip-content-accent, #B9954F);
|
||||
}
|
||||
|
||||
.process-details-summary-tabs__tab[aria-disabled="true"] {
|
||||
color: #9a958c;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.process-details-pending-detail-host {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.process-details-pending-detail-host[hidden],
|
||||
.process-details-pending-summary-panel[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.process-details-pending-detail-host.is-loading {
|
||||
min-height: 12rem;
|
||||
opacity: .58;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.process-details-pending-detail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: .75rem;
|
||||
}
|
||||
|
||||
.process-details-pending-detail__heading {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: .55rem .9rem;
|
||||
padding: .7rem .9rem;
|
||||
border: 1px solid rgba(185, 149, 79, .36);
|
||||
border-radius: .65rem;
|
||||
background: rgba(255, 253, 248, .9);
|
||||
}
|
||||
|
||||
.process-details-pending-detail__heading > div {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: .35rem .7rem;
|
||||
}
|
||||
|
||||
.process-details-pending-detail__eyebrow {
|
||||
color: var(--vip-content-accent-dark, #856632);
|
||||
font-size: .72rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.process-details-pending-detail__heading strong {
|
||||
color: var(--vip-content-ink, #171717);
|
||||
font-size: .9rem;
|
||||
}
|
||||
|
||||
.process-details-pending-detail__summary-link {
|
||||
display: inline-flex;
|
||||
min-height: 1.9rem;
|
||||
align-items: center;
|
||||
gap: .25rem;
|
||||
padding: 0 .65rem;
|
||||
border: 1px solid var(--vip-border, #D8D2C7);
|
||||
border-radius: .45rem;
|
||||
color: var(--vip-content-accent-dark, #856632);
|
||||
font-size: .72rem;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.process-details-pending-detail__summary-link:hover,
|
||||
.process-details-pending-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 {
|
||||
min-width: 106rem;
|
||||
}
|
||||
|
||||
.process-details-note-disclosure {
|
||||
margin: -.35rem 0 0;
|
||||
border: 1px solid rgba(185, 149, 79, .34);
|
||||
@ -1141,6 +1279,40 @@
|
||||
<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="待付款汇总表切换">
|
||||
<a
|
||||
class="process-details-summary-tabs__tab"
|
||||
href="{{ $pendingPaymentSummaryViewUrl }}"
|
||||
data-pending-payment-summary-tab
|
||||
aria-selected="{{ $pendingPaymentDetailMode ? 'false' : 'true' }}"
|
||||
>
|
||||
<span class="material-icons-outlined" aria-hidden="true">groups</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 }}">
|
||||
<span class="material-icons-outlined" aria-hidden="true">arrow_back</span>
|
||||
返回 OA 流程
|
||||
@ -1328,11 +1500,11 @@
|
||||
@endif
|
||||
|
||||
<div class="process-details-summary{{ $summaryMode ? '' : ' has-pending-metric' }}">
|
||||
<div class="item"><span>明细行数</span><b>{{ number_format((int) ($summary['rows'] ?? 0)) }}</b></div>
|
||||
<div class="item"><span>明细行数</span><b data-process-summary="rows">{{ number_format((int) ($summary['rows'] ?? 0)) }}</b></div>
|
||||
@if ($approvalSummaryMode)
|
||||
<div class="item"><span>审批单数</span><b>{{ number_format((int) ($summary['approvals'] ?? 0)) }}</b></div>
|
||||
<div class="item"><span>审批单数</span><b data-process-summary="approvals">{{ number_format((int) ($summary['approvals'] ?? 0)) }}</b></div>
|
||||
@elseif ($pendingPaymentSummaryMode)
|
||||
<div class="item"><span>待付款单数</span><b>{{ number_format((int) ($summary['approvals'] ?? 0)) }}</b></div>
|
||||
<div class="item"><span>待付款单数</span><b data-process-summary="approvals">{{ number_format((int) ($summary['approvals'] ?? 0)) }}</b></div>
|
||||
@else
|
||||
<a
|
||||
class="item is-link"
|
||||
@ -1359,11 +1531,11 @@
|
||||
@endif
|
||||
<div class="item">
|
||||
<span>应付金额合计</span>
|
||||
<b>{{ $money($summary['amount_total'] ?? null) }}</b>
|
||||
<b data-process-summary="amount">{{ $money($summary['amount_total'] ?? null) }}</b>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span>实际付款合计</span>
|
||||
<b>{{ $money($summary['bank_amount_total'] ?? null) }}</b>
|
||||
<b data-process-summary="bank-amount">{{ $money($summary['bank_amount_total'] ?? null) }}</b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1384,7 +1556,9 @@
|
||||
审批中的流程在出现结构化付款事实前显示“待付款”,已有付款事实时显示“已付款”。
|
||||
当前审批人、进入时间和已等待时长来自钉钉在途任务同步;页面每小时最多定向刷新当前页审批中的流程一次,
|
||||
已完成流程不重复回查,其他时间直接显示最近镜像,已等待按实际小时显示。
|
||||
@if ($pendingPaymentSummaryMode)
|
||||
@if ($pendingPaymentDetailMode)
|
||||
表二展示当前审批人名下待付款审批的费用明细;同一审批有多条费用时按明细行分别展示。
|
||||
@elseif ($pendingPaymentSummaryMode)
|
||||
待付款汇总按审批编号去重;同一审批有多个并行当前审批人时,分别计入每名审批人,金额和明细行数也分别展示在对应审批人名下。
|
||||
@endif
|
||||
当前展示的是当前账号权限范围内可读取的钉钉OA审批流程;
|
||||
@ -1393,6 +1567,12 @@
|
||||
</div>
|
||||
</details>
|
||||
|
||||
@if ($pendingPaymentDetailMode)
|
||||
<div data-pending-payment-detail-host>
|
||||
@include('business.pages.financial-operations.process-details-pending-payment-detail')
|
||||
</div>
|
||||
@else
|
||||
<div class="process-details-pending-summary-panel" data-pending-payment-summary-panel>
|
||||
<div class="process-details-table-card">
|
||||
<div class="process-details-table-wrap">
|
||||
<table class="process-details-table{{ $summaryMode ? ' is-approval-summary' : '' }}">
|
||||
@ -1453,10 +1633,14 @@
|
||||
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')
|
||||
$approverDetailUrl = url(
|
||||
'/' . company_id()
|
||||
. '/workspace/process-data/oa-process/pending-payment-summary',
|
||||
)
|
||||
. ($approverFilters === [] ? '' : '?' . http_build_query($approverFilters));
|
||||
@endphp
|
||||
<tr>
|
||||
@ -1465,7 +1649,12 @@
|
||||
@if ($approverName === '未识别当前审批人')
|
||||
{{ number_format((int) ($row->pending_approvals ?? 0)) }}
|
||||
@else
|
||||
<a class="process-details-approver-count" href="{{ $approverDetailUrl }}" title="查看该审批人的待付款流程">
|
||||
<a
|
||||
class="process-details-approver-count"
|
||||
href="{{ $approverDetailUrl }}"
|
||||
title="在本页查看该审批人的待付款明细"
|
||||
data-pending-payment-detail-link
|
||||
>
|
||||
{{ number_format((int) ($row->pending_approvals ?? 0)) }}
|
||||
</a>
|
||||
@endif
|
||||
@ -1613,6 +1802,15 @@
|
||||
</nav>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
@if ($pendingPaymentSummaryMode)
|
||||
<div
|
||||
class="process-details-pending-detail-host"
|
||||
data-pending-payment-detail-host
|
||||
hidden
|
||||
></div>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@ -1783,6 +1981,155 @@
|
||||
}
|
||||
})();
|
||||
|
||||
(() => {
|
||||
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]');
|
||||
if (!root || !summaryPanel || !detailHost || !summaryTab || !detailTab) return;
|
||||
|
||||
const countFormatter = new Intl.NumberFormat('zh-CN');
|
||||
const moneyFormatter = new Intl.NumberFormat('zh-CN', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
});
|
||||
const originalSummary = {
|
||||
rows: root.querySelector('[data-process-summary="rows"]')?.textContent || '0',
|
||||
approvals: root.querySelector('[data-process-summary="approvals"]')?.textContent || '0',
|
||||
amount: root.querySelector('[data-process-summary="amount"]')?.textContent || '0.00',
|
||||
bankAmount: root.querySelector('[data-process-summary="bank-amount"]')?.textContent || '0.00',
|
||||
};
|
||||
let loading = false;
|
||||
|
||||
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) => {
|
||||
const element = root.querySelector(`[data-process-summary="${name}"]`);
|
||||
if (element) element.textContent = value;
|
||||
};
|
||||
|
||||
const applyDetailSummary = () => {
|
||||
const detail = detailHost.querySelector('[data-pending-payment-detail-page]');
|
||||
if (!detail) return;
|
||||
setSummaryValue('rows', countFormatter.format(Number(detail.dataset.summaryRows || 0)));
|
||||
setSummaryValue('approvals', countFormatter.format(Number(detail.dataset.summaryApprovals || 0)));
|
||||
setSummaryValue('amount', moneyFormatter.format(Number(detail.dataset.summaryAmount || 0)));
|
||||
setSummaryValue('bank-amount', moneyFormatter.format(Number(detail.dataset.summaryBankAmount || 0)));
|
||||
};
|
||||
|
||||
const restoreSummary = () => {
|
||||
summaryPanel.hidden = false;
|
||||
detailHost.hidden = true;
|
||||
detailHost.replaceChildren();
|
||||
setSummaryValue('rows', originalSummary.rows.trim());
|
||||
setSummaryValue('approvals', originalSummary.approvals.trim());
|
||||
setSummaryValue('amount', originalSummary.amount.trim());
|
||||
setSummaryValue('bank-amount', originalSummary.bankAmount.trim());
|
||||
setTabState(false);
|
||||
};
|
||||
|
||||
const showDetail = (url, pushHistory = true) => {
|
||||
if (loading) return;
|
||||
loading = true;
|
||||
detailHost.hidden = false;
|
||||
summaryPanel.hidden = true;
|
||||
detailHost.classList.add('is-loading');
|
||||
detailHost.setAttribute('aria-busy', 'true');
|
||||
setTabState(true);
|
||||
|
||||
window.fetch(url, {
|
||||
credentials: 'same-origin',
|
||||
cache: 'no-store',
|
||||
headers: {
|
||||
Accept: 'text/html',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
if (!response.ok) throw new Error('pending payment detail unavailable');
|
||||
return response.text();
|
||||
})
|
||||
.then((html) => {
|
||||
detailHost.innerHTML = html;
|
||||
applyDetailSummary();
|
||||
if (pushHistory) {
|
||||
window.history.pushState(
|
||||
{ pendingPaymentView: 'detail' },
|
||||
'',
|
||||
url,
|
||||
);
|
||||
}
|
||||
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
detailHost.scrollIntoView({
|
||||
block: 'start',
|
||||
behavior: reduceMotion ? 'auto' : 'smooth',
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
detailHost.innerHTML = `
|
||||
<div class="process-details-alert" role="alert">
|
||||
待付款明细载入失败,请稍后重试。
|
||||
</div>
|
||||
`;
|
||||
})
|
||||
.finally(() => {
|
||||
loading = false;
|
||||
detailHost.classList.remove('is-loading');
|
||||
detailHost.removeAttribute('aria-busy');
|
||||
});
|
||||
};
|
||||
|
||||
root.addEventListener('click', (event) => {
|
||||
const summaryLink = event.target.closest('a[data-pending-payment-summary-tab]');
|
||||
if (summaryLink) {
|
||||
event.preventDefault();
|
||||
restoreSummary();
|
||||
window.history.pushState(
|
||||
{ pendingPaymentView: 'summary' },
|
||||
'',
|
||||
summaryLink.href,
|
||||
);
|
||||
summaryPanel.scrollIntoView({
|
||||
block: 'start',
|
||||
behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
||||
? 'auto'
|
||||
: 'smooth',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const detailLink = event.target.closest('a[data-pending-payment-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]');
|
||||
if (!form) return;
|
||||
event.preventDefault();
|
||||
const url = new URL(form.action, window.location.href);
|
||||
new URLSearchParams(new FormData(form)).forEach((value, key) => {
|
||||
if (String(value).trim() !== '') url.searchParams.set(key, value);
|
||||
});
|
||||
showDetail(url.toString());
|
||||
});
|
||||
|
||||
window.addEventListener('popstate', () => {
|
||||
const url = new URL(window.location.href);
|
||||
if (url.searchParams.get('pending_view') !== 'detail') {
|
||||
restoreSummary();
|
||||
return;
|
||||
}
|
||||
showDetail(url.toString(), false);
|
||||
});
|
||||
})();
|
||||
|
||||
(() => {
|
||||
const root = document.querySelector('[data-oa-refresh-business-ids]');
|
||||
if (! root) return;
|
||||
|
||||
@ -0,0 +1,228 @@
|
||||
@php
|
||||
$filters ??= [];
|
||||
$summary ??= [];
|
||||
$error ??= null;
|
||||
$pendingPaymentSummaryUrl ??= $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);
|
||||
$text = static fn (mixed $value): string => $value === null || trim((string) $value) === ''
|
||||
? '-'
|
||||
: (string) $value;
|
||||
$statusClass = static fn (string $status): string => match ($status) {
|
||||
'已完成' => 'is-success',
|
||||
'审批中' => 'is-warning',
|
||||
'已拒绝', '已终止', '已撤销', '失败' => 'is-danger',
|
||||
default => 'is-neutral',
|
||||
};
|
||||
$paymentStateClass = static fn (string $state): string => match ($state) {
|
||||
'已付款' => 'is-success',
|
||||
'待付款', '未确认' => 'is-warning',
|
||||
'不涉及付款' => 'is-neutral',
|
||||
default => 'is-neutral',
|
||||
};
|
||||
$dateTimeText = static fn (mixed $value): string =>
|
||||
\Modules\EcommerceFinance\Support\OaProcessTime::formatDateTime($value);
|
||||
$waitText = static fn (mixed $value): string =>
|
||||
\Modules\EcommerceFinance\Support\OaProcessTime::formatWaiting($value);
|
||||
$currentApproverText = static function (object $row): string {
|
||||
$approver = trim((string) ($row->current_approver_name ?? ''));
|
||||
if ($approver !== '') {
|
||||
return $approver;
|
||||
}
|
||||
|
||||
if (($row->status ?? '') === '审批中') {
|
||||
return trim((string) ($row->current_task_name ?? '')) === ''
|
||||
? '审批节点同步中'
|
||||
: '审批人待补全';
|
||||
}
|
||||
|
||||
return '-';
|
||||
};
|
||||
$processDetailsLastPage = max($processRows->lastPage(), 1);
|
||||
$processDetailsCurrentPage = min(max($processRows->currentPage(), 1), $processDetailsLastPage);
|
||||
$detailFilters = array_filter(
|
||||
[...$filters, 'pending_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 }}"
|
||||
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, '.', '') }}"
|
||||
data-summary-bank-amount="{{ number_format((float) ($summary['bank_amount_total'] ?? 0), 2, '.', '') }}"
|
||||
>
|
||||
@if ($error)
|
||||
<div class="process-details-alert" role="alert">{{ $error }}</div>
|
||||
@endif
|
||||
|
||||
<div class="process-details-pending-detail__heading">
|
||||
<div>
|
||||
<span class="process-details-pending-detail__eyebrow">表二 · 待付款明细</span>
|
||||
<strong>{{ $currentApproverLabel }}</strong>
|
||||
</div>
|
||||
<a
|
||||
class="process-details-pending-detail__summary-link"
|
||||
href="{{ $pendingPaymentSummaryUrl }}"
|
||||
data-pending-payment-summary-tab
|
||||
>
|
||||
<span class="material-icons-outlined" aria-hidden="true">table_rows</span>
|
||||
返回表一
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="process-details-table-card">
|
||||
<div class="process-details-table-wrap">
|
||||
<table class="process-details-table process-details-pending-detail__table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th>审批编号</th>
|
||||
<th>发起人部门</th>
|
||||
<th>发起人</th>
|
||||
<th>审批状态</th>
|
||||
<th>付款状态</th>
|
||||
<th>当前审批人</th>
|
||||
<th>进入时间</th>
|
||||
<th>已等待</th>
|
||||
<th>单据类型</th>
|
||||
<th>用途/摘要</th>
|
||||
<th>发票抬头</th>
|
||||
<th>出纳打款抬头</th>
|
||||
<th class="center">单据内行号</th>
|
||||
<th>科目编码</th>
|
||||
<th>科目名称</th>
|
||||
<th class="num">金额(元)</th>
|
||||
<th>银行科目编码</th>
|
||||
<th>银行科目名称</th>
|
||||
<th class="num">付款明细金额</th>
|
||||
<th class="num">付款差额</th>
|
||||
<th>付款方式</th>
|
||||
<th>打款时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($processRows as $row)
|
||||
<tr>
|
||||
<td class="num">{{ ($processRows->currentPage() - 1) * $processRows->perPage() + $loop->iteration }}</td>
|
||||
<td>{{ $row->business_id }}</td>
|
||||
<td class="wide" title="{{ $row->originator_department ?? '' }}">{{ $text($row->originator_department ?? null) }}</td>
|
||||
<td>{{ $text($row->originator_name ?? null) }}</td>
|
||||
<td class="center">
|
||||
<span class="process-details-status {{ $statusClass((string) ($row->status ?? '')) }}">{{ $text($row->status ?? null) }}</span>
|
||||
</td>
|
||||
<td class="center">
|
||||
<span class="process-details-status {{ $paymentStateClass((string) ($row->payment_state ?? '')) }}">{{ $text($row->payment_state ?? null) }}</span>
|
||||
</td>
|
||||
<td class="wide" title="{{ $currentApproverText($row) }}">{{ $text($currentApproverText($row)) }}</td>
|
||||
<td>{{ $dateTimeText($row->current_task_started_at ?? null) }}</td>
|
||||
<td>{{ $waitText($row->current_task_started_at ?? null) }}</td>
|
||||
<td>{{ $text($row->document_type ?? null) }}</td>
|
||||
<td class="wide" title="{{ $row->purpose ?? '' }}">{{ $text($row->purpose ?? null) }}</td>
|
||||
<td class="wide" title="{{ $row->invoice_title ?? '' }}">{{ $text($row->invoice_title ?? null) }}</td>
|
||||
<td class="wide" title="{{ $row->cashier_payment_title ?? '' }}">{{ $text($row->cashier_payment_title ?? null) }}</td>
|
||||
<td class="center">{{ $row->line_no ?? '-' }}</td>
|
||||
<td>{{ $text($row->account_code ?? null) }}</td>
|
||||
<td class="wide" title="{{ $row->account_name ?? '' }}">{{ $text($row->account_name ?? null) }}</td>
|
||||
<td class="num">{{ $money($row->amount ?? null) }}</td>
|
||||
<td>{{ $text($row->bank_account_code ?? null) }}</td>
|
||||
<td class="wide" title="{{ $row->bank_account_name ?? '' }}">{{ $text($row->bank_account_name ?? null) }}</td>
|
||||
<td class="num">{{ $money($row->bank_amount ?? null) }}</td>
|
||||
<td class="num {{ abs((float) ($row->payment_difference ?? 0)) > 0.01 ? 'is-difference' : '' }}">{{ $money($row->payment_difference ?? null) }}</td>
|
||||
<td>{{ $text($row->payment_method ?? null) }}</td>
|
||||
<td>{{ $text($row->paid_at ?? null) }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="23" class="process-details-empty">
|
||||
当前审批人和筛选条件下没有待付款明细。
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<footer class="process-details-footer">
|
||||
<div class="process-details-footer__summary">
|
||||
<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>
|
||||
@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()">
|
||||
@foreach ($perPageOptions as $perPageOption)
|
||||
<option value="{{ $perPageOption }}" @selected($processRows->perPage() === $perPageOption)>
|
||||
{{ $perPageOption }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span>行</span>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</span>
|
||||
<span class="process-details-page-link is-disabled" aria-disabled="true" title="上一页">
|
||||
<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>
|
||||
<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>
|
||||
<span class="material-icons-outlined" aria-hidden="true">chevron_left</span>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
<span class="process-details-page-current" aria-current="page">
|
||||
{{ number_format($processDetailsCurrentPage) }} / {{ number_format($processDetailsLastPage) }}
|
||||
</span>
|
||||
|
||||
@if ($processRows->hasMorePages())
|
||||
<a class="process-details-page-link" href="{{ $processRows->nextPageUrl() }}" title="下一页" aria-label="下一页" data-pending-payment-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>
|
||||
<span class="material-icons-outlined" aria-hidden="true">last_page</span>
|
||||
</a>
|
||||
@else
|
||||
<span class="process-details-page-link is-disabled" aria-disabled="true" title="下一页">
|
||||
<span class="material-icons-outlined" aria-hidden="true">chevron_right</span>
|
||||
</span>
|
||||
<span class="process-details-page-link is-disabled" aria-disabled="true" title="末页">
|
||||
<span class="material-icons-outlined" aria-hidden="true">last_page</span>
|
||||
</span>
|
||||
@endif
|
||||
|
||||
@if ($processDetailsLastPage > 1)
|
||||
<form class="process-details-page-jump" method="GET" action="{{ $pageUrl ?? '' }}" data-pending-payment-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="跳到第几页">
|
||||
<button type="submit">确定</button>
|
||||
</form>
|
||||
@endif
|
||||
</nav>
|
||||
</footer>
|
||||
</div>
|
||||
</section>
|
||||
@ -444,6 +444,18 @@ class NonStoreAccountMonitorTest extends FeatureTestCase
|
||||
$this->assertStringNotContainsString('分页占位公司001', $tableMatch[0]);
|
||||
$this->assertStringContainsString('全部账户 · 已选', $html);
|
||||
$this->assertStringContainsString('data-nsm-filter-key="account_display_short"', $html);
|
||||
$this->assertStringContainsString(
|
||||
'const matchingValues = activeFilter.values.filter(',
|
||||
$html,
|
||||
);
|
||||
$this->assertStringContainsString(
|
||||
'activeFilter.selection = new Set(matchingValues);',
|
||||
$html,
|
||||
);
|
||||
$this->assertStringContainsString(
|
||||
'if (event.isComposing || event.keyCode === 229) return;',
|
||||
$html,
|
||||
);
|
||||
$this->assertSame(1, preg_match(
|
||||
'/const serverColumnFilterValues = (.*?);\s*const serverColumnFilters/s',
|
||||
$html,
|
||||
|
||||
@ -369,18 +369,173 @@ class ProcessDetailsPageTest extends FeatureTestCase
|
||||
->assertSee('同一审批有多个并行当前审批人时,分别计入每名审批人')
|
||||
->assertSee(
|
||||
'href="'
|
||||
. e(url('/1/workspace/process-data/oa-process')
|
||||
. 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('表二 · 待付款明细');
|
||||
}
|
||||
|
||||
public function test_pending_payment_summary_detail_stays_inside_the_subpage(): void
|
||||
{
|
||||
$this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail());
|
||||
|
||||
$startedAt = \Modules\EcommerceFinance\Support\OaProcessTime::now()
|
||||
->subHours(9)
|
||||
->startOfMinute()
|
||||
->format('Y-m-d H:i:s');
|
||||
$repository = Mockery::mock(DingProcessDetailMirrorRepository::class);
|
||||
$repository->shouldReceive('filterOptions')->once()
|
||||
->with(Mockery::on(static fn (array $filters): bool =>
|
||||
($filters['payment_state'] ?? '') === '待付款'
|
||||
&& ($filters['current_approver_name'] ?? '') === '王五'
|
||||
))
|
||||
->andReturn([
|
||||
'document_types' => ['公摊日常报销'],
|
||||
'statuses' => ['审批中'],
|
||||
'payment_states' => ['待付款'],
|
||||
'current_approvers' => ['王五'],
|
||||
]);
|
||||
$repository->shouldReceive('paginate')->once()
|
||||
->with(Mockery::on(static fn (array $filters): bool =>
|
||||
($filters['payment_state'] ?? '') === '待付款'
|
||||
&& ($filters['current_approver_name'] ?? '') === '王五'
|
||||
), 1, 50)
|
||||
->andReturn([
|
||||
'data' => [
|
||||
(object) [
|
||||
'business_id' => '202611181944000459490',
|
||||
'line_no' => 1,
|
||||
'originator_department' => '财务中心',
|
||||
'originator_name' => '陈阳',
|
||||
'status' => '审批中',
|
||||
'payment_state' => '待付款',
|
||||
'current_approver_name' => '王五',
|
||||
'current_task_started_at' => $startedAt,
|
||||
'document_type' => '其他',
|
||||
'purpose' => '待付款费用',
|
||||
'invoice_title' => '江苏简尚品牌管理有限公司',
|
||||
'cashier_payment_title' => '江苏简尚品牌管理有限公司',
|
||||
'account_code' => '5602.04',
|
||||
'account_name' => '管理费用_办公费',
|
||||
'amount' => 880.00,
|
||||
'bank_account_code' => '1002.01.001',
|
||||
'bank_account_name' => '华夏银行-测试',
|
||||
'bank_amount' => 0.00,
|
||||
'payment_difference' => 880.00,
|
||||
'payment_method' => '',
|
||||
'paid_at' => '',
|
||||
],
|
||||
],
|
||||
'total' => 1,
|
||||
'summary' => [
|
||||
'rows' => 1,
|
||||
'approvals' => 1,
|
||||
'pending_payment_approvals' => 1,
|
||||
'amount_total' => 880.0,
|
||||
'bank_amount_total' => 0.0,
|
||||
],
|
||||
'status' => 'succeeded',
|
||||
'last_synced_at' => '2026-11-19 09:57:00',
|
||||
'sync_stale' => false,
|
||||
'sync_stale_after_minutes' => 15,
|
||||
'scope' => 'personal_permission',
|
||||
]);
|
||||
$this->app->instance(DingProcessDetailMirrorRepository::class, $repository);
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('business.process-details.pending-payment-summary', [
|
||||
'status' => '审批中',
|
||||
'payment_state' => '待付款',
|
||||
'current_approver_name' => '王五',
|
||||
'pending_view' => 'detail',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('表二 · 待付款明细')
|
||||
->assertSee('data-pending-payment-detail-page', false)
|
||||
->assertSee('返回表一')
|
||||
->assertSee('202611181944000459490')
|
||||
->assertSee('财务中心')
|
||||
->assertSee('陈阳')
|
||||
->assertSee('880.00')
|
||||
->assertSee('<th>发票抬头</th>', false)
|
||||
->assertSee('<th>出纳打款抬头</th>', false)
|
||||
->assertSee('<th class="num">付款差额</th>', false)
|
||||
->assertSee(
|
||||
'href="'
|
||||
. e(url('/1/workspace/process-data/oa-process/pending-payment-summary')
|
||||
. '?'
|
||||
. http_build_query([
|
||||
'status' => '审批中',
|
||||
'payment_state' => '待付款',
|
||||
]))
|
||||
. '"',
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
public function test_pending_payment_summary_detail_returns_a_local_fragment(): void
|
||||
{
|
||||
$this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail());
|
||||
|
||||
$repository = Mockery::mock(DingProcessDetailMirrorRepository::class);
|
||||
$repository->shouldReceive('filterOptions')->once()->andReturn([
|
||||
'document_types' => [],
|
||||
'statuses' => ['审批中'],
|
||||
'payment_states' => ['待付款'],
|
||||
'current_approvers' => ['王五'],
|
||||
]);
|
||||
$repository->shouldReceive('paginate')->once()->andReturn([
|
||||
'data' => [
|
||||
(object) [
|
||||
'business_id' => '202611181944000459490',
|
||||
'current_approver_name' => '王五',
|
||||
'status' => '审批中',
|
||||
'payment_state' => '待付款',
|
||||
'amount' => 100.0,
|
||||
],
|
||||
],
|
||||
'total' => 1,
|
||||
'summary' => [
|
||||
'rows' => 1,
|
||||
'approvals' => 1,
|
||||
'pending_payment_approvals' => 1,
|
||||
'amount_total' => 100.0,
|
||||
'bank_amount_total' => 0.0,
|
||||
],
|
||||
'status' => 'succeeded',
|
||||
'last_synced_at' => null,
|
||||
'sync_stale' => false,
|
||||
'sync_stale_after_minutes' => 15,
|
||||
'scope' => 'personal_permission',
|
||||
]);
|
||||
$this->app->instance(DingProcessDetailMirrorRepository::class, $repository);
|
||||
|
||||
$response = $this->loginAs()
|
||||
->withHeader('X-Requested-With', 'XMLHttpRequest')
|
||||
->get(route('business.process-details.pending-payment-summary', [
|
||||
'status' => '审批中',
|
||||
'payment_state' => '待付款',
|
||||
'current_approver_name' => '王五',
|
||||
'pending_view' => 'detail',
|
||||
]));
|
||||
|
||||
$response->assertOk()
|
||||
->assertHeader('Cache-Control', 'no-store, private')
|
||||
->assertSee('data-pending-payment-detail-page', false)
|
||||
->assertSee('202611181944000459490')
|
||||
->assertDontSee('data-oa-refresh-button', false);
|
||||
}
|
||||
|
||||
public function test_refresh_endpoint_only_queues_active_workflows(): void
|
||||
{
|
||||
$this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail());
|
||||
|
||||
@ -288,12 +288,78 @@ 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
|
||||
{
|
||||
$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'] === '王五'
|
||||
))
|
||||
->willReturn([
|
||||
'document_types' => [],
|
||||
'statuses' => ['审批中'],
|
||||
'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'] === '王五'
|
||||
), 2, 50)
|
||||
->willReturn([
|
||||
'data' => [$detailRow],
|
||||
'total' => 51,
|
||||
'summary' => [
|
||||
'rows' => 51,
|
||||
'approvals' => 20,
|
||||
'pending_payment_approvals' => 20,
|
||||
'amount_total' => 800,
|
||||
'bank_amount_total' => 0,
|
||||
],
|
||||
'status' => 'succeeded',
|
||||
'last_synced_at' => null,
|
||||
'sync_stale' => false,
|
||||
'sync_stale_after_minutes' => 15,
|
||||
'scope' => 'personal_permission',
|
||||
]);
|
||||
|
||||
$data = (new ProcessDetailsPageData($repository))->pendingPaymentSummaryPage(
|
||||
Request::create(
|
||||
'/1/workspace/process-data/oa-process/pending-payment-summary',
|
||||
'GET',
|
||||
[
|
||||
'status' => '审批中',
|
||||
'current_approver_name' => '王五',
|
||||
'pending_view' => 'detail',
|
||||
'page' => 2,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertTrue($data['pendingPaymentSummaryMode']);
|
||||
$this->assertTrue($data['pendingPaymentDetailMode']);
|
||||
$this->assertSame($detailRow, $data['processRows']->items()[0]);
|
||||
$this->assertStringContainsString(
|
||||
'pending_view=detail',
|
||||
$data['processRows']->url(3),
|
||||
);
|
||||
}
|
||||
|
||||
public function test_paid_date_range_accepts_legacy_date_and_normalizes_reversed_range(): void
|
||||
{
|
||||
$this->assertSame(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user