2022-06-13 18:13:20 +00:00
|
|
|
<template>
|
|
|
|
<b-table
|
|
|
|
:data="data"
|
|
|
|
:loading="isLoadingTable"
|
|
|
|
show-detail-icon
|
|
|
|
paginated
|
|
|
|
detailed
|
|
|
|
>
|
2022-06-20 00:35:50 +00:00
|
|
|
<b-table-column field="modulo" label="Módulo" v-slot="props" centered>
|
2022-06-13 18:13:20 +00:00
|
|
|
<span>{{ props.row.modulo }}</span>
|
|
|
|
</b-table-column>
|
|
|
|
|
|
|
|
<b-table-column field="activo" label="Activo" v-slot="props" centered>
|
2022-06-18 03:27:06 +00:00
|
|
|
<BotonDesactivar
|
|
|
|
:admin="admin"
|
|
|
|
:data="props.row"
|
|
|
|
:cambiarStatus="cambiarStatus"
|
2022-06-20 00:35:50 +00:00
|
|
|
:imprimirWarning="imprimirWarning"
|
2022-06-18 03:27:06 +00:00
|
|
|
/>
|
2022-06-13 18:13:20 +00:00
|
|
|
</b-table-column>
|
|
|
|
</b-table>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
2022-06-18 03:27:06 +00:00
|
|
|
import BotonDesactivar from '@/components/operador/BotonDesactivar'
|
2022-06-13 18:13:20 +00:00
|
|
|
export default {
|
2022-06-18 03:27:06 +00:00
|
|
|
components: {
|
|
|
|
BotonDesactivar,
|
|
|
|
},
|
2022-06-13 18:13:20 +00:00
|
|
|
props: {
|
2022-06-18 03:27:06 +00:00
|
|
|
admin: { typeof: Object, require: true },
|
|
|
|
imprimirMensaje: { type: Function, required: true },
|
|
|
|
imprimirWarning: { type: Function, required: true },
|
|
|
|
imprimirError: { type: Function, required: true },
|
2022-06-13 18:13:20 +00:00
|
|
|
updateActualizarTabla: { type: Function, required: true },
|
|
|
|
actualizarTabla: { type: Boolean, required: true },
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isLoadingTable: false,
|
|
|
|
data: [],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2022-06-18 03:27:06 +00:00
|
|
|
cambiarStatus(dataSelect, status) {
|
|
|
|
const data = { id_modulo: dataSelect.id_modulo, activo: status }
|
|
|
|
|
|
|
|
axios
|
|
|
|
.put(`${process.env.api}/modulo`, data)
|
|
|
|
.then((res) => {
|
|
|
|
this.obtenerModulos()
|
|
|
|
this.imprimirMensaje(res.data.message)
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.imprimirError(err.response.data)
|
|
|
|
})
|
|
|
|
},
|
2022-06-13 18:13:20 +00:00
|
|
|
obtenerModulos() {
|
|
|
|
axios
|
|
|
|
.get(
|
2022-06-13 18:37:02 +00:00
|
|
|
`${process.env.api}/modulo/modulos?id_institucion=${this.admin.institucion.id_institucion}`
|
2022-06-13 18:13:20 +00:00
|
|
|
)
|
|
|
|
.then((res) => {
|
|
|
|
this.data = res.data
|
2022-06-18 03:27:06 +00:00
|
|
|
console.log(this.data)
|
2022-06-13 18:13:20 +00:00
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.imprimirError(err)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
actualizarTabla() {
|
|
|
|
console.log('hola')
|
|
|
|
if (this.actualizarTabla) {
|
|
|
|
this.obtenerModulos()
|
|
|
|
this.updateActualizarTabla(false)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.obtenerModulos()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|