81 lines
1.8 KiB
Vue
81 lines
1.8 KiB
Vue
<template>
|
|
<section class="mb-5">
|
|
<BuscarUsuario
|
|
:operador="operador"
|
|
:updateIsLoading="updateIsLoading"
|
|
:updateUsuario="updateUsuario"
|
|
:usuario="usuario"
|
|
/>
|
|
|
|
<TablaPrestamo
|
|
:isLoadingTable="isLoading"
|
|
:data="data"
|
|
:page="page"
|
|
:onPageChange="onPageChange"
|
|
:total="total"
|
|
:columnaNumeroInventario="true"
|
|
:columnaTipo="true"
|
|
:columnaEquipo="true"
|
|
:columnaCarrito="true"
|
|
:columnaModulo="true"
|
|
:columnaHoraRegreso="true"
|
|
:columnaIdPrestamo="true"
|
|
/>
|
|
</section>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import BuscarUsuario from '@/components/operador/usuarios/BuscarUsuario'
|
|
import TablaPrestamo from '@/components/operador/TablaPrestamo'
|
|
|
|
export default {
|
|
components: { BuscarUsuario, TablaPrestamo },
|
|
props: {
|
|
operador: { type: Object, required: true },
|
|
updateIsLoading: { type: Function, required: true },
|
|
},
|
|
data() {
|
|
return {
|
|
data: [],
|
|
page: 1,
|
|
total: 0,
|
|
isLoading: false,
|
|
usuario: { instituciones: [], tipoUsuario: {} },
|
|
}
|
|
},
|
|
methods: {
|
|
updateUsuario(valorObject) {
|
|
this.usuario = valorObject
|
|
},
|
|
onPageChange(page) {
|
|
this.page = page
|
|
this.obtenerPrestamos()
|
|
},
|
|
obtenerPrestamos() {
|
|
this.isLoading = true
|
|
|
|
axios
|
|
.get(
|
|
`${process.env.api}/prestamo/historial-usuario?pagina=${this.page}&id_usuario=${this.usuario.id_usuario}`,
|
|
this.operador.token
|
|
)
|
|
.then((res) => {
|
|
this.data = res.data[0]
|
|
this.total = res.data[1]
|
|
this.isLoading = false
|
|
})
|
|
.catch((err) => {
|
|
this.isLoading = false
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
|
})
|
|
},
|
|
},
|
|
watch: {
|
|
usuario() {
|
|
this.obtenerPrestamos()
|
|
},
|
|
},
|
|
}
|
|
</script>
|