Ya guarda un nombre de archivo diferente

This commit is contained in:
2020-09-26 13:30:05 -05:00
parent ab8c0b4d84
commit aa1061a633
+38 -10
View File
@@ -29,7 +29,7 @@
@change="buscaValor()"
class="form-control select-login-form shadow-none"
>
<option value="0" selected>Todos</option>
<option value="Todos" selected>Todos</option>
<option v-if="pcView" v-for="opcion in tipo" :value='opcion.activoFijo'>{{opcion.activoFijo}}</option>
<option v-else v-for="opcion in tipoPrinters" :value='opcion.tipo'>{{opcion.tipo}}</option>
</select>
@@ -47,7 +47,7 @@
</thead>
<tbody class="overflow-auto thov" v-for="item in respuesta">
<tr @click="watchRow()"
v-if="(seleccionado == item.activoFijo || seleccionado == '0')
v-if="(seleccionado == item.activoFijo || seleccionado == 'Todos')
&& item.noInventario.indexOf(miNoInventario) != -1"> <!-- https://developer.mozilla.org/es/docs/Learn/JavaScript/First_steps/Useful_string_methods -->
<td>{{ item.noInventario }}</td>
<td>{{ item.activoFijo }}</td>
@@ -82,7 +82,7 @@
</thead>
<tbody v-for="item in respuesta">
<tr @click="watchRow()"
v-if="(seleccionado == item.tipo || seleccionado == '0')
v-if="(seleccionado == item.tipo || seleccionado == 'Todos')
&& item.noInventario.indexOf(miNoInventario) != -1"> <!-- https://developer.mozilla.org/es/docs/Learn/JavaScript/First_steps/Useful_string_methods -->
<td class="text-primary">{{ item.noInventario }}</td>
<td>{{ item.tipo }}</td>
@@ -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(){