103 lines
2.8 KiB
Vue
103 lines
2.8 KiB
Vue
![]() |
<template>
|
||
|
<div class="box">
|
||
|
<div class="columns is-align-items-flex-end">
|
||
|
<b-field class="column is-4 mb-0" label="Número de Inventario">
|
||
|
<b-input
|
||
|
type="text"
|
||
|
placeholder="Número de Inventario"
|
||
|
icon="laptop"
|
||
|
v-model="numeroInventario"
|
||
|
@keyup.enter.native="buscar()"
|
||
|
rounded
|
||
|
/>
|
||
|
</b-field>
|
||
|
|
||
|
<div class="column is-2">
|
||
|
<b-button
|
||
|
type="is-success"
|
||
|
:disabled="!numeroInventario"
|
||
|
@click="buscar()"
|
||
|
rounded
|
||
|
expanded
|
||
|
>
|
||
|
Buscar
|
||
|
</b-button>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="columns">
|
||
|
<InfoEquipo :equipo="equipo" />
|
||
|
|
||
|
<AdminEquipo
|
||
|
:operador="operador"
|
||
|
:equipo="equipo"
|
||
|
:imprimirError="imprimirError"
|
||
|
:imprimirWarning="imprimirWarning"
|
||
|
:imprimirMensaje="imprimirMensaje"
|
||
|
:updateIsLoading="updateIsLoading"
|
||
|
:buscar="buscar"
|
||
|
/>
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import axios from 'axios'
|
||
|
import AdminEquipo from '@/components/operador/AdminEquipo'
|
||
|
import InfoEquipo from '@/components/operador/InfoEquipo'
|
||
|
|
||
|
export default {
|
||
|
components: { AdminEquipo, InfoEquipo },
|
||
|
data() {
|
||
|
return {
|
||
|
numeroInventario: '',
|
||
|
}
|
||
|
},
|
||
|
props: {
|
||
|
operador: { type: Object, required: true },
|
||
|
equipo: { type: Object, required: true },
|
||
|
imprimirError: { type: Function, required: true },
|
||
|
imprimirWarning: { type: Function, required: true },
|
||
|
imprimirMensaje: { type: Function, required: true },
|
||
|
updateIsLoading: { type: Function, required: true },
|
||
|
updateEquipo: { type: Function, required: true },
|
||
|
obtenerPrestamos: { type: Function, required: true },
|
||
|
obtenerReportes: { type: Function, required: true },
|
||
|
obtenerMotivos: { type: Function, required: true },
|
||
|
},
|
||
|
methods: {
|
||
|
buscar() {
|
||
|
if (this.numeroInventario || this.equipo.idEquipo) {
|
||
|
this.updateIsLoading(true)
|
||
|
axios
|
||
|
.get(
|
||
|
`${process.env.api}/equipo?numeroInventario=${
|
||
|
this.numeroInventario || this.equipo.numeroInventario
|
||
|
}`,
|
||
|
this.operador.token
|
||
|
)
|
||
|
.then((res) => {
|
||
|
this.numeroInventario = ''
|
||
|
this.updateEquipo(res.data)
|
||
|
this.updateIsLoading(false)
|
||
|
this.obtenerPrestamos()
|
||
|
this.obtenerReportes()
|
||
|
this.obtenerMotivos()
|
||
|
})
|
||
|
.catch((err) => {
|
||
|
this.updateIsLoading(false)
|
||
|
this.imprimirError(err.response.data)
|
||
|
})
|
||
|
localStorage.removeItem('numeroInventario')
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
created() {
|
||
|
this.numeroInventario = localStorage.getItem('numeroInventario')
|
||
|
if (this.numeroInventario) this.buscar()
|
||
|
},
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style></style>
|