65 lines
1.5 KiB
Vue
65 lines
1.5 KiB
Vue
<template>
|
|
<b-tab-item label="Historial">
|
|
<TablaPrestamos
|
|
:isLoadingTable="isLoadingTable"
|
|
:prestamos="prestamos"
|
|
:page="page"
|
|
:onPageChange="onPageChange"
|
|
:total="total"
|
|
:operador="operador"
|
|
columnaNumeroCuenta
|
|
columnaIdPrestamo
|
|
columnaHoraRegreso
|
|
columnaCanceladoOperador
|
|
columnaCanceladoUsuario
|
|
columnaOperadores
|
|
filaActivo
|
|
/>
|
|
</b-tab-item>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import TablaPrestamos from '@/components/tablas/TablaPrestamos'
|
|
|
|
export default {
|
|
components: { TablaPrestamos },
|
|
props: {
|
|
equipo: { type: Object, required: true, default: () => ({}) },
|
|
operador: { type: Object, required: true, default: () => ({}) },
|
|
},
|
|
data() {
|
|
return { prestamos: [], page: 1, total: 0, isLoadingTable: false }
|
|
},
|
|
methods: {
|
|
onPageChange(page) {
|
|
this.page = page
|
|
this.obtenerPrestamos()
|
|
},
|
|
obtenerPrestamos() {
|
|
this.isLoadingTable = true
|
|
return axios
|
|
.get(
|
|
`${process.env.api}/prestamo/historial-equipo?pagina=${this.page}&id_equipo=${this.equipo.id_equipo}`,
|
|
this.$getToken.token()
|
|
)
|
|
.then((res) => {
|
|
this.prestamos = res.data[0]
|
|
this.total = res.data[1]
|
|
this.isLoadingTable = false
|
|
})
|
|
.catch((err) => {
|
|
this.isLoadingTable = false
|
|
})
|
|
},
|
|
},
|
|
watch: {
|
|
equipo() {
|
|
this.obtenerPrestamos()
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style></style>
|