61 lines
1.2 KiB
Vue
61 lines
1.2 KiB
Vue
![]() |
<template>
|
||
|
<b-tab-item label="Motivos">
|
||
|
<TablaMotivosModulo
|
||
|
:motivos="motivos"
|
||
|
:page="page"
|
||
|
:total="total"
|
||
|
:isLoadingTable="isLoadingTable"
|
||
|
:onPageChange="onPageChange"
|
||
|
/>
|
||
|
</b-tab-item>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import axios from 'axios'
|
||
|
import TablaMotivosModulo from '@/components/tablas/TablaMotivosModulo'
|
||
|
|
||
|
export default {
|
||
|
components: { TablaMotivosModulo },
|
||
|
props: {
|
||
|
modulo: { type: Object, required: true, default: () => ({}) },
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
motivos: [],
|
||
|
page: 1,
|
||
|
total: 0,
|
||
|
isLoadingTable: false,
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
obtenerMotivos() {
|
||
|
this.isLoadingTable = true
|
||
|
return axios
|
||
|
.get(
|
||
|
`${process.env.api}/modulo-motivo?pagina=${this.page}&id_modulo=${this.modulo.id_modulo}`,
|
||
|
this.$getToken.token()
|
||
|
)
|
||
|
.then((res) => {
|
||
|
this.motivos = res.data[0]
|
||
|
this.total = res.data[1]
|
||
|
this.isLoadingTable = false
|
||
|
})
|
||
|
.catch((err) => {
|
||
|
this.isLoadingTable = false
|
||
|
})
|
||
|
},
|
||
|
onPageChange(page) {
|
||
|
this.page = page
|
||
|
this.obtenerMotivos()
|
||
|
},
|
||
|
},
|
||
|
watch: {
|
||
|
modulo() {
|
||
|
this.obtenerMotivos()
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style></style>
|