From aa1061a63355dc08246af8832f313eb255dba48d Mon Sep 17 00:00:00 2001 From: caballero Date: Sat, 26 Sep 2020 13:30:05 -0500 Subject: [PATCH] Ya guarda un nombre de archivo diferente --- src/views/User.vue | 48 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/src/views/User.vue b/src/views/User.vue index 48e9ee7..bafa712 100644 --- a/src/views/User.vue +++ b/src/views/User.vue @@ -29,7 +29,7 @@ @change="buscaValor()" class="form-control select-login-form shadow-none" > - + @@ -47,7 +47,7 @@ {{ item.noInventario }} {{ item.activoFijo }} @@ -82,7 +82,7 @@ {{ item.noInventario }} {{ item.tipo }} @@ -181,7 +181,7 @@ export default { created() { this.getComputers(); this.traetipo(); - this.seleccionado = "0"; + this.seleccionado = "Todos"; this.miNoInventario = ""; }, @@ -239,7 +239,7 @@ export default { this.pcView = !this.pcView; this.getPrinters(); this.traetipoImpresora(); - this.seleccionado = "0"; + this.seleccionado = "Todos"; this.miNoInventario = ""; this.tipo=[' ']; } @@ -247,7 +247,7 @@ export default { this.pcView = !this.pcView; this.getComputers(); this.traetipo(); - this.seleccionado = "0"; + this.seleccionado = "Todos"; this.miNoInventario = ""; } @@ -256,8 +256,36 @@ export default { return JSON.parse(window.localStorage.isAdmin); }, onDescarga(datos){ - console.log("Descargar"); - + const fecha = new Date(); + const anyo = fecha.getFullYear(); + const mes = fecha.getMonth(); + const dia = fecha.getDate(); + const hora = fecha.getHours(); + const min = fecha.getMinutes(); + const seg = fecha.getSeconds(); + var nomArch = this.seleccionado; + if (dia > 0 && dia < 10){ + nomArch += "0"; + } + nomArch += dia; + if (mes > 0 && mes < 10){ + nomArch += "0"; + } + nomArch += mes; + nomArch += anyo; + if (hora >= 0 && hora < 10){ + nomArch += "0"; + } + nomArch += hora; + if (min >= 0 && min < 10){ + nomArch += "0"; + } + nomArch += min; + if (seg >= 0 && seg < 10){ + nomArch += "0"; + } + nomArch += seg; + console.log("Descargar " + nomArch); if (this.pcView){ for (let i = 0, j = 0; i < datos.length; i++){ if (this.seleccionado == "0" || this.seleccionado == datos[i].activoFijo){ @@ -276,8 +304,8 @@ export default { MiXLSX.utils.sheet_add_json(miDato,this.datosmios,{ skipHeader:true, origin : "A2"}); const LibroTrabajo = MiXLSX.utils.book_new(); - MiXLSX.utils.book_append_sheet(LibroTrabajo, miDato, "SalidaFalsa"); - MiXLSX.writeFile(LibroTrabajo, "SalidaFalsa.xlsx"); + MiXLSX.utils.book_append_sheet(LibroTrabajo, miDato, nomArch); + MiXLSX.writeFile(LibroTrabajo, nomArch + ".xlsx"); console.log("Terminado"); }, buscaValor(){