admin listo

This commit is contained in:
2022-05-09 22:01:09 -05:00
parent 0efacc45e1
commit 61c48b04f3
+45 -10
View File
@@ -3,7 +3,7 @@
<div class="my-3 has-text-centered">
<p class="is-size-2">Reportes administrador</p>
</div>
<p class="is-size-4 my-3">Subir base de datos de los profesores:</p>
<p class="is-size-4 my-3">Subir base de datos de los profesores:</p>
<b-field>
<b-upload
accept=".csv"
@@ -35,6 +35,7 @@
Enviar archivo
</b-button>
</div>
<p class="is-size-4 my-3">Descargar base de datos invitados:</p>
<div class="has-text-centered">
<b-button class="is-info">
<JsonCSV
@@ -54,7 +55,7 @@
<script>
import JsonCSV from 'vue-json-csv'
import axios from 'axios'
import sweetalert2 from 'sweetalert2';
import sweetalert2 from 'sweetalert2'
export default {
components: {
@@ -71,20 +72,54 @@ export default {
confirmarEnviar() {
this.$swal({
title: '¿Estás seguro de querer enviar este archivo?',
type: "question",
type: 'question',
timer: 9000,
showCancelButton: true,
cancelButtonColor: "#d33",
confirmButtonText: "Aceptar",
confirmButtonColor: "#1e3c70",
}).then(res => {
if(res.value){
cancelButtonColor: '#d33',
confirmButtonText: 'Aceptar',
confirmButtonColor: '#1e3c70',
}).then((res) => {
if (res.value) {
this.enviar()
}
})
},
enviar(){
console.log("Se han enviado los datos")
enviar() {
const formData = new FormData()
this.isLoading = true
formData.append('file', this.csv)
axios
.post(`${process.env.api}/profesor/cargarDatos`, formData)
.then((res) => {
this.isLoading = false
this.csv = {}
this.successUpload()
}).catch(err => {
this.isLoading = false
this.csv = {}
console.log(err)
this.errorMessage()
})
},
successUpload() {
this.$swal({
title: 'Se ha subido el archivo con éxito.',
type: 'success',
timer: 5000,
confirmButtonText: 'Aceptar',
confirmButtonColor: '#1e3c70',
})
},
errorMessage(){
this.$swal({
title: 'Ha ocurrido un error al subir el archivo.',
type: 'error',
timer: 5000,
confirmButtonText: 'Aceptar',
confirmButtonColor: '#1e3c70',
})
},
isDataExport() {
if (this.dataExport.length > 0) return true