diff --git a/index.html b/index.html
index bf11662..e1b2327 100644
--- a/index.html
+++ b/index.html
@@ -3,7 +3,7 @@
- 羚牛 BI 报表
+ 羚牛氢能车辆资产
diff --git a/src/App.tsx b/src/App.tsx
index 7ce8329..01b559b 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -2225,9 +2225,9 @@ export default function App() {
{r.region}区域
- {r.totalAssets} |
- {r.operatingCount} |
- {r.pendingCount || ''} |
+ { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Operating' }); }}>{r.totalAssets} |
+ { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Operating' }); }}>{r.operatingCount} |
+ { e.stopPropagation(); if (r.pendingCount) setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Pending' }); }}>{r.pendingCount || ''} |
{r.customers.slice(0, 2).join(', ')} |
{isExpanded && r.cities.map((city) => {
@@ -2244,9 +2244,9 @@ export default function App() {
{city.city}
- {city.totalAssets} |
- {city.operatingCount} |
- {city.pendingCount || ''} |
+ { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, category: 'Operating' }); }}>{city.totalAssets} |
+ { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, category: 'Operating' }); }}>{city.operatingCount} |
+ { e.stopPropagation(); if (city.pendingCount) setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, category: 'Pending' }); }}>{city.pendingCount || ''} |
{city.customers.slice(0, 2).join(', ')} |
{isCityExpanded && city.typeBreakdown.map(tb => (
@@ -2255,9 +2255,9 @@ export default function App() {
{tb.type} 车型
- {tb.total} |
- {tb.operating} |
- {tb.inventory || ''} |
+ setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, category: 'Operating' })}>{tb.total} |
+ setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, category: 'Operating' })}>{tb.operating} |
+ { if (tb.inventory) setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, category: 'Pending' }); }}>{tb.inventory || ''} |
{tb.customers.slice(0, 2).join(', ')} |
))}
@@ -2273,78 +2273,59 @@ export default function App() {
{/* Mobile View (Region) */}
- {uniqueRegions.filter(r => !regionFilters.region || r === regionFilters.region).map((region) => {
- const regionStats = customerData.filter(s => {
- const matchRegion = s.region === region;
- const matchCity = !regionFilters.city || s.city === regionFilters.city;
- const matchCustomer = !regionFilters.customer || s.customer.toLowerCase().includes(regionFilters.customer.toLowerCase());
- return matchRegion && matchCity && matchCustomer;
- });
- const totalAssets = regionStats.reduce((acc, s) => acc + s.total, 0);
- if (totalAssets === 0) return null;
-
- const isExpanded = expandedRegions.has(region);
-
+ {regionData.filter(r => !regionFilters.region || r.region === regionFilters.region).map((r) => {
+ const isExpanded = expandedRegions.has(r.region);
return (
-
-
+
toggleRegion(region)}
+ onClick={() => toggleRegion(r.region)}
>
{isExpanded ? : }
- {region}区域
+ {r.region}区域
-
资产: {totalAssets}
+
资产: {r.totalAssets}
{isExpanded && (
<>
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Operating', source: 'asset' })}
+ onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Operating', source: 'asset' })}
>
运营中
-
{Math.floor(totalAssets * 0.8)}
+
{r.operatingCount}
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Pending', source: 'asset' })}
+ onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Pending', source: 'asset' })}
>
待交车
-
{Math.floor(totalAssets * 0.05)}
+
{r.pendingCount || ''}
- {['4.5T', '18T', '49T'].map(type => {
- const typeTotal = regionStats.reduce((acc, s) => {
- if (type === '4.5T') return acc + s.t4_5 + s.t4_5c;
- if (type === '18T') return acc + s.t18;
- if (type === '49T') return acc + s.t49;
- return acc;
- }, 0);
- if (typeTotal === 0) return null;
- return (
-
-
{type} 车型
-
- setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', type, category: 'Operating', source: 'asset' })}
- >
- 运:{Math.floor(typeTotal * 0.8)}
-
- setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', type, category: 'Pending', source: 'asset' })}
- >
- 待:{Math.floor(typeTotal * 0.05)}
-
-
+ {r.typeBreakdown.map(tb => (
+
+
{tb.type} 车型
+
+ setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, type: tb.type, category: 'Operating', source: 'asset' })}
+ >
+ 运:{tb.operating}
+
+ setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, type: tb.type, category: 'Pending', source: 'asset' })}
+ >
+ 待:{tb.inventory || ''}
+
- );
- })}
+
+ ))}
>
)}
diff --git a/src/server/routes/vehicles.ts b/src/server/routes/vehicles.ts
index 462440a..7df9f80 100644
--- a/src/server/routes/vehicles.ts
+++ b/src/server/routes/vehicles.ts
@@ -860,8 +860,14 @@ app.get('/list', async (c) => {
const { batch, model, location, status, category, vehicleType, manager, customer, isColdChain, isTrailer } = c.req.query();
let filtered = vehicles;
- if (vehicleType && VEHICLE_TYPE_FILTERS[vehicleType]) {
- filtered = filtered.filter(VEHICLE_TYPE_FILTERS[vehicleType]);
+ if (vehicleType) {
+ if (VEHICLE_TYPE_FILTERS[vehicleType]) {
+ filtered = filtered.filter(VEHICLE_TYPE_FILTERS[vehicleType]);
+ } else if (vehicleType === '4.5T') {
+ filtered = filtered.filter((v) => v.type === '4.5T');
+ } else {
+ filtered = filtered.filter((v) => v.type === vehicleType);
+ }
}
if (batch && batch !== 'All') {
filtered = filtered.filter((v) => (v.contractNo || '未知') === batch);