69 lines
1.6 KiB
Vue
69 lines
1.6 KiB
Vue
<template>
|
|
<b-field class="column mb-0 pb-0" label="Software" :class="columnSize">
|
|
<b-select
|
|
icon="store"
|
|
:loading="isLoadingSelect"
|
|
v-model="programa"
|
|
expanded
|
|
rounded
|
|
>
|
|
<option :disabled="deshabilitarOptVacia" :value="objVacio">
|
|
Selecciona una opción
|
|
</option>
|
|
|
|
<option v-for="(p, index) in programas" :key="index" :value="p">
|
|
{{ p.programa }}
|
|
</option>
|
|
</b-select>
|
|
</b-field>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
|
|
export default {
|
|
props: {
|
|
deshabilitarOptVacia: { typeof: Boolean, required: false, default: true },
|
|
programaPadre: { type: Object, required: true, default: () => ({}) },
|
|
columnSize: { typeof: String, required: false, default: '' },
|
|
},
|
|
data: () => {
|
|
return {
|
|
programas: [],
|
|
isLoadingSelect: false,
|
|
programa: {},
|
|
objVacio: {},
|
|
}
|
|
},
|
|
methods: {
|
|
obtenerProgramas() {
|
|
this.isLoadingSelect = true
|
|
this.programas = []
|
|
axios
|
|
.get(`${process.env.api}/institucion-programa`)
|
|
.then((res) => {
|
|
this.programas = res.data
|
|
this.$emit('catalogo-programas', this.programas)
|
|
this.isLoadingSelect = false
|
|
})
|
|
.catch((err) => {
|
|
this.isLoadingSelect = false
|
|
})
|
|
},
|
|
},
|
|
watch: {
|
|
programa(programaSeleccionado) {
|
|
this.$emit('programa-seleccionado', programaSeleccionado)
|
|
},
|
|
programaPadre(nuevoPrograma) {
|
|
if (this.$objIsEmpty(nuevoPrograma)) this.programa = this.objVacio
|
|
},
|
|
},
|
|
created() {
|
|
this.programa = this.objVacio
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped></style>
|