From c2d227059c7fb1d62fa4c4ac4a4a16caeeb6888f Mon Sep 17 00:00:00 2001 From: kkfluous Date: Thu, 2 Apr 2026 18:10:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E6=97=B6=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=8A=A8=E7=94=BB=20-=20KPI=E9=AA=A8?= =?UTF-8?q?=E6=9E=B6=E5=B1=8F+=E8=BD=A6=E8=BE=86=E5=88=97=E8=A1=A8skeleton?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- src/modules/mileage/MonitoringView.tsx | 33 +++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/modules/mileage/MonitoringView.tsx b/src/modules/mileage/MonitoringView.tsx index aad7a0d..21f8387 100644 --- a/src/modules/mileage/MonitoringView.tsx +++ b/src/modules/mileage/MonitoringView.tsx @@ -123,6 +123,7 @@ export default function MonitoringView() { const [page, setPage] = useState(1); const [hasMore, setHasMore] = useState(true); const [loadingMore, setLoadingMore] = useState(false); + const [pageLoading, setPageLoading] = useState(true); const [showBackToTop, setShowBackToTop] = useState(false); const PAGE_SIZE = 50; @@ -131,6 +132,7 @@ export default function MonitoringView() { // 加载首页数据 const loadFirstPage = useCallback(() => { + setPageLoading(true); fetchMonitoring({ sortBy, sortOrder, @@ -155,7 +157,7 @@ export default function MonitoringView() { setTotal(d.total); setPage(1); setHasMore(d.page < d.totalPages); - }).catch(() => {}); + }).catch(() => {}).finally(() => setPageLoading(false)); }, [sortBy, sortOrder, searchTerm, filterDept, filterCustomer, filterProject, filterEntity, filterRentStatus, filterPlatePrefix, filterTargetName, filterPlate, appliedMileageRange, filterDate]); // 加载更多 @@ -760,22 +762,21 @@ export default function MonitoringView() { {/* Sticky header: KPI + 清单标题 */}
-
+
{sortBy === 'today' ? '今日' : '累计'}总里程
- {Math.round(sortBy === 'today' ? stats.totalToday : stats.totalAll).toLocaleString()} - km + {pageLoading ?
: <>{Math.round(sortBy === 'today' ? stats.totalToday : stats.totalAll).toLocaleString()} km}
平均单车
-
{(stats.vehicleCount > 0 ? (sortBy === 'today' ? stats.totalToday : stats.totalAll) / stats.vehicleCount : 0).toFixed(0)}
+
{pageLoading ?
: (stats.vehicleCount > 0 ? (sortBy === 'today' ? stats.totalToday : stats.totalAll) / stats.vehicleCount : 0).toFixed(0)}
km/台
监控台数
-
{stats.vehicleCount}
+
{pageLoading ?
: stats.vehicleCount}
@@ -788,6 +789,26 @@ export default function MonitoringView() { {/* Vehicle List */}
+ {pageLoading && ( +
+ {Array.from({ length: 6 }).map((_, i) => ( +
+
+
+
+
+
+
+
+
+
+
+
+
+ ))} +
+ )} +
{filteredVehicles.map((v) => (