2022-07-11 08:23:33 +00:00
|
|
|
<template>
|
2022-07-19 20:27:58 +00:00
|
|
|
<div>
|
2022-07-27 21:41:02 +00:00
|
|
|
<BuscarInstitucion
|
|
|
|
:admin="admin"
|
|
|
|
:updateIsLoading="updateIsLoading"
|
|
|
|
:updateInstitucion="updateInstitucion"
|
|
|
|
:institucion="institucion"
|
|
|
|
/>
|
2022-07-11 16:56:17 +00:00
|
|
|
|
2022-07-27 21:41:02 +00:00
|
|
|
<TablaAdmins
|
|
|
|
:admins="admins"
|
|
|
|
:isLoadingTable="isLoadingTable"
|
|
|
|
:onPageChange="onPageChange"
|
2022-07-19 20:27:58 +00:00
|
|
|
:total="total"
|
2022-07-27 21:41:02 +00:00
|
|
|
:page="page"
|
|
|
|
/>
|
2022-07-11 08:23:33 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-07-11 16:56:17 +00:00
|
|
|
import axios from 'axios'
|
2022-07-27 21:41:02 +00:00
|
|
|
import BuscarInstitucion from '@/components/buscar/BuscarInstitucion'
|
|
|
|
import TablaAdmins from '@/components/tablas/TablaAdmins'
|
2022-07-11 08:23:33 +00:00
|
|
|
|
|
|
|
export default {
|
2022-07-27 21:41:02 +00:00
|
|
|
components: { BuscarInstitucion, TablaAdmins },
|
2022-07-11 08:23:33 +00:00
|
|
|
props: {
|
|
|
|
admin: { type: Object, required: true },
|
|
|
|
updateIsLoading: { type: Function, required: true },
|
|
|
|
},
|
|
|
|
data() {
|
2022-07-19 20:27:58 +00:00
|
|
|
return {
|
2022-07-27 21:41:02 +00:00
|
|
|
admins: [],
|
2022-07-19 20:27:58 +00:00
|
|
|
isLoadingTable: false,
|
|
|
|
page: 1,
|
|
|
|
total: 0,
|
2022-07-27 21:41:02 +00:00
|
|
|
institucion: {},
|
2022-07-19 20:27:58 +00:00
|
|
|
lastSearch: {},
|
|
|
|
}
|
2022-07-11 16:56:17 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2022-07-27 21:41:02 +00:00
|
|
|
updateInstitucion(institucion) {
|
|
|
|
this.institucion = institucion
|
2022-07-11 16:56:17 +00:00
|
|
|
},
|
2022-07-19 20:27:58 +00:00
|
|
|
onPageChange(page) {
|
|
|
|
this.page = page
|
|
|
|
this.obtenerAdmins()
|
|
|
|
},
|
2022-07-27 21:41:02 +00:00
|
|
|
obtenerAdmins() {
|
|
|
|
this.isLoadingTable = true
|
|
|
|
if (this.institucion.id_institucion != this.lastSearch.idInstitucion) {
|
|
|
|
this.page = 1
|
|
|
|
this.lastSearch.idInstitucion = this.institucion.id_institucion
|
|
|
|
}
|
2022-07-11 16:56:17 +00:00
|
|
|
axios
|
|
|
|
.get(
|
2022-07-27 21:41:02 +00:00
|
|
|
`${process.env.api}/operador/operadores?pagina=${this.page}&id_tipo_usuario=3&id_institucion=${this.institucion.id_institucion}`,
|
2022-07-19 16:41:33 +00:00
|
|
|
this.$getToken.token()
|
2022-07-11 16:56:17 +00:00
|
|
|
)
|
|
|
|
.then((res) => {
|
2022-07-27 21:41:02 +00:00
|
|
|
this.admins = res.data[0]
|
|
|
|
this.total = res.data[1]
|
|
|
|
this.isLoadingTable = false
|
2022-07-11 16:56:17 +00:00
|
|
|
})
|
|
|
|
.catch((err) => {
|
2022-07-27 21:41:02 +00:00
|
|
|
this.isLoadingTable = false
|
2022-07-11 16:56:17 +00:00
|
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
2022-07-27 21:41:02 +00:00
|
|
|
watch: {
|
|
|
|
institucion() {
|
|
|
|
if (this.institucion.id_institucion) this.obtenerAdmins()
|
|
|
|
},
|
2022-07-11 08:23:33 +00:00
|
|
|
},
|
2022-07-27 21:41:02 +00:00
|
|
|
created() {},
|
2022-07-11 08:23:33 +00:00
|
|
|
}
|
|
|
|
</script>
|