merge
This commit is contained in:
commit
96d69a9a2d
@ -2,13 +2,6 @@
|
||||
<div class="column is-4">
|
||||
<h3 class="is-size-4 mb-4">Administrador</h3>
|
||||
|
||||
<BotonDesactivar
|
||||
:admin="admin"
|
||||
:data="modulo"
|
||||
tipo="módulo"
|
||||
:cambiarStatus="cambiarStatus"
|
||||
/>
|
||||
|
||||
<b-field label="Cambiar nombre del módulo" v-if="modulo.id_modulo">
|
||||
<b-input
|
||||
icon="list-status"
|
||||
@ -40,10 +33,8 @@
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import BotonDesactivar from '@/components/operador/BotonDesactivar'
|
||||
|
||||
export default {
|
||||
components: { BotonDesactivar },
|
||||
props: {
|
||||
admin: { type: Object, required: true },
|
||||
modulo: { type: Object, required: true },
|
||||
@ -66,23 +57,6 @@ export default {
|
||||
// return false
|
||||
// return true
|
||||
},
|
||||
cambiarStatus(dataSelect, status) {
|
||||
const data = { id_modulo: dataSelect.id_modulo, activo: status }
|
||||
this.updateIsLoading(true)
|
||||
|
||||
axios
|
||||
.put(`${process.env.api}/modulo`, data)
|
||||
.then((res) => {
|
||||
this.buscar()
|
||||
// this.obtenerCatalogoModulo(this.data[0].institucion.id_institucion)
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirError(this.$buefy, err)
|
||||
})
|
||||
},
|
||||
updateCarrito() {
|
||||
const data = {
|
||||
id_modulo: this.modulo.id_modulo,
|
||||
|
@ -50,7 +50,12 @@
|
||||
</div>
|
||||
|
||||
<div class="columns">
|
||||
<InfoModulo :modulo="modulo" />
|
||||
<InfoModulo
|
||||
:admin="admin"
|
||||
:modulo="modulo"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:buscar="buscar"
|
||||
/>
|
||||
|
||||
<AdminModulo
|
||||
:admin="admin"
|
||||
|
@ -8,24 +8,27 @@
|
||||
</b-field>
|
||||
|
||||
<b-field class="column" label="Status del Módulo">
|
||||
<p
|
||||
class="input"
|
||||
v-for="(sA, i) in statusActivo"
|
||||
:key="i"
|
||||
:class="sA.tagType"
|
||||
v-show="modulo.activo === sA.activo"
|
||||
>
|
||||
{{ sA.texto }}
|
||||
</p>
|
||||
<BotonDesactivar
|
||||
:admin="admin"
|
||||
:data="modulo"
|
||||
tipo="módulo"
|
||||
:cambiarStatus="cambiarStatus"
|
||||
/>
|
||||
</b-field>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import BotonDesactivar from '@/components/operador/BotonDesactivar'
|
||||
export default {
|
||||
components: { BotonDesactivar },
|
||||
props: {
|
||||
admin: { type: Object, required: true },
|
||||
modulo: { type: Object, required: true },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
buscar: { type: Function, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -39,6 +42,24 @@ export default {
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cambiarStatus(dataSelect, status) {
|
||||
const data = { id_modulo: dataSelect.id_modulo, activo: status }
|
||||
this.updateIsLoading(true)
|
||||
|
||||
axios
|
||||
.put(`${process.env.api}/modulo`, data)
|
||||
.then((res) => {
|
||||
this.buscar()
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirError(this.$buefy, err)
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -61,7 +61,9 @@ export default {
|
||||
const info = JSON.stringify(res.data)
|
||||
localStorage.setItem('usuario', info)
|
||||
this.updateIsLoading(false)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
if (res.data.operador.tipoUsuario.id_tipo_usuario === 3)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
else this.$router.push('/admin/configuracion/instituciones')
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error = 'is-danger'
|
||||
|
@ -1,38 +1,19 @@
|
||||
<template>
|
||||
<div class="columns is-vcentered">
|
||||
<b-field class="column is-8 m-0">
|
||||
<b-input
|
||||
type="password"
|
||||
placeholder="Contraseña Nueva"
|
||||
icon="lock"
|
||||
@keyup.enter.native="
|
||||
$alertsGenericos.imprimirWarning(
|
||||
$buefy,
|
||||
'¿Esta segur@ de querer camibar la contraseña de este operador?',
|
||||
updatePassword
|
||||
)
|
||||
"
|
||||
v-model="newPassword"
|
||||
rounded
|
||||
password-reveal
|
||||
/>
|
||||
</b-field>
|
||||
|
||||
<div class="column">
|
||||
<b-button
|
||||
type="is-info"
|
||||
:disabled="!newPassword"
|
||||
@click="
|
||||
$alertsGenericos.imprimirWarning(
|
||||
$buefy,
|
||||
'¿Esta segur@ de querer camibar la contraseña de este operador?',
|
||||
'¿Esta segur@ de querer reenviar la contraseña de este operador?',
|
||||
updatePassword
|
||||
)
|
||||
"
|
||||
expanded
|
||||
rounded
|
||||
>
|
||||
Cambiar
|
||||
Reenviar Contraseña
|
||||
</b-button>
|
||||
</div>
|
||||
|
||||
@ -46,7 +27,6 @@ import axios from 'axios'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
newPassword: '',
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
@ -57,27 +37,30 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
updatePassword() {
|
||||
if (this.newPassword) {
|
||||
const data = {
|
||||
idOperador: this.operador.idOperador,
|
||||
password: this.newPassword,
|
||||
}
|
||||
|
||||
this.isLoading = true
|
||||
axios
|
||||
.put(`${process.env.api}/operador/update`, data, this.admin.token)
|
||||
.then((res) => {
|
||||
this.newPassword = ''
|
||||
this.isLoading = false
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false
|
||||
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
||||
})
|
||||
const data = {
|
||||
id_operador: this.operador.id_operador,
|
||||
}
|
||||
|
||||
this.isLoading = true
|
||||
axios
|
||||
.put(
|
||||
`${process.env.api}/operador/update-password`,
|
||||
data,
|
||||
this.admin.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.isLoading = false
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false
|
||||
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
console.log(this.operador)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -19,16 +19,7 @@
|
||||
|
||||
<b-menu>
|
||||
<b-menu-list label="Menu">
|
||||
<!-- <b-menu-list>
|
||||
<b-menu-item
|
||||
label="Inicio"
|
||||
:icon="icono('/inicio')"
|
||||
:disabled="activo('/inicio')"
|
||||
@click="opcionMenu('/inicio')"
|
||||
/>
|
||||
</b-menu-list> -->
|
||||
|
||||
<b-menu-list>
|
||||
<b-menu-list v-if="idTipoUsuario === 3 || idTipoUsuario === 4">
|
||||
<b-menu-item
|
||||
label="Préstamo/Devolución"
|
||||
:icon="icono('/operador/prestamo_devolucion')"
|
||||
@ -37,7 +28,7 @@
|
||||
/>
|
||||
</b-menu-list>
|
||||
|
||||
<b-menu-list>
|
||||
<b-menu-list v-if="idTipoUsuario === 3 || idTipoUsuario === 4">
|
||||
<b-menu-item
|
||||
label="Historial de Préstamos"
|
||||
:icon="icono('/operador/historial_prestamos')"
|
||||
@ -155,7 +146,10 @@
|
||||
@click="opcionMenu('/admin/usuarios')"
|
||||
/> -->
|
||||
|
||||
<b-menu-item icon="storefront-outline">
|
||||
<b-menu-item
|
||||
icon="storefront-outline"
|
||||
v-if="idTipoUsuario === 3 || idTipoUsuario === 4"
|
||||
>
|
||||
<template #label="props">
|
||||
Modulos
|
||||
<b-icon
|
||||
|
@ -2,12 +2,14 @@
|
||||
<div class="column is-4">
|
||||
<h3 class="is-size-4 mb-4">Administrador</h3>
|
||||
|
||||
<BotonDesactivar
|
||||
:admin="operador"
|
||||
:data="carrito"
|
||||
tipo="carrito"
|
||||
:cambiarStatus="cambiarStatus"
|
||||
/>
|
||||
<b-field field="status" label="Status del carrito">
|
||||
<BotonDesactivar
|
||||
:admin="operador"
|
||||
:data="carrito"
|
||||
tipo="carrito"
|
||||
:cambiarStatus="cambiarStatus"
|
||||
/>
|
||||
</b-field>
|
||||
|
||||
<b-field
|
||||
label="Cambiar nombre del carrito"
|
||||
|
@ -32,10 +32,7 @@
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<b-field
|
||||
label="Programa"
|
||||
v-if="equipo.carrito.tipoCarrito.id_tipo_carrito === 2"
|
||||
>
|
||||
<b-field label="Programa">
|
||||
<b-select icon="list-status" v-model="idPrograma" expanded rounded>
|
||||
<option
|
||||
v-for="(programa, index) in programas"
|
||||
|
@ -1,19 +1,17 @@
|
||||
<template>
|
||||
<b-field>
|
||||
<b-button
|
||||
:type="data.activo || data.mostrar ? 'is-success' : 'is-danger'"
|
||||
@click="
|
||||
$alertsGenericos.imprimirWarning(
|
||||
$buefy,
|
||||
mensajeWarning,
|
||||
llamarCambiarStatus
|
||||
)
|
||||
"
|
||||
expanded
|
||||
>
|
||||
{{ data.activo || data.mostrar ? 'Activo' : 'Inactivo' }}
|
||||
</b-button>
|
||||
</b-field>
|
||||
<b-button
|
||||
:type="data.activo || data.mostrar ? 'is-success' : 'is-danger'"
|
||||
@click="
|
||||
$alertsGenericos.imprimirWarning(
|
||||
$buefy,
|
||||
mensajeWarning,
|
||||
llamarCambiarStatus
|
||||
)
|
||||
"
|
||||
expanded
|
||||
>
|
||||
{{ data.activo || data.mostrar ? 'Activo' : 'Inactivo' }}
|
||||
</b-button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -153,7 +153,7 @@ export default {
|
||||
)
|
||||
.then((res) => {
|
||||
if (i + 1 === 1) this.carritosC = res.data[0]
|
||||
if (i + 2 === 2) this.carritosL = res.data[0]
|
||||
if (i + 1 === 2) this.carritosL = res.data[0]
|
||||
else this.carritosI = res.data[0]
|
||||
})
|
||||
.catch((err) => {
|
||||
|
@ -6,19 +6,27 @@
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:updateCarrito="updateCarrito"
|
||||
/>
|
||||
|
||||
<TablaEquipos
|
||||
:data="data"
|
||||
:total="total"
|
||||
:obtenerEquipos="obtenerEquipos"
|
||||
:isLoadingTable="isLoadingTable"
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import BuscarCarrito from '@/components/operador/BuscarCarrito'
|
||||
import TablaPrestamos from '@/components/operador/TablaPrestamos'
|
||||
import TablaReportes from '@/components/operador/TablaReportes'
|
||||
import TablaMotivos from '@/components/operador/TablaMotivos'
|
||||
import TablaEquipos from '@/components/operador/TablaEquipos'
|
||||
|
||||
export default {
|
||||
components: { TablaPrestamos, BuscarCarrito, TablaReportes, TablaMotivos },
|
||||
components: { BuscarCarrito, TablaEquipos },
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
total: 0,
|
||||
carrito: { modulo: {}, tipoCarrito: {} },
|
||||
isLoadingTable: false,
|
||||
}
|
||||
@ -28,21 +36,29 @@ export default {
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
},
|
||||
methods: {
|
||||
onPrestamosPageChange(page) {
|
||||
this.pagePrestamos = page
|
||||
this.obtenerPrestamos()
|
||||
},
|
||||
onReportesPageChange(page) {
|
||||
this.pageReportes = page
|
||||
this.obtenerReportes()
|
||||
},
|
||||
onMotivosPageChange(page) {
|
||||
this.pageMotivos = page
|
||||
this.obtenerMotivos()
|
||||
},
|
||||
updateCarrito(valorObject) {
|
||||
this.carrito = valorObject
|
||||
},
|
||||
obtenerEquipos(pagina) {
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/equipo/equipos?pagina=${pagina}&id_carrito=${this.carrito.id_carrito}`
|
||||
)
|
||||
.then((res) => {
|
||||
this.data = res.data[0]
|
||||
this.total = res.data[1]
|
||||
this.isLoadingTable = false
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoadingTable = false
|
||||
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
carrito() {
|
||||
this.obtenerEquipos(1)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -117,17 +117,19 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
programas() {
|
||||
this.programasArray = new Array(0)
|
||||
for (let i = 0; i < this.equipo.programas.length; i++)
|
||||
this.programasArray[i] = this.equipo.programas[i]
|
||||
this.programasArray.push(this.equipo.programas[i])
|
||||
},
|
||||
tiposEntradas() {
|
||||
this.tiposEntradasArray = new Array(0)
|
||||
for (let i = 0; i < this.equipo.tiposEntradas.length; i++)
|
||||
this.tiposEntradasArray[i] = this.equipo.tiposEntradas[i]
|
||||
this.tiposEntradasArray.push(this.equipo.tiposEntradas[i])
|
||||
},
|
||||
programaB(id_equipo_programa) {
|
||||
this.idEquipoPrograma = id_equipo_programa
|
||||
this.$alertsGenericos.imprimirWarning(
|
||||
$buefy,
|
||||
this.$buefy,
|
||||
'¿Estás segur@ de querer borrar este programa?',
|
||||
this.borrarPrograma
|
||||
)
|
||||
@ -152,7 +154,7 @@ export default {
|
||||
tipoEntradaB(id_equipo_tipo_entrada) {
|
||||
this.idEquipoTipoEntrada = id_equipo_tipo_entrada
|
||||
this.$alertsGenericos.imprimirWarning(
|
||||
$buefy,
|
||||
this.$buefy,
|
||||
'¿Estás segur@ de querer borrar este tipo de entrada?',
|
||||
this.borrarTipoEntrada
|
||||
)
|
||||
|
@ -70,8 +70,8 @@ export default {
|
||||
return {
|
||||
tipoCarrito: [
|
||||
{ id_tipo_carrito: 1, tipo_carrito: 'Chromebook' },
|
||||
{ id_tipo_carrito: 2, tipo_carrito: 'iPad' },
|
||||
{ id_tipo_carrito: 3, tipo_carrito: 'Laptop' },
|
||||
{ id_tipo_carrito: 2, tipo_carrito: 'Laptop' },
|
||||
{ id_tipo_carrito: 3, tipo_carrito: 'iPad' },
|
||||
],
|
||||
carritos: [],
|
||||
carrito: '',
|
||||
@ -102,6 +102,7 @@ export default {
|
||||
if (this.idTipoCarrito != 0)
|
||||
id_tipo_carrito = '&id_tipo_carrito=' + this.idTipoCarrito
|
||||
if (this.idModulo != 0) id_modulo = '&id_modulo=' + this.idModulo
|
||||
console.log(this.idTipoCarrito)
|
||||
this.isLoadingTable = true
|
||||
axios
|
||||
.get(
|
||||
|
102
components/operador/TablaEquipos.vue
Normal file
102
components/operador/TablaEquipos.vue
Normal file
@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<b-table
|
||||
:data="data"
|
||||
:total="total"
|
||||
:loading="isLoadingTable"
|
||||
@page-change="onPageChange"
|
||||
:selected.sync="selectedEquipo"
|
||||
:row-class="(row, index) => 'pointer'"
|
||||
backend-pagination
|
||||
hoverable
|
||||
striped
|
||||
paginated
|
||||
>
|
||||
<b-table-column field="equipo" label="Equipo" centered v-slot="props">
|
||||
{{ props.row.equipo }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column
|
||||
field="numeroInventario"
|
||||
label="Número de Inventario"
|
||||
centered
|
||||
v-slot="props"
|
||||
>
|
||||
{{ props.row.numero_inventario }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column field="carrito" label="Carrito" centered v-slot="props">
|
||||
{{ props.row.carrito.carrito }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column field="modulo" label="Módulo" centered v-slot="props">
|
||||
{{ props.row.carrito.modulo.modulo }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column
|
||||
field="tipoCarrito"
|
||||
label="Tipo Carrito"
|
||||
centered
|
||||
v-slot="props"
|
||||
>
|
||||
{{ props.row.carrito.tipoCarrito.tipo_carrito }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column field="status" label="Status" centered v-slot="props">
|
||||
<span
|
||||
class="is-size-6 tag"
|
||||
:class="choooseTag(props.row.status.id_status)"
|
||||
>
|
||||
{{ props.row.status.status }}
|
||||
</span>
|
||||
</b-table-column>
|
||||
</b-table>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
obtenerEquipos: { type: Function, required: true },
|
||||
data: { type: Array, required: true },
|
||||
total: { type: Number, required: true },
|
||||
isLoadingTable: { type: Boolean, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
selectedEquipo: {},
|
||||
page: 1,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onPageChange(page) {
|
||||
this.page = page
|
||||
this.obtenerEquipos(this.page)
|
||||
},
|
||||
choooseTag(idStatus) {
|
||||
const style = {
|
||||
1: 'is-info',
|
||||
2: 'is-link',
|
||||
3: 'is-primary',
|
||||
4: 'is-success',
|
||||
5: 'is-warning',
|
||||
6: 'is-danger',
|
||||
7: 'is-black',
|
||||
}
|
||||
return style[idStatus]
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
selectedEquipo() {
|
||||
this.$router.push(
|
||||
'/operador/equipos/buscar_equipo/' +
|
||||
this.selectedEquipo.numero_inventario
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
@ -258,7 +258,7 @@ export default {
|
||||
},
|
||||
onPageChange: {
|
||||
type: Function,
|
||||
require: true,
|
||||
required: true,
|
||||
},
|
||||
total: {
|
||||
type: Number,
|
||||
@ -266,92 +266,92 @@ export default {
|
||||
},
|
||||
columnaNumeroCuenta: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaNombre: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaCarrera: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaOperadores: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaNumeroInventario: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaTipo: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaCarrito: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaEquipo: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaModulo: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaHoraRegreso: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaHoraFin: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaIdPrestamo: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaEnUso: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaBotonCancelar: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaCanceladoOperador: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
columnaCanceladoUsuario: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
filaRetraso: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
filaActivo: {
|
||||
type: Boolean,
|
||||
require: false,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
updateIsLoadingPage: {
|
||||
|
@ -6,7 +6,7 @@
|
||||
placeholder="Carrito"
|
||||
v-model="carrito"
|
||||
rounded
|
||||
@keyup.enter.native="obtenerEquipos"
|
||||
@keyup.enter.native="obtenerEquipos(1)"
|
||||
/>
|
||||
</b-field>
|
||||
|
||||
@ -15,109 +15,50 @@
|
||||
placeholder="Equipo"
|
||||
v-model="equipo"
|
||||
rounded
|
||||
@keyup.enter.native="obtenerEquipos"
|
||||
@keyup.enter.native="obtenerEquipos(1)"
|
||||
/>
|
||||
</b-field>
|
||||
|
||||
<b-button
|
||||
class="column mb-0"
|
||||
type="is-info"
|
||||
@click="obtenerEquipos"
|
||||
@click="obtenerEquipos(1)"
|
||||
expanded
|
||||
rounded
|
||||
>Buscar</b-button
|
||||
>
|
||||
</div>
|
||||
|
||||
<b-table
|
||||
<TablaEquipos
|
||||
:data="data"
|
||||
:total="total"
|
||||
:loading="isLoadingTable"
|
||||
@page-change="onPageChange"
|
||||
:selected.sync="selectedEquipo"
|
||||
:row-class="(row, index) => 'pointer'"
|
||||
backend-pagination
|
||||
hoverable
|
||||
striped
|
||||
paginated
|
||||
>
|
||||
<b-table-column field="equipo" label="Equipo" centered v-slot="props">
|
||||
{{ props.row.equipo }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column
|
||||
field="numeroInventario"
|
||||
label="Número de Inventario"
|
||||
centered
|
||||
v-slot="props"
|
||||
>
|
||||
{{ props.row.numero_inventario }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column field="carrito" label="Carrito" centered v-slot="props">
|
||||
{{ props.row.carrito.carrito }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column field="modulo" label="Módulo" centered v-slot="props">
|
||||
{{ props.row.carrito.modulo.modulo }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column
|
||||
field="tipoCarrito"
|
||||
label="Tipo Carrito"
|
||||
centered
|
||||
v-slot="props"
|
||||
>
|
||||
{{ props.row.carrito.tipoCarrito.tipo_carrito }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column field="status" label="Status" centered v-slot="props">
|
||||
<span
|
||||
class="is-size-6 tag"
|
||||
:class="choooseTag(props.row.status.id_status)"
|
||||
>
|
||||
{{ props.row.status.status }}
|
||||
</span>
|
||||
</b-table-column>
|
||||
</b-table>
|
||||
:obtenerEquipos="obtenerEquipos"
|
||||
:isLoadingTable="isLoadingTable"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import TablaEquipos from '@/components/operador/TablaEquipos'
|
||||
export default {
|
||||
components: {
|
||||
TablaEquipos,
|
||||
},
|
||||
props: {
|
||||
operador: { type: Object, require: true },
|
||||
operador: { type: Object, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
total: 0,
|
||||
selectedEquipo: {},
|
||||
isLoadingTable: false,
|
||||
page: 1,
|
||||
carrito: '',
|
||||
equipo: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onPageChange(page) {
|
||||
this.page = page
|
||||
this.obtenerEquipos()
|
||||
},
|
||||
choooseTag(idStatus) {
|
||||
const style = {
|
||||
1: 'is-info',
|
||||
2: 'is-link',
|
||||
3: 'is-primary',
|
||||
4: 'is-success',
|
||||
5: 'is-warning',
|
||||
6: 'is-danger',
|
||||
7: 'is-black',
|
||||
}
|
||||
return style[idStatus]
|
||||
},
|
||||
obtenerEquipos() {
|
||||
obtenerEquipos(pagina) {
|
||||
let carrito = ''
|
||||
let equipo = ''
|
||||
if (this.carrito != '') carrito = '&carrito=' + this.carrito
|
||||
@ -125,7 +66,7 @@ export default {
|
||||
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/equipo/equipos?pagina=${this.page}${carrito}${equipo}`
|
||||
`${process.env.api}/equipo/equipos?pagina=${pagina}${carrito}${equipo}`
|
||||
)
|
||||
.then((res) => {
|
||||
this.data = res.data[0]
|
||||
@ -138,22 +79,8 @@ export default {
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
selectedEquipo() {
|
||||
this.$router.push({
|
||||
path:
|
||||
'../equipos/buscar_equipo/' + this.selectedEquipo.numero_inventario,
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.obtenerEquipos()
|
||||
this.obtenerEquipos(1)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
@ -6,20 +6,41 @@
|
||||
:updateUsuario="updateUsuario"
|
||||
:usuario="usuario"
|
||||
/>
|
||||
|
||||
<TablaPrestamo
|
||||
:isLoadingTable="isLoading"
|
||||
:data="data"
|
||||
:page="page"
|
||||
:onPageChange="onPageChange"
|
||||
:total="total"
|
||||
:columnaNumeroInventario="true"
|
||||
:columnaTipo="true"
|
||||
:columnaEquipo="true"
|
||||
:columnaCarrito="true"
|
||||
:columnaModulo="true"
|
||||
:columnaHoraRegreso="true"
|
||||
:columnaIdPrestamo="true"
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import BuscarUsuario from '@/components/operador/usuarios/BuscarUsuario'
|
||||
import TablaPrestamo from '@/components/operador/TablaPrestamo'
|
||||
|
||||
export default {
|
||||
components: { BuscarUsuario },
|
||||
components: { BuscarUsuario, TablaPrestamo },
|
||||
props: {
|
||||
operador: { type: Object, required: true },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
page: 1,
|
||||
total: 0,
|
||||
isLoading: false,
|
||||
usuario: { instituciones: [], tipoUsuario: {} },
|
||||
}
|
||||
},
|
||||
@ -27,6 +48,33 @@ export default {
|
||||
updateUsuario(valorObject) {
|
||||
this.usuario = valorObject
|
||||
},
|
||||
onPageChange(page) {
|
||||
this.page = page
|
||||
this.obtenerPrestamos()
|
||||
},
|
||||
obtenerPrestamos() {
|
||||
this.isLoading = true
|
||||
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/prestamo/historial-usuario?pagina=${this.page}&id_usuario=${this.usuario.id_usuario}`,
|
||||
this.operador.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.data = res.data[0]
|
||||
this.total = res.data[1]
|
||||
this.isLoading = false
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false
|
||||
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
usuario() {
|
||||
this.obtenerPrestamos()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user