listo carga masiva equipos
This commit is contained in:
parent
280e999974
commit
bc9bbf600c
57
components/admin/CargaMasivaEquipos.vue
Normal file
57
components/admin/CargaMasivaEquipos.vue
Normal file
@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div>
|
||||
<SubirCsv :updateIsLoading="updateIsLoading" :path="path" />
|
||||
|
||||
<div v-for="(d, index) in data" :key="index" v-show="current - 1 === index">
|
||||
<TablaEquiposNuevos :data="d.equiposNuevos" />
|
||||
|
||||
<AvisosErrores :avisos="d.mensajes" :errores="d.errores" />
|
||||
</div>
|
||||
|
||||
<b-pagination :total="total" :per-page="1" v-model="current" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AvisosErrores from '@/components/admin/AvisosErrores'
|
||||
import SubirCsv from '@/components/admin/SubirCsv'
|
||||
import TablaEquiposNuevos from '@/components/admin/TablaEquiposNuevos'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
AvisosErrores,
|
||||
SubirCsv,
|
||||
TablaEquiposNuevos,
|
||||
},
|
||||
props: {
|
||||
updateIsLoading: { type: Function, required: true, default: () => {} },
|
||||
admin: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return { socket: {}, current: 0, total: 0, data: [], path: '' }
|
||||
},
|
||||
methods: {
|
||||
nuevosEquipos(data) {
|
||||
if (this.total === 0) this.current = 1
|
||||
this.data.push(data)
|
||||
this.total = this.data.length
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.path = `upload-file/carga-masiva-equipos?id_institucion=${this.admin.idInstitucion}`
|
||||
},
|
||||
beforeCreate() {
|
||||
this.socket = this.$nuxtSocket({
|
||||
name: 'main',
|
||||
path: process.env.path,
|
||||
})
|
||||
|
||||
this.socket.on('equipos-nuevos', (data) => {
|
||||
if (data.id_institucion === this.admin.idInstitucion)
|
||||
this.nuevosEquipos(data.data)
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style></style>
|
@ -25,8 +25,8 @@ export default {
|
||||
TablaBuscadorModulo,
|
||||
},
|
||||
props: {
|
||||
admin: { type: Object, required: true },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
admin: { type: Object, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -10,7 +10,11 @@
|
||||
expanded
|
||||
>
|
||||
<section
|
||||
class="section is-flex is-align-items-center is-justify-content-center drag-drop"
|
||||
class="
|
||||
section
|
||||
is-flex is-align-items-center is-justify-content-center
|
||||
drag-drop
|
||||
"
|
||||
>
|
||||
<div class="content has-text-centered">
|
||||
<p>
|
||||
@ -50,10 +54,8 @@ import axios from 'axios'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
admin: { type: Object, required: true },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
path: { type: String, required: true },
|
||||
manejarRespuesta: { type: Function, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -84,8 +86,6 @@ export default {
|
||||
this.$getToken.tokenFile()
|
||||
)
|
||||
.then((res) => {
|
||||
this.manejarRespuesta(res.data)
|
||||
|
||||
this.csv = {}
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
|
@ -2,16 +2,7 @@
|
||||
<div>
|
||||
<Title title="Carga masiva equipos" :operador="admin" />
|
||||
|
||||
<SubirCsv
|
||||
:admin="admin"
|
||||
:manejarRespuesta="manejarRespuesta"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:path="path"
|
||||
/>
|
||||
|
||||
<TablaEquiposNuevos :data="data" />
|
||||
|
||||
<AvisosErrores :avisos="avisos" :errores="errores" />
|
||||
<CargaMasivaEquipos :admin="admin" :updateIsLoading="updateIsLoading" />
|
||||
|
||||
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
|
||||
</div>
|
||||
@ -19,50 +10,31 @@
|
||||
|
||||
<script>
|
||||
import jwt_decode from 'jwt-decode'
|
||||
import AvisosErrores from '@/components/admin/AvisosErrores'
|
||||
import SubirCsv from '@/components/admin/SubirCsv'
|
||||
import TablaEquiposNuevos from '@/components/admin/TablaEquiposNuevos'
|
||||
import CargaMasivaEquipos from '@/components/admin/CargaMasivaEquipos'
|
||||
import Title from '@/components/layouts/Title'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
AvisosErrores,
|
||||
SubirCsv,
|
||||
TablaEquiposNuevos,
|
||||
Title,
|
||||
},
|
||||
components: { CargaMasivaEquipos, Title },
|
||||
data() {
|
||||
return {
|
||||
admin: {},
|
||||
data: [],
|
||||
avisos: [],
|
||||
errores: [],
|
||||
path: '',
|
||||
isLoading: false,
|
||||
admin: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
manejarRespuesta(data) {
|
||||
this.data = data.equiposNuevos
|
||||
this.avisos = data.mensajes
|
||||
this.errores = data.errores
|
||||
},
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const operador = jwt_decode(this.$getToken.tokenStr())
|
||||
|
||||
this.admin.idOperador = operador.id_operador
|
||||
this.admin.operador = operador.operador
|
||||
this.admin.tipoUsuario = operador.tipoUsuario.tipo_usuario
|
||||
this.admin.idTipoUsuario = operador.tipoUsuario.id_tipo_usuario
|
||||
this.admin.idInstitucion = operador.institucion.id_institucion
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
this.path = `upload-file/carga-masiva-equipos?id_institucion=${this.admin.idInstitucion}`
|
||||
const operador = jwt_decode(this.$getToken.tokenStr())
|
||||
|
||||
console.log(operador)
|
||||
this.admin.idOperador = operador.id_operador
|
||||
this.admin.operador = operador.operador
|
||||
this.admin.nombre = operador.nombre
|
||||
this.admin.idTipoUsuario = operador.tipoUsuario.id_tipo_usuario
|
||||
this.admin.idInstitucion = operador.institucion.id_institucion
|
||||
if (this.admin.idTipoUsuario != 3)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user