mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 19:48:11 +00:00
poprawki wczytywania składów
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
<div class="stock_actions">
|
<div class="stock_actions">
|
||||||
<label class="file-label">
|
<label class="file-label">
|
||||||
<div class="btn">WCZYTAJ</div>
|
<div class="btn">WCZYTAJ</div>
|
||||||
<input type="file" @change="uploadStock" ref="conFile" />
|
<input type="file" @change="uploadStock" ref="conFile" accept=".con,.txt" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<button class="btn" :data-disabled="stockIsEmpty" :disabled="stockIsEmpty" @click="downloadStock">POBIERZ</button>
|
<button class="btn" :data-disabled="stockIsEmpty" :disabled="stockIsEmpty" @click="downloadStock">POBIERZ</button>
|
||||||
@@ -349,6 +349,7 @@ export default defineComponent({
|
|||||||
const files = inputEl.files;
|
const files = inputEl.files;
|
||||||
|
|
||||||
if (files?.length != 1) return;
|
if (files?.length != 1) return;
|
||||||
|
if (!/\.con$/.test(files[0].name)) return;
|
||||||
|
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.readAsText(files[0]);
|
reader.readAsText(files[0]);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
loadStockFromString(stockString: string) {
|
loadStockFromString(stockString: string) {
|
||||||
const stockArray = stockString.split(';');
|
const stockArray = stockString.trim().split(';');
|
||||||
|
|
||||||
this.store.stockList.length = 0;
|
this.store.stockList.length = 0;
|
||||||
this.store.chosenVehicle = null;
|
this.store.chosenVehicle = null;
|
||||||
@@ -83,7 +83,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
this.store.swapVehicles = false;
|
this.store.swapVehicles = false;
|
||||||
|
|
||||||
stockArray.forEach((type, i) => {
|
stockArray.forEach((type) => {
|
||||||
let vehicle: Vehicle | null = null;
|
let vehicle: Vehicle | null = null;
|
||||||
let vehicleCargo: ICargo | null = null;
|
let vehicleCargo: ICargo | null = null;
|
||||||
|
|
||||||
@@ -96,6 +96,8 @@ export default defineComponent({
|
|||||||
if (cargo) vehicleCargo = vehicle?.cargoList.find((c) => c.id == cargo) || null;
|
if (cargo) vehicleCargo = vehicle?.cargoList.find((c) => c.id == cargo) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!vehicle) console.log('Brak pojazdu:', type);
|
||||||
|
|
||||||
this.addVehicle(vehicle, vehicleCargo);
|
this.addVehicle(vehicle, vehicleCargo);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user