Remove frequency

This commit is contained in:
portree_kid 2020-04-27 15:23:05 +02:00
parent 90740751dd
commit fb72f8d760
4 changed files with 23 additions and 5 deletions

View File

@ -98,6 +98,6 @@
<style lang="scss" scoped>
.el-row {
padding: 0em;
margin-bottom: 10px;
margin-bottom: 5px;
}
</style>

View File

@ -455,6 +455,9 @@
return
}
this.$store.dispatch('updatedParking', this.$store.state.Editable.data.parking);
if (this.featureLookup[this.$store.state.Editable.index]===undefined) {
return
}
this.featureLookup[this.$store.state.Editable.index].forEach((element,index) => {
if (element instanceof L.ParkingSpot) {
element.options.attributes = Object.assign({}, this.$store.state.Editable.data.parking)

View File

@ -12,7 +12,7 @@
></el-option>
</el-select>
</el-col>
<el-col :span="15">
<el-col :span="13">
<el-input
placeholder="Please input frequency"
v-model="value"
@ -20,14 +20,19 @@
v-bind:class="{ invalid: !ok && editing}"
></el-input>
</el-col>
<el-col :span="2">
<el-button @click="remove" v-if="editing" ><i class="fas fa-trash-alt"></i></el-button>
</el-col>
</el-row>
</span>
</div>
</template>
<script lang="js">
import EditButton from './EditButton'
/* eslint-disable */
export default {
name: 'frequency',
components: { EditButton },
props: {frequency: Object},
mounted () {
},
@ -37,6 +42,9 @@
}
},
methods: {
remove () {
this.$store.dispatch('removeFrequency', this.frequency)
},
isValid (frequency) {
let ok = frequency >= 118 && frequency <= 137
if (!ok) {
@ -97,8 +105,6 @@
}
}
}
</script>
<style scoped lang="scss">

View File

@ -10,6 +10,12 @@ const mutations = {
const existingItem = state.items.find((i) => i.id === item.id)
Object.assign(existingItem, item)
},
REMOVE_FREQUENCY: (state, item) => {
const index = state.items.indexOf(item)
if (index > -1) {
state.items.splice(index, 1)
}
},
SET_FREQUENCIES (state, frequencies) {
Vue.set(state, 'items', frequencies)
}
@ -22,6 +28,9 @@ const actions = {
async updateFrequency (context, frequency) {
context.commit('SET_GROUND', frequency)
},
async removeFrequency (context, frequency) {
context.commit('REMOVE_FREQUENCY', frequency)
},
async setFrequencies (context, frequencies) {
context.commit('SET_FREQUENCIES', frequencies)
}