diff --git a/src/views/User.vue b/src/views/User.vue index b280f92..f73a95b 100644 --- a/src/views/User.vue +++ b/src/views/User.vue @@ -35,8 +35,12 @@ @change="buscaValor()" class="form-control select-login-form shadow-none" > - - + + + + + @@ -54,9 +58,12 @@ {{ item.noInventario }} --> - + + + {{ item.noInventario }} {{ item.activoFijo }} @@ -96,8 +103,13 @@ - - + + + + {{ item.noInventario }} {{ item.tipo }} {{ item.modelo }} @@ -204,6 +216,7 @@ export default { respuesta: [], datosmios: [], tipo: [], + tipoPrinters: [], seleccionado: String, miNoInventario: String, file: null @@ -213,7 +226,7 @@ export default { created() { this.getComputers(); this.traetipo(); - this.seleccionado = "0"; + this.seleccionado = "Todos"; this.miNoInventario = ""; }, @@ -276,7 +289,19 @@ export default { }) .then(res => this.tipo = res.data.tipo) .catch(err => console.log(err)); - console.log("Termina Consulta"); + console.log("Termina Consulta" + this.tipo); + }, + async traetipoImpresora(){ + console.log("Inicia Consulta Impresoras"); + const localToken = window.localStorage.token; + axios.get(`${ config.api }/api/tipoPrinters`, { + headers: { + token: localToken + } + }) + .then(res => this.tipoPrinters = res.data.tipoPrinters) + .catch(err => console.log(err)); + console.log("Termina Consulta Impresoras " + this.tipoPrinters); }, // watchRow() { // if(JSON.parse(window.localStorage.isAdmin)) @@ -287,10 +312,17 @@ export default { if (this.pcView) { this.pcView = !this.pcView; this.getPrinters(); + this.traetipoImpresora(); + this.seleccionado = "Todos"; + this.miNoInventario = ""; + this.tipo=[' ']; } else{ this.pcView = !this.pcView; this.getComputers(); + this.traetipo(); + this.seleccionado = "Todos"; + this.miNoInventario = ""; } }, @@ -298,7 +330,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){ @@ -372,6 +433,9 @@ export default { }) } }) + MiXLSX.utils.book_append_sheet(LibroTrabajo, miDato, nomArch); + MiXLSX.writeFile(LibroTrabajo, nomArch + ".xlsx"); + console.log("Terminado"); }, buscaValor(){ this.seleccionado = document.getElementById("tipo").value;