feat(admin): 预种管理页添加"待合并总量"统计项
- planting-service stats 端点新增 pendingMergePortions 字段 从 PrePlantingPosition 表聚合 SUM(available_portions) - admin-web 统计卡片区新增"待合并总量(份)"显示 - 网格布局从 4 列调整为 5 列 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b3f3349190
commit
17df9b6df1
|
|
@ -244,6 +244,7 @@ export class InternalPrePlantingController {
|
|||
treesMergedAgg,
|
||||
totalUsers,
|
||||
pendingContracts,
|
||||
pendingPortionsAgg,
|
||||
] = await Promise.all([
|
||||
this.prisma.prePlantingOrder.count(),
|
||||
this.prisma.prePlantingOrder.aggregate({ _sum: { portionCount: true } }),
|
||||
|
|
@ -255,6 +256,7 @@ export class InternalPrePlantingController {
|
|||
this.prisma.prePlantingMerge.aggregate({ _sum: { treeCount: true } }),
|
||||
this.prisma.prePlantingPosition.count(),
|
||||
this.prisma.prePlantingMerge.count({ where: { contractStatus: 'PENDING' } }),
|
||||
this.prisma.prePlantingPosition.aggregate({ _sum: { availablePortions: true } }),
|
||||
]);
|
||||
|
||||
return {
|
||||
|
|
@ -265,6 +267,7 @@ export class InternalPrePlantingController {
|
|||
totalTreesMerged: treesMergedAgg._sum.treeCount ?? 0,
|
||||
totalUsers,
|
||||
pendingContracts,
|
||||
pendingMergePortions: pendingPortionsAgg._sum.availablePortions ?? 0,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -280,6 +280,12 @@ export default function PrePlantingPage() {
|
|||
</div>
|
||||
<div className={styles.prePlanting__statLabel}>总金额 (绿积分)</div>
|
||||
</div>
|
||||
<div className={styles.prePlanting__statCard}>
|
||||
<div className={styles.prePlanting__statValue}>
|
||||
{statsLoading ? '-' : formatNumber(stats?.pendingMergePortions ?? 0)}
|
||||
</div>
|
||||
<div className={styles.prePlanting__statLabel}>待合并总量(份)</div>
|
||||
</div>
|
||||
<div className={styles.prePlanting__statCard}>
|
||||
<div className={styles.prePlanting__statValue}>
|
||||
{statsLoading ? '-' : formatNumber(stats?.totalTreesMerged ?? 0)}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@
|
|||
// 统计卡片网格
|
||||
&__statsGrid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 16px;
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue