mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Dodano rozwijanie RJ przy przenoszeniu z innej zakładki
This commit is contained in:
@@ -251,7 +251,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop } from "vue-property-decorator";
|
||||
import { Vue, Component, Prop, Emit, Watch } from "vue-property-decorator";
|
||||
|
||||
import Train from "@/scripts/interfaces/Train";
|
||||
import TrainStop from "@/scripts/interfaces/TrainStop";
|
||||
@@ -265,6 +265,7 @@ import { DataStatus } from "@/scripts/enums/DataStatus";
|
||||
export default class TrainTable extends Vue {
|
||||
@Prop() computedTrains!: Train[];
|
||||
@Prop() timetableDataStatus!: DataStatus;
|
||||
@Prop() queryTrain!: string;
|
||||
|
||||
showedSchedule = 0;
|
||||
|
||||
@@ -307,6 +308,17 @@ export default class TrainTable extends Vue {
|
||||
});
|
||||
}
|
||||
|
||||
@Watch("queryTrain")
|
||||
onSearchedTrainChange(trainNo: string) {
|
||||
const timetableId = this.computedTrains.find(
|
||||
(train) => train.trainNo == parseInt(trainNo)
|
||||
)?.timetableData?.timetableId;
|
||||
|
||||
if (!timetableId) return;
|
||||
|
||||
this.changeScheduleShowState(timetableId);
|
||||
}
|
||||
|
||||
onImageError(e: Event) {
|
||||
const imageEl = e.target as HTMLImageElement;
|
||||
this.missingLocoImages.push(imageEl.src);
|
||||
@@ -314,6 +326,7 @@ export default class TrainTable extends Vue {
|
||||
|
||||
generateStopList(stops: any): string | undefined {
|
||||
if (!stops) return "";
|
||||
|
||||
return stops
|
||||
.reduce((acc, stop: TrainStop, i) => {
|
||||
if (stop.stopType.includes("ph"))
|
||||
@@ -455,11 +468,11 @@ export default class TrainTable extends Vue {
|
||||
&-loco {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&-loco img {
|
||||
width: 200px;
|
||||
max-width: 200px;
|
||||
& img {
|
||||
width: 200px;
|
||||
max-width: 200px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
export default interface Timetable {
|
||||
trainNo: number;
|
||||
driverName: string;
|
||||
category: string;
|
||||
stopName: string;
|
||||
stopType: string;
|
||||
arrivalTime: number;
|
||||
arrivalDelay: number;
|
||||
departureTime: number;
|
||||
departureDelay: number;
|
||||
confirmed: boolean;
|
||||
stopped: boolean;
|
||||
stopTime: number;
|
||||
beginsHere: boolean;
|
||||
terminatesHere: boolean;
|
||||
}
|
||||
@@ -71,11 +71,13 @@ const parseSpawns = (spawnString: string) => {
|
||||
|
||||
const getTimestamp = (date: string | null) => (date ? new Date(date).getTime() : 0);
|
||||
|
||||
const timestampToString = (timestamp: number) =>
|
||||
new Date(timestamp).toLocaleTimeString("pl-PL", {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit"
|
||||
});
|
||||
const timestampToString = (timestamp: number | null) =>
|
||||
timestamp
|
||||
? new Date(timestamp).toLocaleTimeString("pl-PL", {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit"
|
||||
})
|
||||
: "";
|
||||
|
||||
const getTrainStopStatus = (stopInfo: TrainStop, timetableData: { currentStationName: string }, station: Station) => {
|
||||
let stopStatus: string = "",
|
||||
|
||||
+4
-4
@@ -302,16 +302,16 @@ export default class Store extends VuexModule {
|
||||
mainStop: point.pointName.includes("strong"),
|
||||
|
||||
arrivalLine: point.arrivalLine,
|
||||
arrivalTimeString: point.arrivalTime,
|
||||
arrivalTimeString: utils.timestampToString(arrivalTimestamp),
|
||||
arrivalTimestamp: arrivalTimestamp,
|
||||
arrivalRealTimeString: point.arrivalRealTime,
|
||||
arrivalRealTimeString: utils.timestampToString(arrivalRealTimestamp),
|
||||
arrivalRealTimestamp: arrivalRealTimestamp,
|
||||
arrivalDelay: point.arrivalDelay,
|
||||
|
||||
departureLine: point.departureLine,
|
||||
departureTimeString: point.departureTime,
|
||||
departureTimeString: utils.timestampToString(departureTimestamp),
|
||||
departureTimestamp: departureTimestamp,
|
||||
departureRealTimeString: point.departureRealTime,
|
||||
departureRealTimeString: utils.timestampToString(departureRealTimestamp),
|
||||
departureRealTimestamp: departureRealTimestamp,
|
||||
departureDelay: point.departureDelay,
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<TrainTable
|
||||
:computedTrains="computedTrains"
|
||||
:timetableDataStatus="timetableDataStatus"
|
||||
:queryTrain="queryTrain"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user