listo responsable info
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<b-field>
|
||||
<b-upload
|
||||
type="is-black"
|
||||
@input="validarCsv()"
|
||||
@input="validarExt()"
|
||||
v-model="csv"
|
||||
drag-drop
|
||||
expanded
|
||||
@@ -94,6 +94,7 @@ export default {
|
||||
this.admin.tipoUsuario = localStorage.getItem('tipoUsuario')
|
||||
this.token = {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
}
|
||||
@@ -104,12 +105,7 @@ export default {
|
||||
this.isLoading = true
|
||||
formData.append('csv', this.csv)
|
||||
axios
|
||||
.post(`${process.env.api}/programa/carga_masiva`, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
token: this.token.headers.token,
|
||||
},
|
||||
})
|
||||
.post(`${process.env.api}/programa/carga_masiva`, formData, this.token)
|
||||
.then((res) => {
|
||||
this.isLoading = false
|
||||
this.toastType = 'is-success'
|
||||
@@ -119,7 +115,7 @@ export default {
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false
|
||||
this.error(err.response.data)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
imprimirError(err) {
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
<template>
|
||||
<div>
|
||||
<h3 class="title">Información del responsable</h3>
|
||||
|
||||
<b-field label="Nombre:">
|
||||
<p class="input">{{ nombre }}</p>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Correo:">
|
||||
<p class="input">{{ correo }}</p>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Clave de programa:">
|
||||
<b-select v-model="programaSeleccionado" expanded>
|
||||
<option value="" disabled>Elija una clave de programa:</option>
|
||||
<option v-for="(p, i) in programas" :key="i" :value="i">
|
||||
{{ p.clavePrograma }}
|
||||
</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Institucion:">
|
||||
<p class="input">{{ programa.institucion }}</p>
|
||||
</b-field>
|
||||
<b-field label="Dependencia:">
|
||||
<p class="input">{{ programa.dependencia }}</p>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Programa:">
|
||||
<p class="input">{{ programa.programa }}</p>
|
||||
</b-field>
|
||||
|
||||
<div>
|
||||
<b-button
|
||||
type="is-link"
|
||||
class="my-5"
|
||||
tag="router-link"
|
||||
to="/admin/responsables/infoResponsable/modificar"
|
||||
>
|
||||
Editar información
|
||||
</b-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
admin: {},
|
||||
idResponsable: null,
|
||||
correo: '',
|
||||
nombre: '',
|
||||
programas: [],
|
||||
programa: {},
|
||||
programaSeleccionado: '',
|
||||
token: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getLocalhostInfo() {
|
||||
this.admin.idUsuario = localStorage.getItem('idUsuario')
|
||||
this.admin.idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
|
||||
this.admin.tipoUsuario = localStorage.getItem('tipoUsuario')
|
||||
this.token = {
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
}
|
||||
this.idResponsable = localStorage.getItem('idResponsable')
|
||||
this.correo = localStorage.getItem('correo')
|
||||
this.nombre = localStorage.getItem('nombreResponsable')
|
||||
},
|
||||
obtenerProgramas() {
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/programa/programas_admin?idUsuario=${this.idResponsable}`,
|
||||
this.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.programas = res.data
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error(err.response.data.message)
|
||||
})
|
||||
},
|
||||
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('/')
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
programaSeleccionado() {
|
||||
this.programa = this.programas[this.programaSeleccionado]
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getLocalhostInfo()
|
||||
if (this.admin.idTipoUsuario === 1) {
|
||||
this.obtenerProgramas()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -44,6 +44,7 @@
|
||||
:per-page="perPage"
|
||||
:selected.sync="responsableSeleccionado"
|
||||
:loading="isLoading"
|
||||
:row-class="(row, index) => 'pointer'"
|
||||
@page-change="onPageChange"
|
||||
hoverable
|
||||
striped
|
||||
@@ -164,6 +165,11 @@ export default {
|
||||
'idResponsable',
|
||||
this.responsableSeleccionado.idUsuario
|
||||
)
|
||||
localStorage.setItem('correo', this.responsableSeleccionado.usuario)
|
||||
localStorage.setItem(
|
||||
'nombreResponsable',
|
||||
this.responsableSeleccionado.nombre
|
||||
)
|
||||
this.$router.push(`/admin/responsables/infoResponsable`)
|
||||
},
|
||||
},
|
||||
@@ -196,7 +202,7 @@ export default {
|
||||
border-color: #1b3d70;
|
||||
}
|
||||
|
||||
.pinter {
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user