refactor: moved file utils to composable mixin

This commit is contained in:
2026-04-01 18:20:03 +02:00
parent 72290b6098
commit 80a694dd23
3 changed files with 36 additions and 49 deletions
+25
View File
@@ -0,0 +1,25 @@
import { useStore } from '../store';
export function getCurrentStockFileName() {
const store = useStore();
let fileName = '';
if (store.chosenStorageStockName.trim() != '') {
return store.chosenStorageStockName;
}
const currentStockString = store.stockList.map((s) => s.vehicleRef.type).join(';');
const currentRealComp = store.realCompositionList.find((rc) => rc.stockString == currentStockString);
// Append real composition to the name if chosen
if (currentRealComp != undefined) {
fileName += `${currentRealComp.stockId} `;
}
// Append default props
fileName += `${store.stockList[0].vehicleRef.type} ${(store.totalWeight / 1000).toFixed(1)}t; ${store.totalLength}m; vmax ${store.maxStockSpeed}`;
return fileName;
}