Move Parking to AirportTab and make Airport always visible

This commit is contained in:
portree_kid 2020-06-19 21:04:44 +02:00
parent e122bbbb08
commit 4923b467f4
5 changed files with 92 additions and 53 deletions

View File

@ -1,70 +1,87 @@
<template> <template>
<div> <div v-if="airport">
<div width="100%" v-if="airport"> <h1 class="leaflet-sidebar-header">{{ icao }} {{ name }}</h1>
<el-row> <div width="100%" >
<el-col :span="7">ICAO :</el-col>
<el-col :span="17">{{ icao }}</el-col>
</el-row>
<el-row>
<el-col :span="7">Name :</el-col>
<el-col :span="17">{{ name }}</el-col>
</el-row>
<el-row> <el-row>
<el-col :span="7">Airlines :</el-col> <el-col :span="7">Airlines :</el-col>
<el-col :span="15"> <el-col :span="15">
<el-tag v-for="item in airlines" :key="item.value">{{item.value}}</el-tag> <el-tag v-for="item in airlines" :key="item.value">{{item.value}}</el-tag>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="5">Flights :</el-col>
<el-col :span="7">{{ flights }}</el-col>
<el-col :span="5">Parking :</el-col>
<el-col :span="7">{{ parking }}</el-col>
</el-row>
<el-row>
<el-col :span="7">Groundnet :</el-col>
<el-col :span="15">{{groundnet}}</el-col>
</el-row>
</div> </div>
<el-divider v-if="airport"></el-divider> <el-tabs v-model="activeTab" >
<h3 v-if="airport">Frequencies</h3> <el-tab-pane label="Frequencies" name="first">
<div v-if="airport"> <div>
<el-row v-for="f in Frequencies" :key="f.index"> <el-row v-for="f in frequencyList" :key="f.index">
<Frequency :frequency="f"></Frequency> <Frequency :frequency="f"></Frequency>
</el-row> </el-row>
<el-button @click="addFrequency" v-if="editing" >Add</el-button> <el-button @click="addFrequency" v-if="editing" >Add</el-button>
</div> </div>
</el-tab-pane>
<el-tab-pane label="Parkings" name="second">
<ParkingList></ParkingList>
</el-tab-pane>
<el-tab-pane label="Statistics" name="third">
<el-row>
<el-col :span="8">Flights :</el-col>
<el-col :span="4">{{ flights }}</el-col>
<el-col :span="8">Parking Positions :</el-col>
<el-col :span="4">{{ parking }}</el-col>
</el-row>
<el-row>
<el-col :span="8">Groundnet Nodes :</el-col>
<el-col :span="4">{{groundnet}}</el-col>
<el-col :span="8"></el-col>
<el-col :span="4"></el-col>
</el-row>
</el-tab-pane>
</el-tabs>
</div> </div>
</template> </template>
<script lang="js"> <script lang="js">
import Frequency from './Frequency' import Frequency from './Frequency'
import ParkingList from './ParkingList'
export default { export default {
data () { data () {
return { } return {activeTab: 'first', editLayer: null}
}, },
components: { components: {
Frequency Frequency, ParkingList
}, },
methods: { methods: {
addFrequency () { addFrequency () {
this.$store.dispatch('addFrequency', {type: 'AWOS', value: 0}) this.$store.dispatch('addFrequency', {type: 'AWOS', value: 0})
},
initLayer () {
var parent = this.$parent
while (parent !== undefined && parent.$refs.editLayer === undefined) {
parent = parent.$parent
}
if (parent === undefined) {
return
}
this.editLayer = parent.$refs.editLayer
} }
}, },
computed: { computed: {
editing: { editing: {
get: function () { get: function () {
return this.$parent.$parent.$parent.$refs.editLayer.editing if (this.editLayer === null) {
this.initLayer()
}
return this.editLayer.editing
} }
}, },
icao: function () { icao: function () {
return this.$store.state.Editable.data.airport.icao return this.$store.state.Airports.currentAirport.icao
}, },
name: function () { name: function () {
return this.$store.state.Editable.data.airport.name return this.$store.state.Airports.currentAirport.name
}, },
flights: function () { flights: function () {
return this.$store.state.Editable.data.airport.flights return this.$store.state.Airports.currentAirport.flights
}, },
airlines: function () { airlines: function () {
var airlineCodes = [] var airlineCodes = []
@ -77,15 +94,17 @@
return airlineCodes return airlineCodes
}, },
groundnet: function () { groundnet: function () {
return this.$store.state.Editable.data.airport.groundnet return this.$store.state.Airports.currentAirport.groundnet
}, },
parking: function () { parking: function () {
return this.$store.state.Editable.data.airport.parking return this.$store.state.Airports.currentAirport.parking
}, },
airport: function () { airport: {
return this.$store.state.Editable.type === 'airport' get: function () {
return this.$store.state.Airports.currentAirport !== undefined
}
}, },
Frequencies: { frequencyList: {
// getter // getter
get: function () { get: function () {
return this.$store.state.Frequencies.items return this.$store.state.Frequencies.items

View File

@ -3,7 +3,7 @@
<span> <span>
<el-row> <el-row>
<el-col :span="7"> <el-col :span="7">
<el-select v-model="type" placeholder="Select"> <el-select v-model="type" placeholder="Select" :disabled="!editing">
<el-option <el-option
v-for="type in options" v-for="type in options"
:key="type.value" :key="type.value"
@ -38,7 +38,7 @@
}, },
data () { data () {
return { return {
ok: true ok: true, editLayer: null
} }
}, },
methods: { methods: {
@ -67,11 +67,20 @@
return false return false
} }
return true return true
},
initLayer() {
var parent = this.$parent
while (parent.$refs.editLayer===undefined) {
parent = parent.$parent
}
this.editLayer = parent.$refs.editLayer
} }
}, },
computed: { computed: {
editing: function () { editing: function () {
return this.$parent.$parent.$parent.$parent.$parent.$refs.editLayer.editing if(this.editLayer=== null)
this.initLayer()
return this.editLayer.editing
}, },
options: function () { options: function () {
return [ return [

View File

@ -5,7 +5,7 @@
<ul role="tablist"> <!-- top aligned tabs --> <ul role="tablist"> <!-- top aligned tabs -->
<li><a href="#home" role="tab"><i class="fa fa-bars"></i></a></li> <li><a href="#home" role="tab"><i class="fa fa-bars"></i></a></li>
<li><a href="#edit" role="tab"><i class="fas fa-edit"></i></a></li> <li><a href="#edit" role="tab"><i class="fas fa-edit"></i></a></li>
<li><a href="#parking" role="tab"><i class="fas fa-parking"></i></a></li> <!--<li><a href="#parking" role="tab"><i class="fas fa-parking"></i></a></li>-->
<li><a href="#check" role="tab"><i class="far fa-check-square"></i></a></li> <li><a href="#check" role="tab"><i class="far fa-check-square"></i></a></li>
<li><a href="#search" role="tab"><i class="fa fa-search"></i></a></li> <li><a href="#search" role="tab"><i class="fa fa-search"></i></a></li>
<li><a href="#wip" role="tab"><i class="fas fa-wrench"></i></a></li> <li><a href="#wip" role="tab"><i class="fas fa-wrench"></i></a></li>
@ -25,14 +25,16 @@
Properties Properties
<div class="leaflet-sidebar-close"><i class="fa fa-caret-left"></i></div> <div class="leaflet-sidebar-close"><i class="fa fa-caret-left"></i></div>
</h1> </h1>
<AirportEdit></AirportEdit>
<ParkingEdit></ParkingEdit> <ParkingEdit></ParkingEdit>
<ArcEdit></ArcEdit> <ArcEdit></ArcEdit>
<NodeEdit></NodeEdit> <NodeEdit></NodeEdit>
<AirportEdit></AirportEdit>
</div> </div>
<!--
<div class="leaflet-sidebar-pane" id="parking"> <div class="leaflet-sidebar-pane" id="parking">
<ParkingList></ParkingList> <ParkingList></ParkingList>
</div> </div>
-->
<div class="leaflet-sidebar-pane" id="search"> <div class="leaflet-sidebar-pane" id="search">
<Search></Search> <Search></Search>
</div> </div>
@ -64,7 +66,7 @@
import Help from './Help' import Help from './Help'
import NodeEdit from './NodeEdit' import NodeEdit from './NodeEdit'
import ParkingEdit from './ParkingEdit' import ParkingEdit from './ParkingEdit'
import ParkingList from './ParkingList' // import ParkingList from './ParkingList'
import RunScan from './RunScan' import RunScan from './RunScan'
import SettingsPanel from './SettingsPanel' import SettingsPanel from './SettingsPanel'
import Search from './Search' import Search from './Search'
@ -72,7 +74,7 @@
export default { export default {
name: 'leaflet-sidebar', name: 'leaflet-sidebar',
components: { Help, AirportEdit, ArcEdit, CheckPanel, NodeEdit, ParkingEdit, ParkingList, RunScan, FileSelect, SettingsPanel, Search, WorkInProgress }, components: { Help, AirportEdit, ArcEdit, CheckPanel, NodeEdit, ParkingEdit, RunScan, FileSelect, SettingsPanel, Search, WorkInProgress },
props: [], props: [],
mounted () { mounted () {
this.add() this.add()

View File

@ -22,12 +22,22 @@
mounted () { mounted () {
}, },
data () { data () {
return { return { editLayer: null
} }
}, },
methods: { methods: {
show (idx) { show (idx) {
this.$parent.$parent.$parent.$parent.$parent.$refs.editLayer.show(idx) if (this.editLayer === null) {
this.initLayer()
}
return this.editLayer.show(idx)
},
initLayer () {
var parent = this.$parent
while (parent.$refs.editLayer === undefined) {
parent = parent.$parent
}
this.editLayer = parent.$refs.editLayer
} }
}, },
computed: { computed: {
@ -40,14 +50,11 @@
{value: 'mil-cargo', label: 'military cargo'} {value: 'mil-cargo', label: 'military cargo'}
] ]
}, },
editing: { editing: function () {
// getter if (this.editLayer === null) {
get: function () { this.initLayer()
return this.$parent.$parent.$parent.$parent.$parent.$refs.editLayer.getEditing()
},
// setter
set: function (newValue) {
} }
return this.editLayer.editing
}, },
name: { name: {
// getter // getter

View File

@ -1,11 +1,13 @@
<template> <template>
<div> <div>
<!--
<h1 class="leaflet-sidebar-header"> <h1 class="leaflet-sidebar-header">
Parking List Parking List
<div class="leaflet-sidebar-close"> <div class="leaflet-sidebar-close">
<i class="fa fa-caret-left"></i> <i class="fa fa-caret-left"></i>
</div> </div>
</h1> </h1>
-->
<el-container direction="vertical"> <el-container direction="vertical">
<div v-for="p in parkings" v-bind:key="p.index" class="row"> <div v-for="p in parkings" v-bind:key="p.index" class="row">
<ParkingItem :parking="p"></ParkingItem> <ParkingItem :parking="p"></ParkingItem>