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) => (