2022-07-26 04:30:07 +00:00
|
|
|
<template>
|
|
|
|
<b-field class="column mb-0 pb-0" label="Infracción" :class="columnSize">
|
|
|
|
<b-select
|
|
|
|
icon="store"
|
|
|
|
:loading="isLoadingSelect"
|
2022-08-03 20:48:49 +00:00
|
|
|
v-model="idInfraccion"
|
2022-07-26 04:30:07 +00:00
|
|
|
expanded
|
|
|
|
rounded
|
|
|
|
>
|
2022-08-03 20:48:49 +00:00
|
|
|
<option :disabled="deshabilitarOptVacia" :value="0">
|
2022-07-26 04:30:07 +00:00
|
|
|
Selecciona una opción
|
|
|
|
</option>
|
|
|
|
|
2022-08-03 20:48:49 +00:00
|
|
|
<option
|
|
|
|
v-for="(i, index) in infracciones"
|
|
|
|
:key="index"
|
|
|
|
:value="i.id_institucion_infraccion"
|
|
|
|
>
|
2022-07-26 04:30:07 +00:00
|
|
|
{{ i.infraccion }}
|
|
|
|
</option>
|
|
|
|
</b-select>
|
|
|
|
</b-field>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
deshabilitarOptVacia: { typeof: Boolean, required: false, default: true },
|
|
|
|
idInstitucion: { type: Number, required: true, default: 0 },
|
2022-08-03 20:48:49 +00:00
|
|
|
idInfraccionPadre: { type: Object, required: true, default: () => ({}) },
|
2022-07-26 04:30:07 +00:00
|
|
|
columnSize: { typeof: String, required: false, default: '' },
|
|
|
|
},
|
|
|
|
data: () => {
|
|
|
|
return {
|
|
|
|
infracciones: [],
|
|
|
|
isLoadingSelect: false,
|
2022-08-03 20:48:49 +00:00
|
|
|
idInfraccion: 0,
|
2022-07-26 04:30:07 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2022-08-03 20:48:49 +00:00
|
|
|
obtenerInstitucionInfracciones() {
|
2022-07-26 04:30:07 +00:00
|
|
|
this.isLoadingSelect = true
|
|
|
|
this.infracciones = []
|
|
|
|
axios
|
|
|
|
.get(
|
2022-08-03 20:48:49 +00:00
|
|
|
`${process.env.api}/institucion-infraccion/infracciones?id_institucion=${this.idInstitucion}`
|
2022-07-29 14:16:12 +00:00
|
|
|
// this.$getToken.token()
|
2022-07-26 04:30:07 +00:00
|
|
|
)
|
|
|
|
.then((res) => {
|
|
|
|
this.infracciones = res.data
|
|
|
|
this.$emit('catalogo-infracciones', this.infracciones)
|
|
|
|
this.isLoadingSelect = false
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.isLoadingSelect = false
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
2022-08-03 20:48:49 +00:00
|
|
|
idInfraccion(institucionInfraccionSeleccionada) {
|
|
|
|
this.$emit(
|
|
|
|
'institucion-infraccion-seleccionada',
|
|
|
|
institucionInfraccionSeleccionada
|
|
|
|
)
|
2022-07-26 04:30:07 +00:00
|
|
|
},
|
2022-08-03 20:48:49 +00:00
|
|
|
idInfraccionPadre(nuevaInstitucionInfraccion) {
|
|
|
|
this.idInfraccion = nuevaInstitucionInfraccion
|
2022-07-26 04:30:07 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
2022-08-03 20:48:49 +00:00
|
|
|
if (this.idInstitucion) this.obtenerInstitucionInfracciones()
|
2022-07-26 04:30:07 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped></style>
|