pcpuma_unam_operador/components/operador/Equipo.vue

133 lines
3.4 KiB
Vue
Raw Normal View History

2022-05-31 04:22:49 +00:00
<template>
<section class="mb-5">
<BuscarEquipo
:operador="operador"
:equipo="equipo"
:updateIsLoading="updateIsLoading"
2022-07-05 05:33:43 +00:00
:obtenerMotivos="obtenerMotivos"
2022-05-31 04:22:49 +00:00
:updateEquipo="updateEquipo"
/>
2022-07-05 05:33:43 +00:00
<b-tabs>
2022-07-07 04:25:06 +00:00
<b-tab-item label="Historial">
2022-07-22 22:46:48 +00:00
<TablaPrestamo
2022-05-31 04:22:49 +00:00
:isLoadingTable="isLoadingTable"
:data="dataPrestamos"
:page="pagePrestamos"
:onPageChange="onPrestamosPageChange"
:total="totalPrestamos"
:columnaNumeroCuenta="true"
:columnaIdPrestamo="true"
:columnaHoraRegreso="true"
:columnaCanceladoOperador="true"
:columnaCanceladoUsuario="true"
:columnaOperadores="true"
:filaActivo="true"
/>
2022-07-07 04:25:06 +00:00
</b-tab-item>
2022-05-31 04:22:49 +00:00
<b-tab-item label="Motivos">
<TablaMotivos
:data="dataMotivos"
:page="pageMotivos"
:total="totalMotivos"
:isLoading="isLoadingTable"
:onPageChange="onMotivosPageChange"
/>
</b-tab-item>
2022-07-05 05:33:43 +00:00
</b-tabs>
2022-05-31 04:22:49 +00:00
</section>
</template>
<script>
import axios from 'axios'
import BuscarEquipo from '@/components/operador/BuscarEquipo'
2022-07-22 22:46:48 +00:00
import TablaPrestamo from '@/components/operador/TablaPrestamo'
2022-05-31 04:22:49 +00:00
import TablaMotivos from '@/components/operador/TablaMotivos'
export default {
2022-07-22 22:46:48 +00:00
components: { BuscarEquipo, TablaPrestamo, TablaMotivos },
2022-07-11 19:23:06 +00:00
props: {
operador: { type: Object, required: true },
updateIsLoading: { type: Function, required: true },
},
2022-05-31 04:22:49 +00:00
data() {
return {
equipo: {
2022-07-05 04:48:43 +00:00
carrito: { modulo: {}, tipoCarrito: {} },
2022-07-07 23:20:54 +00:00
programas: [],
2022-07-05 04:48:43 +00:00
status: {},
2022-07-07 23:20:54 +00:00
tiposEntradas: [],
2022-05-31 04:22:49 +00:00
},
dataPrestamos: [],
pagePrestamos: 1,
totalPrestamos: 0,
2022-07-22 22:46:48 +00:00
2022-05-31 04:22:49 +00:00
dataMotivos: [],
pageMotivos: 1,
totalMotivos: 0,
isLoadingTable: false,
}
},
methods: {
onPrestamosPageChange(page) {
this.pagePrestamos = page
this.obtenerPrestamos()
},
onReportesPageChange(page) {
this.pageReportes = page
this.obtenerReportes()
},
onMotivosPageChange(page) {
this.pageMotivos = page
this.obtenerMotivos()
},
updateEquipo(valorObject) {
this.equipo = valorObject
},
2022-07-22 22:46:48 +00:00
obtenerPrestamos() {
this.isLoadingTable = true
axios
.get(
`${process.env.api}/prestamo/historial-equipo?pagina=${this.pagePrestamos}&id_equipo=${this.equipo.id_equipo}`,
this.$getToken.token()
)
.then((res) => {
this.dataPrestamos = res.data[0]
this.totalPrestamos = res.data[1]
this.isLoadingTable = false
})
.catch((err) => {
this.isLoadingTable = false
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
})
},
2022-07-05 05:33:43 +00:00
obtenerMotivos() {
this.isLoadingTable = true
axios
.get(
`${process.env.api}/motivo?pagina=${this.pageMotivos}&id_equipo=${this.equipo.id_equipo}`,
2022-07-19 16:41:33 +00:00
this.$getToken.token()
2022-07-05 05:33:43 +00:00
)
.then((res) => {
this.dataMotivos = res.data[0]
this.totalMotivos = res.data[1]
this.isLoadingTable = false
})
.catch((err) => {
this.isLoadingTable = false
2022-07-11 14:15:10 +00:00
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
2022-07-05 05:33:43 +00:00
})
},
2022-05-31 04:22:49 +00:00
},
2022-07-22 22:46:48 +00:00
watch: {
equipo() {
this.obtenerPrestamos()
this.obtenerMotivos()
},
},
2022-05-31 04:22:49 +00:00
}
</script>
<style></style>