96 lines
2.3 KiB
Vue
96 lines
2.3 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 Cuenta"
|
|
icon="laptop"
|
|
v-model="numeroCuenta"
|
|
@keyup.enter.native="buscar()"
|
|
rounded
|
|
/>
|
|
</b-field>
|
|
|
|
<div class="column is-2">
|
|
<b-button
|
|
type="is-success"
|
|
:disabled="!numeroCuenta"
|
|
@click="buscar()"
|
|
rounded
|
|
expanded
|
|
>
|
|
Buscar
|
|
</b-button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="columns">
|
|
<InfoUsuario
|
|
:usuario="usuario"
|
|
:updateIsLoading="updateIsLoading"
|
|
:buscar="buscar"
|
|
/>
|
|
|
|
<AdminUsuario
|
|
:operador="operador"
|
|
:usuario="usuario"
|
|
:updateIsLoading="updateIsLoading"
|
|
:buscar="buscar"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import AdminUsuario from '@/components/operador/usuarios/AdminUsuario'
|
|
import InfoUsuario from '@/components/operador/usuarios/InfoUsuario'
|
|
|
|
export default {
|
|
components: { AdminUsuario, InfoUsuario },
|
|
props: {
|
|
operador: { type: Object, required: true },
|
|
usuario: { type: Object, required: true },
|
|
updateIsLoading: { type: Function, required: true },
|
|
updateUsuario: { type: Function, required: true },
|
|
},
|
|
data() {
|
|
return {
|
|
numeroCuenta: '',
|
|
}
|
|
},
|
|
methods: {
|
|
buscar() {
|
|
if (this.numeroCuenta || this.usuario.id_usuario) {
|
|
this.updateIsLoading(true)
|
|
axios
|
|
.get(
|
|
`${process.env.api}/usuario/usuario?usuario=${
|
|
this.numeroCuenta || this.usuario.id_usuario
|
|
}`
|
|
)
|
|
.then((res) => {
|
|
this.updateUsuario(res.data)
|
|
this.updateIsLoading(false)
|
|
this.$router.push(
|
|
`/operador/usuarios/buscar_usuario/${this.numeroCuenta}`
|
|
)
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
|
})
|
|
localStorage.removeItem('numeroInventario')
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
this.numeroCuenta = this.$route.params.numeroCuenta
|
|
if (this.numeroCuenta) this.buscar()
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style></style>
|