mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-04 20:18:12 +00:00
Generowanie próżnych wagonów
This commit is contained in:
@@ -72,8 +72,8 @@
|
|||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<div class="generator_actions">
|
<div class="generator_actions">
|
||||||
<button class="btn" :data-disabled="computedChosenCarTypes.size == 0" @click="generateStock">WYGENERUJ</button>
|
<button class="btn" :data-disabled="computedChosenCarTypes.size == 0" @click="generateStock()">WYGENERUJ</button>
|
||||||
<button class="btn" :data-disabled="computedChosenCarTypes.size == 0">WYGENERUJ PRÓŻNE WAGONY</button>
|
<button class="btn" :data-disabled="computedChosenCarTypes.size == 0" @click="generateStock(true)">WYGENERUJ PRÓŻNE WAGONY</button>
|
||||||
|
|
||||||
<button class="btn" :data-disabled="computedChosenCarTypes.size == 0" @click="resetChosenCargo">
|
<button class="btn" :data-disabled="computedChosenCarTypes.size == 0" @click="resetChosenCargo">
|
||||||
ZRESETUJ ŁADUNKI
|
ZRESETUJ ŁADUNKI
|
||||||
@@ -143,7 +143,7 @@ export default defineComponent({
|
|||||||
this.excludedCarTypes.length = 0;
|
this.excludedCarTypes.length = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
generateStock() {
|
generateStock(empty = false) {
|
||||||
const generatedChosenStockList = this.chosenCargoTypes.reduce((acc, type) => {
|
const generatedChosenStockList = this.chosenCargoTypes.reduce((acc, type) => {
|
||||||
this.generatorData.cargo[type as keyof typeof this.generatorData.cargo]
|
this.generatorData.cargo[type as keyof typeof this.generatorData.cargo]
|
||||||
.filter((c) => !this.excludedCarTypes.includes(c.split(':')[0]))
|
.filter((c) => !this.excludedCarTypes.includes(c.split(':')[0]))
|
||||||
@@ -152,13 +152,15 @@ export default defineComponent({
|
|||||||
const carWagonObjs = this.store.carDataList.filter((cw) => cw.type.startsWith(type));
|
const carWagonObjs = this.store.carDataList.filter((cw) => cw.type.startsWith(type));
|
||||||
const cargoObjs = [] as (ICargo | undefined)[];
|
const cargoObjs = [] as (ICargo | undefined)[];
|
||||||
|
|
||||||
if (cargoType == 'all') cargoObjs.push(...carWagonObjs[0]?.cargoList);
|
if(!cargoType || empty) cargoObjs.push(undefined);
|
||||||
else if (cargoType) cargoObjs.push(carWagonObjs[0]?.cargoList.find((cargo) => cargo.id == cargoType));
|
else if(cargoType == 'all') cargoObjs.push(...carWagonObjs[0]?.cargoList);
|
||||||
else cargoObjs.push(undefined);
|
else cargoObjs.push(carWagonObjs[0]?.cargoList.find((cargo) => cargo.id == cargoType));
|
||||||
|
|
||||||
|
// if (cargoType == 'all')
|
||||||
|
// else if (cargoType)
|
||||||
|
// else cargoObjs.push(undefined);
|
||||||
|
|
||||||
carWagonObjs.forEach((cw) => {
|
carWagonObjs.forEach((cw) => {
|
||||||
console.log(cw, cargoType);
|
|
||||||
|
|
||||||
cargoObjs.forEach((cargoObj) => {
|
cargoObjs.forEach((cargoObj) => {
|
||||||
acc.push({ carWagon: cw, cargo: cargoObj });
|
acc.push({ carWagon: cw, cargo: cargoObj });
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="stock-section">
|
<div class="stock-section">
|
||||||
<keep-alive>
|
<transition name="tab-change" mode="out-in">
|
||||||
<transition name="tab-change" mode="out-in">
|
<keep-alive>
|
||||||
<component :is="chosenSectionComponent" :key="store.stockSectionMode"></component>
|
<component :is="chosenSectionComponent" :key="chosenSectionComponent"></component>
|
||||||
</transition>
|
</keep-alive>
|
||||||
</keep-alive>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user