filteredAreas: Filtert Bereiche, die zu den erlaubten Systemen gehören. Das sorgt dafür, dass nur relevante Bereiche im Dropdown-Menü erscheinen.
This commit is contained in:
@@ -15,17 +15,35 @@ function DataSheet() {
|
|||||||
const GisSystemStatic = useRecoilValue(gisSystemStaticState);
|
const GisSystemStatic = useRecoilValue(gisSystemStaticState);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Filter unique areas
|
// Identify allowed system IDs
|
||||||
|
const allowedSystems = new Set(
|
||||||
|
GisSystemStatic.filter((system) => system.Allow === 1).map(
|
||||||
|
(system) => system.IdSystem
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Filter unique areas that belong to allowed systems
|
||||||
const seenNames = new Set();
|
const seenNames = new Set();
|
||||||
const filteredAreas = GisStationsStaticDistrict.filter((item) => {
|
const filteredAreas = GisStationsStaticDistrict.filter((item) => {
|
||||||
const isUnique = !seenNames.has(item.Area_Name);
|
const isUnique =
|
||||||
|
!seenNames.has(item.Area_Name) && allowedSystems.has(item.System);
|
||||||
if (isUnique) {
|
if (isUnique) {
|
||||||
seenNames.add(item.Area_Name);
|
seenNames.add(item.Area_Name);
|
||||||
|
console.log("Unique area:", item.Area_Name);
|
||||||
}
|
}
|
||||||
return isUnique;
|
return isUnique;
|
||||||
});
|
});
|
||||||
|
console.log("GisStationsStaticDistrict:", GisStationsStaticDistrict);
|
||||||
|
|
||||||
// Filter unique systems where Allow is 1
|
// Set the station listings
|
||||||
|
setStationListing(
|
||||||
|
filteredAreas.map((area, index) => ({
|
||||||
|
id: index + 1,
|
||||||
|
name: area.Area_Name,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
|
||||||
|
// Prepare system listings as before
|
||||||
const seenSystemNames = new Set();
|
const seenSystemNames = new Set();
|
||||||
const filteredSystems = GisSystemStatic.filter((item) => {
|
const filteredSystems = GisSystemStatic.filter((item) => {
|
||||||
const isUnique = !seenSystemNames.has(item.Name) && item.Allow === 1;
|
const isUnique = !seenSystemNames.has(item.Name) && item.Allow === 1;
|
||||||
@@ -35,13 +53,6 @@ function DataSheet() {
|
|||||||
return isUnique;
|
return isUnique;
|
||||||
});
|
});
|
||||||
|
|
||||||
setStationListing(
|
|
||||||
filteredAreas.map((area, index) => ({
|
|
||||||
id: index + 1,
|
|
||||||
name: area.Area_Name,
|
|
||||||
}))
|
|
||||||
);
|
|
||||||
|
|
||||||
setSystemListing(
|
setSystemListing(
|
||||||
filteredSystems.map((system, index) => ({
|
filteredSystems.map((system, index) => ({
|
||||||
id: index + 1,
|
id: index + 1,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ if (typeof window !== "undefined") {
|
|||||||
url_string = window.location.href; // Die vollständige URL als String
|
url_string = window.location.href; // Die vollständige URL als String
|
||||||
url = new URL(url_string); // Die URL als URL-Objekt, um Teile der URL einfacher zu handhaben
|
url = new URL(url_string); // Die URL als URL-Objekt, um Teile der URL einfacher zu handhaben
|
||||||
c = url.searchParams.get("m") || "10"; // Ein Parameter aus der URL, Standardwert ist '10'
|
c = url.searchParams.get("m") || "10"; // Ein Parameter aus der URL, Standardwert ist '10'
|
||||||
user = url.searchParams.get("u") || "484"; // Ein weiterer Parameter aus der URL, Standardwert ist '487 oder 484 oder 485 zu testen von Stationen ausblenden und einblenden in der Card'
|
user = url.searchParams.get("u") || "484"; // Ein weiterer Parameter aus der URL, Standardwert ist '484 admin zu testen von Stationen ausblenden und einblenden in der Card'
|
||||||
|
|
||||||
// Konstruktion von URLs, die auf spezifische Ressourcen auf dem Server zeigen
|
// Konstruktion von URLs, die auf spezifische Ressourcen auf dem Server zeigen
|
||||||
mapGisStationsStaticDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict?idMap=${c}&idUser=${user}`;
|
mapGisStationsStaticDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict?idMap=${c}&idUser=${user}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user