- 新增 assets:fusion.css(样板全量 token/组件/动效)、fusion.js(主题/抽屉/弹层/开关/按住确认/计算器引擎/三态全选/toast)、日夜 Logo - pageHeader/pageFooter 重写为样板侧栏骨架:固定侧栏导航、底部账户区、日间/夜间 token 切换、导入弹层、详情抽屉容器 - 新增工作台(风险入口卡+今日待办+快捷入口)、任务中心(四组分段+行内处理)、档案库目录管理三栏视图 - 档案列表恢复样板分段标签/KPI 卡/筛选条/批量条/行点击抽屉 - 档案详情页 + 右侧抽屉(概要/还款计划/附件三标签)按样板实现,保留全部真实绑定 - 新建/编辑档案改造为五步向导(字段与联动 JS 全量保留) - 登录页左右布局、用户管理、个人设置、删除审批、统计查询四口径页签、便捷查询、两个计算器全部按样板重构 - 页面 view 抽取至 app/views/pages/,index.php 保留全部业务逻辑与路由 - 业务功能零删减:表单字段、权限、审批闭环、导入导出、计算口径均不变 Co-authored-by: multica-agent <github@multica.ai>
93 lines
6.1 KiB
PHP
93 lines
6.1 KiB
PHP
<?php
|
|
requireLogin();
|
|
$kw = trim((string)($_GET['kw'] ?? ''));
|
|
$format = (string)($_GET['format'] ?? '');
|
|
$rows = $pdo->query('SELECT * FROM archives ORDER BY id DESC')->fetchAll();
|
|
$financeAll = loadFinanceConfigs();
|
|
$resultRows = array_values(array_filter(qqSearchGuarantorArchives($rows, $kw), function ($r) use ($financeAll) {
|
|
return archiveStatusIsOngoingAggregate((string)($r['end_date'] ?? ''), getArchiveFinanceConfig($financeAll, (int)$r['id']));
|
|
}));
|
|
if ($format === 'xlsx' && $kw !== '' && class_exists('\PhpOffice\PhpSpreadsheet\Spreadsheet') && class_exists('\PhpOffice\PhpSpreadsheet\Writer\Xlsx')) {
|
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|
$sheet->setTitle('对外担保查询');
|
|
$sheet->fromArray(['档案类型', '档案名称', '贷款机构/债权人', '借款主体', '担保人', '授信额度', '剩余额度', '到期日', '状态'], null, 'A1');
|
|
$sheet->fromArray(array_map(function ($r) use ($financeAll) {
|
|
return [
|
|
archiveKindLabel(normalizeArchiveKind((string)($r['archive_kind'] ?? ''))),
|
|
(string)($r['name'] ?? ''),
|
|
(string)($r['loan_institution'] ?? ''),
|
|
(string)($r['borrower'] ?? ''),
|
|
(string)($r['guarantor'] ?? ''),
|
|
amount($r['credit_limit'] !== null ? (float)$r['credit_limit'] : null),
|
|
amount($r['remaining_limit'] !== null ? (float)$r['remaining_limit'] : null),
|
|
(string)($r['end_date'] ?? ''),
|
|
archiveStatusWithConfig((string)($r['end_date'] ?? ''), getArchiveFinanceConfig($financeAll, (int)$r['id'])),
|
|
];
|
|
}, $resultRows), null, 'A2');
|
|
foreach (range('A', 'I') as $col) { $sheet->getColumnDimension($col)->setWidth(18); }
|
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
header('Content-Disposition: attachment; filename="' . rawurlencode('对外担保查询_' . date('Y-m-d') . '.xlsx') . '"');
|
|
(new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet))->save('php://output');
|
|
exit;
|
|
}
|
|
/* 视觉层辅助在 index.php 尾部(本组页面 require 点之后)定义,这里做呈现级兜底 */
|
|
if (!function_exists('fmtMoney')) {
|
|
function fmtMoney(?float $v): string
|
|
{
|
|
return $v === null ? '—' : number_format($v, 2, '.', ',');
|
|
}
|
|
}
|
|
if (!function_exists('statusPillCls')) {
|
|
function statusPillCls(string $s): string
|
|
{
|
|
return ['履行中' => 'ok', '逾期中' => 'over', '待更新' => 'pending', '已完成' => 'done'][$s] ?? 'pending';
|
|
}
|
|
}
|
|
pageHeader($me); ?>
|
|
<div class="page-head">
|
|
<div>
|
|
<h1 class="page-title">统计查询</h1>
|
|
<div class="page-sub">便捷统计 · 四个口径</div>
|
|
</div>
|
|
</div>
|
|
<div class="seg" role="tablist" aria-label="统计口径" style="margin-bottom:20px;">
|
|
<a role="tab" href="index.php?action=query_totals">总金额</a>
|
|
<a role="tab" href="index.php?action=query_payable_interest">应付本息</a>
|
|
<a role="tab" href="index.php?action=query_external_guarantee" data-active>对外担保</a>
|
|
<a role="tab" href="index.php?action=repayment_history">历史还款</a>
|
|
</div>
|
|
<form method="get" action="index.php" class="filter-bar" style="margin-top:0;">
|
|
<input type="hidden" name="action" value="query_external_guarantee">
|
|
<div class="search" style="min-width:260px;"><span aria-hidden="true">⌕</span><input type="search" name="kw" value="<?= e($kw) ?>" placeholder="按担保人检索" aria-label="按担保人检索" required></div>
|
|
<button type="submit" class="btn btn--plain">查询</button>
|
|
<span class="filter-note"><?= $kw === '' ? '仅列出「履行中 / 逾期中」档案' : count($resultRows) . ' 笔命中' ?></span>
|
|
<span class="filter-spacer"></span>
|
|
<?php if ($kw !== ''): ?><a class="btn btn--plain" href="index.php?action=query_external_guarantee&kw=<?= urlencode($kw) ?>&format=xlsx">导出 xlsx</a><?php endif; ?>
|
|
</form>
|
|
<div class="table-card">
|
|
<table>
|
|
<thead><tr><th>档案名称</th><th>被担保方</th><th>担保人</th><th>贷款机构</th><th class="cell-right">担保额度</th><th class="cell-right">剩余额度</th><th>状态</th></tr></thead>
|
|
<tbody>
|
|
<?php foreach ($resultRows as $i => $r):
|
|
$st = archiveStatusWithConfig((string)($r['end_date'] ?? ''), getArchiveFinanceConfig($financeAll, (int)$r['id']));
|
|
$stKey = statusPillCls($st);
|
|
?>
|
|
<tr class="stagger-in" style="animation-delay:<?= min($i, 8) * 45 ?>ms" data-open-detail="<?= (int)$r['id'] ?>" data-status="<?= $stKey ?>" tabindex="0" role="button" aria-label="查看 <?= e((string)($r['name'] ?? '')) ?> 档案详情">
|
|
<td><div class="cell-main"><?= e((string)($r['name'] ?? '')) ?></div><div class="cell-sub">#<?= (int)$r['id'] ?> · <?= e(archiveKindLabel(normalizeArchiveKind((string)($r['archive_kind'] ?? '')))) ?></div></td>
|
|
<td><?= e((string)($r['borrower'] ?? '')) ?></td>
|
|
<td><?= e((string)($r['guarantor'] ?? '')) ?></td>
|
|
<td><?= e((string)($r['loan_institution'] ?? '')) ?></td>
|
|
<td class="cell-right num"><?= e(fmtMoney($r['credit_limit'] !== null ? (float)$r['credit_limit'] : null)) ?></td>
|
|
<td class="cell-right num cell-remaining"><?= e(fmtMoney($r['remaining_limit'] !== null ? (float)$r['remaining_limit'] : null)) ?></td>
|
|
<td><span class="pill pill--<?= $stKey ?>"><?= e($st) ?></span></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php if (!$resultRows): ?>
|
|
<div style="padding:16px;"><div class="empty"><?= $kw === '' ? '请输入主体名称后查询' : '未命中履行中或逾期中的相关档案(已完成等已排除)' ?></div></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php pageFooter(); exit;
|