Parking List

This commit is contained in:
portree_kid 2020-03-30 17:30:05 +02:00
parent d5f68613a1
commit bf59d025f6
3 changed files with 32 additions and 18 deletions

View File

@ -0,0 +1,26 @@
<template>
<el-link type="primary" @click="show(parking.index)">{{parking.name}}{{parking.number}}</el-link>
</template>
<script lang="js">
export default {
name: 'parking-item',
props: {parking: Object},
mounted () {
},
data () {
return {
}
},
methods: {
show (idx) {
this.$parent.$parent.$parent.$parent.$parent.$refs.editLayer.show(idx)
}
},
computed: {
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -7,27 +7,21 @@
</div> </div>
</h1> </h1>
<el-container direction="vertical"> <el-container direction="vertical">
<el-row>
<li v-for="p in parkings" v-bind:key="p.index"> <li v-for="p in parkings" v-bind:key="p.index">
<el-link type="primary" @click="show(p.index)">{{p.name}} {{p.number}}</el-link> <ParkingItem :parking="p"></ParkingItem>
</li> </li>
</el-row>
</el-container> </el-container>
</div> </div>
</template> </template>
<script lang="js"> <script lang="js">
import ParkingItem from './ParkingItem'
export default { export default {
name: 'parking-list', name: 'parking-list',
components: {ParkingItem},
props: [], props: [],
data () { data () {
return { return {
}
},
methods: {
show (idx) {
this.$parent.$parent.$parent.$refs.editLayer.show(idx)
} }
}, },
computed: { computed: {
@ -35,13 +29,7 @@
// getter // getter
get: function () { get: function () {
if (this.$store.state.Parkings.items !== undefined) { if (this.$store.state.Parkings.items !== undefined) {
return this.$store.state.Parkings.items.sort((p1, p2) => { return this.$store.state.Parkings.items
if (p1.name === p2.name) {
return p1.number.localeCompare(p2.number)
} else {
return p1.name.localeCompare(p2.name)
}
})
} }
}, },
// setter // setter

View File

@ -102,10 +102,10 @@ exports.readGroundnetXML = function (fDir, icao, force) {
}).sort(); }).sort();
store.default.dispatch('setParkings', parkingNodes.map( store.default.dispatch('setParkings', parkingNodes.map(
p => ({index: Number(p.attrs.index), name: String(p.attrs.name), number: String(p.attrs.number)} p => ({index: Number(p.attrs.index), name: String(p.attrs.name), number: Number(p.attrs.number)}
)).sort((p1, p2) => { )).sort((p1, p2) => {
if (p1.name === p2.name) { if (p1.name === p2.name) {
return p1.number.localeCompare(p2.number) return p1.number - p2.number
} else { } else {
return p1.name.localeCompare(p2.name) return p1.name.localeCompare(p2.name)
}})); }}));