generated from it-at-m/oss-repository-en-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/dave 108 export pdf report (#90)
* Options beim Laden der Daten uebergeben * Options beim Laden der Daten uebergeben * default angepasst * default angepasst * fix DateManipulation * change preselected Zeitblock Spitzenstunde * fix typo * darstellungsoptionen angelegt * rename field * himmelsrichtung ueberarbeitet * fix divider, fix rules, Darstellungsoptionen Ganglinie angebunden * neue historie angelegt * add TODO * neue History eingebaut * icon hinzugefuegt * fix standort error * zwei varianten gebaut * DTO's an Backenddatenstruktur angepasst * Messstelle und Zaehlstelle in eigene Methoden aufgeteilt * Report fuer Messstelle Listenausgabe erweitert * Konsolen-Fehler gefixed * fehlerausgaben bei MQ's angeapsst * fix it * refactor * pdf report menue erstellt * reset checkboxes * fix Anmerkungen
- Loading branch information
1 parent
ec99db0
commit c85ee0f
Showing
13 changed files
with
339 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
246 changes: 246 additions & 0 deletions
246
frontend/src/components/messstelle/PdfReportMenueMessstelle.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
<template> | ||
<div> | ||
<v-dialog | ||
v-model="openDialog" | ||
max-width="900px" | ||
@click:outside="closeDialog" | ||
> | ||
<v-card | ||
width="900px" | ||
flat | ||
> | ||
<v-card-title> | ||
<v-icon left>mdi-file-chart</v-icon> | ||
Auswahl zum PDF Report | ||
</v-card-title> | ||
|
||
<v-list | ||
flat | ||
subheader | ||
three-line | ||
> | ||
<v-subheader | ||
>Wählen Sie die Inhalte, die dem PDF Report hinzugefügt | ||
werden sollen.</v-subheader | ||
> | ||
<v-list-item> | ||
<v-list-item-action> | ||
<v-checkbox v-model="messstelleninfo"></v-checkbox> | ||
</v-list-item-action> | ||
|
||
<v-list-item-content> | ||
<v-list-item-title | ||
>Messstelleninformationen</v-list-item-title | ||
> | ||
<v-list-item-subtitle | ||
>Folgende Informationen werden im PDF Report | ||
eingetragen: Messstelle-ID, ID & Standort der | ||
Messquerschnitte, Stadtbezirk, | ||
Messstellenkommentar. | ||
</v-list-item-subtitle> | ||
</v-list-item-content> | ||
</v-list-item> | ||
|
||
<v-list-item> | ||
<v-list-item-action> | ||
<v-checkbox v-model="messinfo"></v-checkbox> | ||
</v-list-item-action> | ||
|
||
<v-list-item-content> | ||
<v-list-item-title | ||
>Messinformationen</v-list-item-title | ||
> | ||
<v-list-item-subtitle | ||
>Folgende Informationen werden im PDF Report | ||
eingetragen: Zeitraum von ... bis / Einzeltag, | ||
Wochentag, Statistik zur Auswertung (Anzahl | ||
plausible Wochentage) | ||
</v-list-item-subtitle> | ||
</v-list-item-content> | ||
</v-list-item> | ||
|
||
<v-list-item> | ||
<v-list-item-action> | ||
<v-checkbox v-model="legende"></v-checkbox> | ||
</v-list-item-action> | ||
|
||
<v-list-item-content> | ||
<v-list-item-title>Legende</v-list-item-title> | ||
<v-list-item-subtitle | ||
>Die Legende enthält Kurzbeschreibungen der | ||
einzelnen Zählattribute, z.B. für den | ||
Kraftfahrzeugverkehr, Schwerverkehr etc. | ||
</v-list-item-subtitle> | ||
</v-list-item-content> | ||
</v-list-item> | ||
</v-list> | ||
<v-footer> | ||
<v-spacer></v-spacer> | ||
<v-btn | ||
color="secondary" | ||
@click="saveItems" | ||
> | ||
Aktualisiere PDF Report | ||
</v-btn> | ||
<v-spacer></v-spacer> | ||
<v-btn | ||
color="grey lighten-1" | ||
@click="closeDialog" | ||
> | ||
Abbrechen | ||
</v-btn> | ||
<v-spacer></v-spacer> | ||
</v-footer> | ||
</v-card> | ||
</v-dialog> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed, Ref, ref } from "vue"; | ||
import MessstelleInfoDTO from "@/types/messstelle/MessstelleInfoDTO"; | ||
import { useStore } from "@/api/util/useStore"; | ||
import { Levels } from "@/api/error"; | ||
import HeadingAsset from "@/types/pdfreport/assets/HeadingAsset"; | ||
import AssetTypesEnum from "@/types/pdfreport/assets/AssetTypesEnum"; | ||
import TextAsset from "@/types/pdfreport/assets/TextAsset"; | ||
import MessstelleOptionsDTO from "@/types/messstelle/MessstelleOptionsDTO"; | ||
import BaseAsset from "@/types/pdfreport/assets/BaseAsset"; | ||
import { useDateUtils } from "@/util/DateUtils"; | ||
import { tagesTypText } from "@/types/enum/TagesTyp"; | ||
interface Props { | ||
value: boolean; | ||
} | ||
const props = defineProps<Props>(); | ||
const openDialog = computed({ | ||
get: () => props.value, | ||
set: (payload: boolean) => emits("input", payload), | ||
}); | ||
const emits = defineEmits<{ | ||
(e: "close"): void; | ||
(e: "input", v: boolean): void; | ||
}>(); | ||
const store = useStore(); | ||
const dateUtils = useDateUtils(); | ||
const messstelleninfo = ref(false); | ||
const messinfo = ref(false); | ||
const legende = ref(false); | ||
const messstelle: Ref<MessstelleInfoDTO> = computed(() => { | ||
return store.getters["messstelleInfo/getMessstelleInfo"]; | ||
}); | ||
const options: Ref<MessstelleOptionsDTO> = computed(() => { | ||
return store.getters["filteroptionsMessstelle/getFilteroptions"]; | ||
}); | ||
function closeDialog(): void { | ||
resetCheckboxes(); | ||
emits("close"); | ||
} | ||
function resetCheckboxes(): void { | ||
messstelleninfo.value = false; | ||
messinfo.value = false; | ||
legende.value = false; | ||
} | ||
function saveItems(): void { | ||
if (messstelleninfo.value) { | ||
createMessstelleInfo(); | ||
} | ||
if (messinfo.value) { | ||
createMessInfo(); | ||
} | ||
if (legende.value) { | ||
createLegende(); | ||
} | ||
store.dispatch("snackbar/showToast", { | ||
snackbarTextPart1: `Die ausgewählten Informationen wurden dem PDF Report hinzugefügt.`, | ||
level: Levels.SUCCESS, | ||
}); | ||
closeDialog(); | ||
} | ||
function createMessstelleInfo(): void { | ||
const assets: Array<BaseAsset> = []; | ||
const headline = new HeadingAsset( | ||
`Info für Messstelle Id ${messstelle.value.mstId}`, | ||
AssetTypesEnum.HEADING3 | ||
); | ||
assets.push(headline); | ||
const messquerschnittIds = options.value.messquerschnittIds; | ||
const messquerschnittInfoDTOS = messstelle.value.messquerschnitte.filter( | ||
(value) => messquerschnittIds.includes(value.mqId) | ||
); | ||
if (messquerschnittInfoDTOS.length > 0) { | ||
let text = "Messquerschnitt(e):<br/>"; | ||
messquerschnittInfoDTOS.forEach((value) => { | ||
text += `- ${value.mqId}`; | ||
if (value.standort) { | ||
text += ` - ${value.standort}`; | ||
} | ||
text += "<br/>\n"; | ||
}); | ||
assets.push(new TextAsset(text)); | ||
} | ||
const stadtbezirk = new TextAsset( | ||
`Stadtbezirk: ${messstelle.value.stadtbezirk} (${messstelle.value.stadtbezirkNummer})` | ||
); | ||
assets.push(stadtbezirk); | ||
let kommentar = new TextAsset( | ||
`Messstellenkommentar: ${messstelle.value.kommentar ?? "---"}` | ||
); | ||
assets.push(kommentar); | ||
store.dispatch("addAssets", assets); | ||
} | ||
function createMessInfo(): void { | ||
const assets: Array<BaseAsset> = []; | ||
const zeitraum = options.value.zeitraum; | ||
let header = `Info zur Messung vom ${dateUtils.formatDate(zeitraum[0])}`; | ||
if (zeitraum.length === 2) { | ||
header += ` bis ${dateUtils.formatDate(zeitraum[1])}`; | ||
} | ||
header += ` (Mst-Id ${messstelle.value.mstId})`; | ||
assets.push(new HeadingAsset(header, AssetTypesEnum.HEADING3)); | ||
if (options.value.tagesTyp) { | ||
const wochentag = new TextAsset( | ||
`Wochentag (Tagestyp): ${tagesTypText.get(options.value.tagesTyp)}` | ||
); | ||
assets.push(wochentag); | ||
} | ||
const statistikAuswertung = new TextAsset( | ||
`Auswertungsstatistik: Exisitiert noch nicht.` | ||
); | ||
assets.push(statistikAuswertung); | ||
store.dispatch("addAssets", assets); | ||
} | ||
function createLegende(): void { | ||
const ueberschrift = new HeadingAsset( | ||
"Legende zu den Kennzahlen", | ||
AssetTypesEnum.HEADING3 | ||
); | ||
const legende = new TextAsset( | ||
"<p>- <b>Kraftfahrzeugverkehr (KFZ)</b>: Der Kraftfahrzeugverkehr ist die Summe der Personenkraftwagen, Krafträder, Busse, Lieferwagen, Lastkraftwagen und Lastzüge.</p>\n" + | ||
"<p>- <b>Schwerverkehr\t(SV)</b>: Der Schwerverkehr ist die Summe aller Fahrzeuge > 3,5t zul. Gesamtgewicht (Summe aus Bussen, Lastkraftwagen und Lastzüge).</p>\n" + | ||
"<p>- <b>Güterverkehr (GV)</b>: Der Güterverkehr ist die Summe aller Fahrzeuge > 3,5t zul. Gesamtgewicht ohne Busse (Summe aus Lastkraftwagen und Lastzüge).</p>\n" + | ||
"<p>- <b>Schwer- und Güterverkehrsanteil</b>: Anteil des Schwer- bzw. Güterverkehrs am Kraftfahrzeugverkehr in Prozent [%].</p>" | ||
); | ||
store.dispatch("addAssets", [ueberschrift, legende]); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.