feat(mileage): 区域与车牌列表级联,并自动剔除越界车牌
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

- 后端: 选中 region 时基于该区域车辆重算 filters,车牌列表只展示该区域
- 前端: filterOptions.plates 收窄后自动从已选车牌中剔除不属于新区域的项

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-29 15:31:12 +08:00
parent e0c609168e
commit cab86556f3
2 changed files with 14 additions and 0 deletions

View File

@@ -201,6 +201,14 @@ export default function MonitoringView() {
loadFirstPage(); loadFirstPage();
}, [loadFirstPage]); }, [loadFirstPage]);
// 区域级联plate 选项收窄后,剔除已选但已不属于该区域的车牌
useEffect(() => {
if (filterPlates.length === 0) return;
const valid = new Set(filterOptions.plates);
const next = filterPlates.filter(p => valid.has(p));
if (next.length !== filterPlates.length) setFilterPlates(next);
}, [filterOptions.plates, filterPlates]);
// 下载当前筛选结果为 xlsx // 下载当前筛选结果为 xlsx
const handleDownload = useCallback(async () => { const handleDownload = useCallback(async () => {
if (exporting) return; if (exporting) return;

View File

@@ -100,6 +100,12 @@ app.get('/', async (c) => {
filters = buildDateFilters(allVehicles); // 重算筛选选项以匹配权限范围 filters = buildDateFilters(allVehicles); // 重算筛选选项以匹配权限范围
} }
// 区域级联:选中运营区域时,下游筛选选项(车牌等)只展示该区域车辆
if (filterParams.region) {
const regionScope = allVehicles.filter(v => v.region === filterParams.region);
filters = buildDateFilters(regionScope);
}
const filtered = applyFilters(allVehicles, filterParams); const filtered = applyFilters(allVehicles, filterParams);
const stats = { const stats = {