321 lines
8.1 KiB
Vue
321 lines
8.1 KiB
Vue
<template>
|
|
<section class="section">
|
|
<div class="columns">
|
|
<b-field class="column" label="Número de Cuenta">
|
|
<b-input
|
|
type="text"
|
|
placeholder="No.Cuenta"
|
|
icon="school"
|
|
rounded
|
|
v-model="numeroCuenta"
|
|
maxlength="9"
|
|
@keyup.enter.native="obtenerServicios()"
|
|
></b-input>
|
|
</b-field>
|
|
|
|
<b-field class="column" label="Nombre">
|
|
<b-input
|
|
type="name"
|
|
placeholder="Nombre"
|
|
icon="account"
|
|
rounded
|
|
v-model="nombre"
|
|
@keyup.enter.native="obtenerServicios()"
|
|
></b-input>
|
|
</b-field>
|
|
|
|
<b-field class="column" label="Status">
|
|
<b-select icon="information" expanded rounded v-model="idStatus">
|
|
<option value="">Status</option>
|
|
<option
|
|
v-for="(s, i) in status"
|
|
:key="i"
|
|
:value="s.idStatus"
|
|
v-show="i < 9"
|
|
>
|
|
{{ s.status }}
|
|
</option>
|
|
</b-select>
|
|
</b-field>
|
|
|
|
<b-button
|
|
type="is-info"
|
|
class="column is-align-self-center"
|
|
expanded
|
|
@click="obtenerServicios()"
|
|
>
|
|
Buscar
|
|
</b-button>
|
|
</div>
|
|
|
|
<b-table
|
|
:data="data"
|
|
:total="total"
|
|
:current-page="page"
|
|
:per-page="perPage"
|
|
:loading="isLoading"
|
|
@page-change="onPageChange"
|
|
hoverable
|
|
striped
|
|
paginated
|
|
backend-pagination
|
|
>
|
|
<b-table-column
|
|
field="numeroCuenta"
|
|
label="Número de Cuenta"
|
|
v-slot="props"
|
|
centered
|
|
>
|
|
<span>{{ props.row.Usuario.usuario }}</span>
|
|
</b-table-column>
|
|
|
|
<b-table-column field="nombre" label="Nombre" v-slot="props" centered>
|
|
<span>{{ props.row.Usuario.nombre }}</span>
|
|
</b-table-column>
|
|
|
|
<b-table-column field="carrera" label="Carrera" v-slot="props" centered>
|
|
<span>{{ props.row.Carrera.carrera }}</span>
|
|
</b-table-column>
|
|
|
|
<b-table-column
|
|
field="fechaInicio"
|
|
label="Fecha Inicio"
|
|
v-slot="props"
|
|
centered
|
|
>
|
|
<span>{{ fecha(props.row.fechaInicio) }}</span>
|
|
</b-table-column>
|
|
|
|
<b-table-column
|
|
field="fechaFin"
|
|
label="Fecha Fin"
|
|
v-slot="props"
|
|
centered
|
|
>
|
|
<span>{{ fecha(props.row.fechaFin) }}</span>
|
|
</b-table-column>
|
|
|
|
<b-table-column field="status" label="Status" v-slot="props" centered>
|
|
<b-button
|
|
type="is-danger"
|
|
size="is-small"
|
|
class="tag"
|
|
@click="responsableUpdate(props.row.idServicio, 'carta_aceptacion')"
|
|
v-if="props.row.Status.idStatus === 7"
|
|
>
|
|
Carta Aceptación Rechazada
|
|
</b-button>
|
|
|
|
<span :class="types(props.row.Status.idStatus)" v-else>{{
|
|
props.row.Status.status
|
|
}}</span>
|
|
</b-table-column>
|
|
|
|
<b-table-column
|
|
field="cartaTermino"
|
|
label="Carta Término"
|
|
v-slot="props"
|
|
centered
|
|
>
|
|
<div v-if="ultimosCampos(props.row.Status.idStatus)">
|
|
<span v-if="props.row.cartaTermino">
|
|
<b-icon icon="check" class="tag is-success"></b-icon>
|
|
</span>
|
|
|
|
<b-button
|
|
type="is-danger"
|
|
size="is-small"
|
|
class="tag"
|
|
@click="responsableUpdate(props.row.idServicio, 'carta_termino')"
|
|
v-else
|
|
>
|
|
Carta Término
|
|
</b-button>
|
|
</div>
|
|
</b-table-column>
|
|
|
|
<b-table-column
|
|
field="cuestionarioP"
|
|
label="Cuestionario"
|
|
v-slot="props"
|
|
centered
|
|
>
|
|
<div v-if="ultimosCampos(props.row.Status.idStatus)">
|
|
<span v-if="props.row.idCuestionarioPrograma">
|
|
<b-icon icon="check" class="tag is-success"></b-icon>
|
|
</span>
|
|
|
|
<b-button
|
|
type="is-danger"
|
|
size="is-small"
|
|
class="tag"
|
|
@click="responsableUpdate(props.row.idServicio, 'cuestionario')"
|
|
v-else
|
|
>
|
|
Cuestionario
|
|
</b-button>
|
|
</div>
|
|
</b-table-column>
|
|
</b-table>
|
|
</section>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import moment from 'moment'
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
responsable: {},
|
|
status: [],
|
|
data: [],
|
|
page: 1,
|
|
perPage: 25,
|
|
total: 0,
|
|
isLoading: false,
|
|
busqueda: {},
|
|
numeroCuenta: '',
|
|
numeroCuentaAnterior: '',
|
|
nombre: '',
|
|
nombreAnterior: '',
|
|
idStatus: '',
|
|
idStatusAnterior: '',
|
|
token: {},
|
|
}
|
|
},
|
|
methods: {
|
|
fecha(date) {
|
|
if (date) {
|
|
const fecha = moment(date)
|
|
|
|
return `${fecha.date() < 10 ? '0' + fecha.date() : fecha.date()}/${
|
|
fecha.month() < 9 ? '0' + (fecha.month() + 1) : fecha.month() + 1
|
|
}/${fecha.year()}`
|
|
}
|
|
return ''
|
|
},
|
|
ultimosCampos(idStatus) {
|
|
return idStatus >= 4 && idStatus != 7
|
|
},
|
|
types(idStatus) {
|
|
let style = 'tag'
|
|
|
|
if (idStatus === 1) style += ' is-dark'
|
|
if (idStatus === 2) style += ' is-info'
|
|
if (idStatus === 3) style += ' is-warning'
|
|
if (idStatus === 4) style += ' is-link'
|
|
if (idStatus === 5) style += ' is-success'
|
|
if (idStatus === 6) style += ' is-success is-light'
|
|
if (idStatus >= 7 && idStatus <= 9) style += ' is-danger'
|
|
return style
|
|
},
|
|
onPageChange(page) {
|
|
this.page = page
|
|
this.obtenerServicios()
|
|
},
|
|
responsableUpdate(idServicio, path) {
|
|
localStorage.setItem('idServicio', idServicio)
|
|
this.$router.push(`/responsable/${path}`)
|
|
},
|
|
obtenerServicios() {
|
|
let data = ''
|
|
|
|
this.isLoading = true
|
|
if (
|
|
this.numeroCuenta != this.numeroCuentaAnterior ||
|
|
this.nombre != this.nombreAnterior ||
|
|
this.idStatus != this.idStatusAnterior
|
|
) {
|
|
this.page = 1
|
|
this.numeroCuentaAnterior = this.numeroCuenta
|
|
this.nombreAnterior = this.nombre
|
|
this.idStatusAnterior = this.idStatus
|
|
}
|
|
if (this.idStatus) data += `&idStatus=${this.idStatus}`
|
|
if (this.nombre) data += `&nombre=${this.nombre}`
|
|
if (this.numeroCuenta) data = `&numeroCuenta=${this.numeroCuenta}`
|
|
axios
|
|
.get(
|
|
`${process.env.api}/servicio/servicios_responsable?idUsuario=${this.responsable.idUsuario}&pagina=${this.page}${data}`,
|
|
this.token
|
|
)
|
|
.then((res) => {
|
|
this.data = res.data.serviciosResponsable
|
|
this.total = res.data.count
|
|
this.isLoading = false
|
|
})
|
|
.catch((err) => {
|
|
this.isLoading = false
|
|
this.imprimirError(err.response.data)
|
|
})
|
|
},
|
|
obtenerCatalogoStatus() {
|
|
axios
|
|
.get(`${process.env.api}/status`, this.token)
|
|
.then((res) => {
|
|
this.status = res.data
|
|
})
|
|
.catch((err) => {
|
|
this.imprimirError(err.response.data)
|
|
})
|
|
},
|
|
imprimirError(err) {
|
|
this.$buefy.dialog.alert({
|
|
title: 'Error',
|
|
message: err.message,
|
|
type: 'is-danger',
|
|
hasIcon: true,
|
|
icon: 'alert-circle',
|
|
ariaRole: 'alertdialog',
|
|
ariaModal: true,
|
|
})
|
|
if (err.err === 'token error') {
|
|
localStorage.clear()
|
|
this.$router.push('/')
|
|
}
|
|
},
|
|
getLocalhostInfo() {
|
|
this.responsable.idUsuario = localStorage.getItem('idUsuario')
|
|
this.responsable.idTipoUsuario = Number(
|
|
localStorage.getItem('idTipoUsuario')
|
|
)
|
|
this.responsable.tipoUsuario = localStorage.getItem('tipoUsuario')
|
|
this.token = {
|
|
headers: {
|
|
token: localStorage.getItem('token'),
|
|
},
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
this.getLocalhostInfo()
|
|
if (this.responsable.idTipoUsuario === 2) {
|
|
this.obtenerCatalogoStatus()
|
|
this.obtenerServicios()
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.input:focus {
|
|
border: #1b3d70;
|
|
box-shadow: 0 0 8px 0 #1b3d70;
|
|
}
|
|
|
|
.select select:focus {
|
|
border-color: #1b3d70;
|
|
box-shadow: 0 0 8px 0 #1b3d70;
|
|
}
|
|
|
|
.select:not(.is-multiple):not(.is-loading)::after {
|
|
border-color: #1b3d70;
|
|
}
|
|
|
|
.pagination-link.is-current {
|
|
background-color: #1b3d70;
|
|
border-color: #1b3d70;
|
|
}
|
|
</style>
|