equipos corregido
This commit is contained in:
parent
753ec9b7b1
commit
3a50be279e
@ -77,10 +77,7 @@
|
||||
/>
|
||||
</b-menu-item>
|
||||
|
||||
<b-menu-item
|
||||
icon="cellphone-link"
|
||||
v-if="idTipoUsuario === 3 || idTipoUsuario === 4"
|
||||
>
|
||||
<b-menu-item icon="cellphone-link">
|
||||
<template #label="props">
|
||||
Equipos
|
||||
<b-icon
|
||||
@ -94,6 +91,7 @@
|
||||
:icon="icono('/equipos/buscar_equipo')"
|
||||
:disabled="activo('/equipos/buscar_equipo')"
|
||||
@click="opcionMenu('/equipos/buscar_equipo')"
|
||||
v-if="idTipoUsuario === 3 || idTipoUsuario === 4"
|
||||
/>
|
||||
|
||||
<b-menu-item
|
||||
|
@ -8,7 +8,7 @@
|
||||
/>
|
||||
|
||||
<b-tabs>
|
||||
<TabEquiposCarrito :carrito="carrito" />
|
||||
<TabEquiposCarrito :carrito="carrito" :operador="operador" />
|
||||
|
||||
<TabMotivosCarrito :carrito="carrito" :operador="operador" />
|
||||
</b-tabs>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<b-tabs>
|
||||
<TabPrestamosEquipo :equipo="equipo" />
|
||||
|
||||
<TabMotivosEquipo :equipo="equipo" />
|
||||
<TabMotivosEquipo :equipo="equipo" :operador="operador" />
|
||||
</b-tabs>
|
||||
</section>
|
||||
</template>
|
||||
@ -27,8 +27,8 @@ export default {
|
||||
TabPrestamosEquipo,
|
||||
},
|
||||
props: {
|
||||
operador: { type: Object, required: true },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
updateIsLoading: { type: Function, required: true, default: () => {} },
|
||||
operador: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -6,6 +6,7 @@
|
||||
:total="total"
|
||||
:onPageChange="onPageChange"
|
||||
:isLoadingTable="isLoadingTable"
|
||||
:operador="operador"
|
||||
/>
|
||||
</b-tab-item>
|
||||
</template>
|
||||
@ -18,6 +19,7 @@ export default {
|
||||
components: { TablaEquipos },
|
||||
props: {
|
||||
carrito: { type: Object, required: true, default: () => ({}) },
|
||||
operador: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -65,7 +65,6 @@ export default {
|
||||
.then((res) => {
|
||||
const data = []
|
||||
|
||||
console.log(res.data)
|
||||
for (let i = 0; i < res.data.length; i++)
|
||||
data.push({
|
||||
id_motivo: res.data[i].id_motivo,
|
||||
|
@ -1,5 +1,14 @@
|
||||
<template>
|
||||
<b-tab-item label="Motivos">
|
||||
<div class="has-text-centered">
|
||||
<BotonDescargarCatalogo
|
||||
campo="reporte"
|
||||
:nombreArchivo="`reporte_motivos_${equipo.carrito.modulo.modulo}_${equipo.carrito.carrito}_${equipo.equipo}`"
|
||||
:obtener="obtenerMotivosReporte"
|
||||
v-if="operador.tipoUsuario.id_tipo_usuario === 3"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<TablaMotivosEquipo
|
||||
:motivos="motivos"
|
||||
:page="page"
|
||||
@ -12,12 +21,15 @@
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import moment from 'moment'
|
||||
import BotonDescargarCatalogo from '@/components/botones/BotonDescargarCatalogo'
|
||||
import TablaMotivosEquipo from '@/components/tablas/TablaMotivosEquipo'
|
||||
|
||||
export default {
|
||||
components: { TablaMotivosEquipo },
|
||||
components: { BotonDescargarCatalogo, TablaMotivosEquipo },
|
||||
props: {
|
||||
equipo: { type: Object, required: true, default: () => ({}) },
|
||||
operador: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -48,6 +60,35 @@ export default {
|
||||
this.isLoadingTable = false
|
||||
})
|
||||
},
|
||||
obtenerMotivosReporte() {
|
||||
return axios
|
||||
.get(
|
||||
`${process.env.api}/equipo-motivo/reporte?&id_equipo=${this.equipo.id_equipo}`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
const data = []
|
||||
|
||||
for (let i = 0; i < res.data.length; i++)
|
||||
data.push({
|
||||
id_motivo: res.data[i].id_motivo,
|
||||
fecha_creacion: moment(res.data[i].fecha_creacion).format(
|
||||
'DD/MM/YYYY hh:mm'
|
||||
),
|
||||
motivo: res.data[i].motivo,
|
||||
operador: res.data[i].operador.operador,
|
||||
status: res.data[i].status.status,
|
||||
})
|
||||
return data
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$alertsGenericos.imprimirError(
|
||||
this.$buefy,
|
||||
this.$router,
|
||||
err.response.data
|
||||
)
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
equipo() {
|
||||
|
@ -54,7 +54,10 @@
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Software">
|
||||
<b-field
|
||||
label="Software"
|
||||
v-if="equipo.carrito.tipoCarrito.id_tipo_carrito === 2"
|
||||
>
|
||||
<b-select
|
||||
icon="list-status"
|
||||
v-model="idPrograma"
|
||||
@ -75,7 +78,10 @@
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Cambiar nombre del equipo" v-if="operador.tipoUsurio === 3">
|
||||
<b-field
|
||||
label="Cambiar nombre del equipo"
|
||||
v-if="operador.tipoUsuario.id_tipo_usuario === 3"
|
||||
>
|
||||
<b-input
|
||||
icon="list-status"
|
||||
placeholder="Nuevo nombre del equipo"
|
||||
@ -162,51 +168,36 @@ export default {
|
||||
if (
|
||||
this.idStatus != this.equipo.status.id_status ||
|
||||
this.nuevoNombreEquipo != ''
|
||||
) {
|
||||
)
|
||||
this.updateEquipo()
|
||||
this.motivo = ''
|
||||
}
|
||||
for (let i = 0; i < this.programas.length; i++) {
|
||||
if (this.idPrograma) {
|
||||
if (
|
||||
this.equipo.programas.length === 0 ||
|
||||
this.idPrograma != this.equipo.programas[i].programa.id_programa
|
||||
) {
|
||||
this.updateProgramas()
|
||||
this.idPrograma = null
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < this.tipoEntradas.length; i++) {
|
||||
if (this.idTipoEntrada) {
|
||||
if (
|
||||
this.equipo.tiposEntradas.length === 0 ||
|
||||
this.idTipoEntrada !=
|
||||
this.equipo.tiposEntradas[i].tipoEntrada.id_tipo_entrada
|
||||
) {
|
||||
this.updateTipoEntradas()
|
||||
this.idTipoEntrada = null
|
||||
}
|
||||
}
|
||||
}
|
||||
if (
|
||||
this.idPrograma &&
|
||||
!this.equipo.programas.find((element) => element === this.idPrograma)
|
||||
)
|
||||
this.crearEquipoPrograma()
|
||||
if (
|
||||
this.idTipoEntrada &&
|
||||
!this.equipo.tiposEntradas.find(
|
||||
(element) => element === this.idTipoEntrada
|
||||
)
|
||||
)
|
||||
this.crearTipoEntrada()
|
||||
},
|
||||
updateEquipo() {
|
||||
const data = {
|
||||
id_equipo: this.equipo.id_equipo,
|
||||
equipo: this.nuevoNombreEquipo
|
||||
? this.nuevoNombreEquipo
|
||||
: this.equipo.equpo,
|
||||
id_operador: this.operador.id_operador,
|
||||
id_status:
|
||||
this.idStatus != this.equipo.status.id_status ? this.idStatus : null,
|
||||
motivo: this.motivo,
|
||||
idPrograma: this.idPrograma ? this.idPrograma : null,
|
||||
const data = { id_equipo: this.equipo.id_equipo }
|
||||
|
||||
if (this.idStatus && this.idStatus != this.equipo.status.id_status) {
|
||||
data.id_status = this.idStatus
|
||||
data.motivo = this.motivo
|
||||
}
|
||||
if (this.nuevoNombreEquipo) data.equipo = this.nuevoNombreEquipo
|
||||
|
||||
this.updateIsLoading(true)
|
||||
return axios
|
||||
.put(`${process.env.api}/equipo`, data, this.$getToken.token())
|
||||
.then((res) => {
|
||||
if (this.mostrarMotivo) this.mostrarMotivo = false
|
||||
if (this.motivo) this.motivo = ''
|
||||
this.buscar()
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
@ -220,11 +211,12 @@ export default {
|
||||
)
|
||||
})
|
||||
},
|
||||
updateProgramas() {
|
||||
crearEquipoPrograma() {
|
||||
const data = {
|
||||
id_equipo: this.equipo.id_equipo,
|
||||
id_programa: this.idPrograma,
|
||||
}
|
||||
|
||||
this.updateIsLoading(true)
|
||||
return axios
|
||||
.post(
|
||||
@ -233,6 +225,7 @@ export default {
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.idPrograma = null
|
||||
this.buscar()
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
@ -246,11 +239,12 @@ export default {
|
||||
)
|
||||
})
|
||||
},
|
||||
updateTipoEntradas() {
|
||||
crearTipoEntrada() {
|
||||
const data = {
|
||||
id_equipo: this.equipo.id_equipo,
|
||||
id_tipo_entrada: this.idTipoEntrada,
|
||||
}
|
||||
|
||||
this.updateIsLoading(true)
|
||||
return axios
|
||||
.post(
|
||||
@ -259,6 +253,7 @@ export default {
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.idTipoEntrada = null
|
||||
this.buscar()
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
|
@ -71,6 +71,7 @@
|
||||
:onPageChange="onPageChange"
|
||||
:total="total"
|
||||
:page="page"
|
||||
:operador="operador"
|
||||
columnaActivo
|
||||
columnaInstitucion
|
||||
/>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<h3 class="is-size-4 mb-3">Todos los equipos</h3>
|
||||
<h3 class="is-size-4 mb-3">Equipos: {{ total }}</h3>
|
||||
|
||||
<div class="columns is-multiline mb-5 is-align-items-flex-end">
|
||||
<SelectInstitucion
|
||||
@ -20,6 +20,7 @@
|
||||
? operador.institucion.id_institucion
|
||||
: idInstitucion
|
||||
"
|
||||
:operador="operador"
|
||||
:idModuloPadre="idModulo"
|
||||
@modulo-seleccionado="(nuevoModulo) => (idModulo = nuevoModulo)"
|
||||
/>
|
||||
@ -77,6 +78,7 @@
|
||||
:onPageChange="onPageChange"
|
||||
:total="total"
|
||||
:page="page"
|
||||
:operador="operador"
|
||||
columnaActivo
|
||||
columnaInstitucion
|
||||
/>
|
||||
@ -107,7 +109,7 @@ export default {
|
||||
SelectTipoCarrito,
|
||||
TablaEquipos,
|
||||
},
|
||||
props: { operador: { type: Object, required: true } },
|
||||
props: { operador: { type: Object, required: true, default: () => ({}) } },
|
||||
data() {
|
||||
return {
|
||||
equipos: [],
|
||||
|
@ -26,6 +26,7 @@
|
||||
:modulos="modulos"
|
||||
:isLoadingTable="isLoadingTable"
|
||||
:obtenerModulos="obtenerModulos"
|
||||
:operador="admin"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -5,6 +5,7 @@
|
||||
:onPageChange="onPageChange"
|
||||
:page="page"
|
||||
:total="total"
|
||||
:operador="operador"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@ -16,6 +17,7 @@ export default {
|
||||
components: { TablaCarritos },
|
||||
props: {
|
||||
modulo: { type: Object, required: true, default: () => ({}) },
|
||||
operador: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -5,6 +5,7 @@
|
||||
:onPageChange="onPageChange"
|
||||
:page="page"
|
||||
:total="total"
|
||||
:operador="operador"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@ -16,6 +17,7 @@ export default {
|
||||
components: { TablaEquipos },
|
||||
props: {
|
||||
carrito: { type: Object, required: true, default: () => ({}) },
|
||||
operador: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -40,7 +40,7 @@
|
||||
</b-table-column>
|
||||
|
||||
<template #detail="props">
|
||||
<EquiposCarrito :carrito="props.row" />
|
||||
<EquiposCarrito :carrito="props.row" :operador="operador" />
|
||||
</template>
|
||||
</b-table>
|
||||
</template>
|
||||
@ -56,6 +56,7 @@ export default {
|
||||
onPageChange: { type: Function, required: true, default: () => {} },
|
||||
page: { type: Number, required: true, default: 1 },
|
||||
total: { type: Number, required: true, default: 0 },
|
||||
operador: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -5,7 +5,10 @@
|
||||
:data="equipos"
|
||||
:loading="isLoadingTable"
|
||||
:per-page="15"
|
||||
:row-class="(row, index) => 'pointer'"
|
||||
:row-class="
|
||||
(row, index) =>
|
||||
operador.tipoUsuario.id_tipo_usuario > 2 ? 'pointer' : ''
|
||||
"
|
||||
:selected.sync="equipoSeleccionado"
|
||||
:total="total"
|
||||
@page-change="onPageChange"
|
||||
@ -60,6 +63,7 @@ export default {
|
||||
onPageChange: { type: Function, required: true, default: () => {} },
|
||||
page: { type: Number, required: true, default: 1 },
|
||||
total: { type: Number, required: true, default: 0 },
|
||||
operador: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return { equipoSeleccionado: {} }
|
||||
@ -86,9 +90,10 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
equipoSeleccionado() {
|
||||
this.$router.push(
|
||||
`/equipos/buscar_equipo/${this.equipoSeleccionado.numero_inventario}`
|
||||
)
|
||||
if (this.operador.tipoUsuario.id_tipo_usuario > 2)
|
||||
this.$router.push(
|
||||
`/equipos/buscar_equipo/${this.equipoSeleccionado.numero_inventario}`
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
</b-table-column>
|
||||
|
||||
<template #detail="props">
|
||||
<CarritosModulo :modulo="props.row" />
|
||||
<CarritosModulo :modulo="props.row" :operador="operador" />
|
||||
</template>
|
||||
</b-table>
|
||||
</template>
|
||||
@ -37,6 +37,7 @@ export default {
|
||||
props: {
|
||||
modulos: { type: Array, required: true, default: () => [] },
|
||||
isLoadingTable: { type: Boolean, required: true, default: false },
|
||||
operador: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return { moduloSeleccionado: {} }
|
||||
|
Loading…
Reference in New Issue
Block a user