feat(map): streamline search and detail panels

This commit is contained in:
lingniu
2026-08-11 17:41:45 +08:00
parent c42570c0ee
commit f535b1570b
4 changed files with 1415 additions and 32 deletions
+20 -1
View File
@@ -12,6 +12,13 @@ dashboard = {
{ vin: 'VIN-X-1', plateNumber: '观光车001', online: false, dailyMileageKm: 0, locationAvailable: false }
]
};
filterState.query = '粤a';
assert.deepEqual(filteredVehicles().map(vehicle => vehicle.vin), ['VIN-GD-1']);
filterState.query = '';
vehicleFilterGroups.provinces = [{ adcode: '440000', vehicles: [dashboard.vehicles[0]] }];
filterState.province = '440000';
assert.deepEqual(filteredVehicles().map(vehicle => vehicle.vin), ['VIN-GD-1']);
filterState.province = '';
const areaNode = {
groupByPosition(points) {
return [
@@ -75,12 +82,24 @@ assert.equal(points.find(node => node.nameZh === '粤A00001').online, 1);
dashboard = {
stations: [
{ id: 'GD-1', name: '广州合作站', province: '广东省', city: '广州市', longitude: 113.2, latitude: 23.1, cooperative: true, totalHydrogenKg: 20 },
{ id: 'GD-1', name: '广州合作站', province: '广东省', city: '广州市', address: '广东省广州市黄埔区开源大道1号', longitude: 113.2, latitude: 23.1, cooperative: true, totalHydrogenKg: 20 },
{ id: 'GD-2', name: '佛山外部站', province: '广东省', city: '佛山市', longitude: 113.1, latitude: 23.0, cooperative: false, totalHydrogenKg: 10 },
{ id: 'ZJ-1', name: '嘉兴合作站', province: '浙江省', city: '嘉兴市', longitude: 120.7, latitude: 30.7, cooperative: true, totalHydrogenKg: 30 }
]
};
currentMode = 'station';
assert.equal(stationDistrictName(dashboard.stations[0]), '黄埔区');
assert.equal(fuzzySearchScore('广州', 'gz'), 3);
assert.equal(fuzzySearchScore('广州市', '广州'), 1);
assert.ok(stationLocationOptions().some(option => option.level === 'district' && option.district === '黄埔区'));
filterState.query = '合作';
assert.deepEqual(filteredStations().map(station => station.id).sort(), ['GD-1', 'ZJ-1']);
filterState.query = '';
filterState.province = '广东省'; filterState.city = '广州市'; filterState.district = '黄埔区';
assert.deepEqual(filteredStations().map(station => station.id), ['GD-1']);
filterState.province = ''; filterState.city = ''; filterState.district = '';
assert.ok(Math.abs(distanceKm([113, 23], [114, 23]) - 102.4) < 1);
assert.equal(locationCoordinates({ coords: { longitude: NaN, latitude: 23 } }), null);
map = {
getZoom: () => 12,
getBounds: () => ({