pos err
This commit is contained in:
+103
-8
@@ -1,5 +1,15 @@
|
||||
<template>
|
||||
<div class="container mt-5">
|
||||
<b-overlay :show="page"
|
||||
variant="transparent"
|
||||
opacity="1"
|
||||
blur="5px"
|
||||
no-wrap
|
||||
spinner-variant="primary"
|
||||
rounded="lg"
|
||||
>
|
||||
</b-overlay>
|
||||
|
||||
<b-modal id="session" ref="" hide-footer hide-header>
|
||||
<div class="d-block text-center">
|
||||
<h3>La sesión ha caducado</h3>
|
||||
@@ -13,6 +23,34 @@
|
||||
<div v-else class="d-flex flex-column">
|
||||
<h1 class="text-center">Agregar equipo</h1>
|
||||
|
||||
<h4 class="text-left container-fluid mt-4 pt-2 px-0">
|
||||
Añadir equipos desde archivo excel
|
||||
</h4>
|
||||
<div
|
||||
class="d-flex justify-content-start input-group mb-3"
|
||||
>
|
||||
<b-input-group-append class="py-2 sel-form-add">
|
||||
|
||||
<b-form-file
|
||||
v-model="file"
|
||||
placeholder="Seleccione un excel a cargar..."
|
||||
drop-placeholder="Drop file here..."
|
||||
browse-text="Seleccionar"
|
||||
>
|
||||
</b-form-file>
|
||||
<div class="input-group-append">
|
||||
<button
|
||||
class="btn btn-outline-secondary"
|
||||
type="button"
|
||||
id="inputGroupFileAddon04"
|
||||
v-on:click="cargaMasiva"
|
||||
>
|
||||
Subir
|
||||
</button>
|
||||
</div>
|
||||
</b-input-group-append>
|
||||
</div>
|
||||
|
||||
<h3 class="text-left mt-4">Datos generales:</h3>
|
||||
|
||||
<form
|
||||
@@ -33,13 +71,6 @@
|
||||
placeholder="Número de resguardo:"
|
||||
/>
|
||||
|
||||
<!-- <input
|
||||
v-model="equipo.nombreResponsable"
|
||||
type="text"
|
||||
class="pb-2 my-4"
|
||||
placeholder="Nombre del responsable:"
|
||||
/> -->
|
||||
|
||||
<b-select class="py-2 my-4 sel-form-add"
|
||||
v-model="equipo.idUnidadResponsable"
|
||||
:options="respuesta.unidades"
|
||||
@@ -221,6 +252,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
loading: null,
|
||||
file: null,
|
||||
page: false,
|
||||
equipo: {
|
||||
noInventario: null,
|
||||
noResguardo: null,
|
||||
@@ -308,7 +341,66 @@ export default {
|
||||
this.$bvModal.show('session');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// previewFile(event) {
|
||||
// this.file = event.target.files[0]
|
||||
// // eslint-disable-next-line
|
||||
// this.$refs.file.innerText = this.file.name
|
||||
// },
|
||||
cargaMasiva() {
|
||||
if(!this.file)
|
||||
return Swal.fire({
|
||||
title: 'Primero seleccione un archivo.',
|
||||
icon: 'warning',
|
||||
confirmButtonText: 'Aceptar',
|
||||
});
|
||||
|
||||
Swal.fire({
|
||||
title: '¿Está seguro de querer subir nuevos equipos?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Aceptar',
|
||||
cancelButtonText: 'Cancelar',
|
||||
}).then(result => {
|
||||
if (result.value) {
|
||||
this.page = true;
|
||||
let formData = new FormData()
|
||||
formData.append('equipos', this.file)
|
||||
axios
|
||||
.post(`${config.api}/upload/equips`, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
token: window.localStorage.getItem('token'),
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.page = false;
|
||||
Swal.fire({
|
||||
title:
|
||||
'Se cargaron los equipos correctamente',
|
||||
icon: 'success',
|
||||
confirmButtonText: 'Aceptar',
|
||||
})
|
||||
// eslint-disable-next-line
|
||||
})
|
||||
.catch(error => {
|
||||
this.page = false;
|
||||
if (error.response) {
|
||||
if(error.response.status === 500)
|
||||
Swal.fire({
|
||||
title: 'Hubo un error al subir los equipos',
|
||||
icon: 'warning',
|
||||
confirmButtonText: 'Aceptar',
|
||||
})
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -333,6 +425,9 @@ select {
|
||||
border: none;
|
||||
background-size: 12px !important;
|
||||
}
|
||||
.custom-file-input:lang(es) ~ .custom-file-label::after {
|
||||
content: 'Buscar';
|
||||
}
|
||||
|
||||
.form-add-user input[type='text'],
|
||||
.form-add-user input[type='email'],
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
<template>
|
||||
<div class="container mt-5 justify-content-center">
|
||||
<b-overlay :show="page"
|
||||
variant="transparent"
|
||||
opacity="1"
|
||||
blur="5px"
|
||||
no-wrap
|
||||
spinner-variant="primary"
|
||||
rounded="lg"
|
||||
>
|
||||
</b-overlay>
|
||||
|
||||
<b-modal id="session" ref="" hide-footer hide-header>
|
||||
<div class="d-block text-center">
|
||||
<h3>La sesión ha caducado</h3>
|
||||
@@ -15,6 +25,34 @@
|
||||
|
||||
<h1 class="text-center">Agregar impresora</h1>
|
||||
|
||||
<h4 class="text-left container-fluid mt-4 pt-2 px-0">
|
||||
Añadir impresoras desde archivo excel
|
||||
</h4>
|
||||
<div
|
||||
class="d-flex justify-content-start input-group mb-3"
|
||||
>
|
||||
<b-input-group-append class="py-2 sel-form-add">
|
||||
|
||||
<b-form-file
|
||||
v-model="file"
|
||||
placeholder="Seleccione un excel a cargar..."
|
||||
drop-placeholder="Drop file here..."
|
||||
browse-text="Seleccionar"
|
||||
>
|
||||
</b-form-file>
|
||||
<div class="input-group-append">
|
||||
<button
|
||||
class="btn btn-outline-secondary"
|
||||
type="button"
|
||||
id="inputGroupFileAddon04"
|
||||
v-on:click="cargaMasiva"
|
||||
>
|
||||
Subir
|
||||
</button>
|
||||
</div>
|
||||
</b-input-group-append>
|
||||
</div>
|
||||
|
||||
<h3 class="text-left mt-4">Datos generales:</h3>
|
||||
|
||||
<form
|
||||
@@ -183,6 +221,8 @@ import config from '../config/config';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
page: false,
|
||||
file: null,
|
||||
loading: true,
|
||||
printer: {
|
||||
noInventario: null,
|
||||
@@ -264,7 +304,60 @@ export default {
|
||||
this.$bvModal.show('session');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
cargaMasiva() {
|
||||
if(!this.file)
|
||||
return Swal.fire({
|
||||
title: 'Primero seleccione un archivo.',
|
||||
icon: 'warning',
|
||||
confirmButtonText: 'Aceptar',
|
||||
});
|
||||
|
||||
Swal.fire({
|
||||
title: '¿Está seguro de querer subir nuevas impresoras?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Aceptar',
|
||||
cancelButtonText: 'Cancelar',
|
||||
}).then(result => {
|
||||
if (result.value) {
|
||||
this.page = true;
|
||||
let formData = new FormData()
|
||||
formData.append('printers', this.file)
|
||||
axios
|
||||
.post(`${config.api}/upload/printers`, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
token: window.localStorage.getItem('token'),
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.page = false;
|
||||
Swal.fire({
|
||||
title:
|
||||
'Se cargaron los equipos correctamente',
|
||||
icon: 'success',
|
||||
confirmButtonText: 'Aceptar',
|
||||
})
|
||||
// eslint-disable-next-line
|
||||
})
|
||||
.catch(error => {
|
||||
this.page = false;
|
||||
if (error.response) {
|
||||
if(error.response.status === 500)
|
||||
Swal.fire({
|
||||
title: 'Hubo un error al subir las impresoras',
|
||||
icon: 'warning',
|
||||
confirmButtonText: 'Aceptar',
|
||||
})
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -313,6 +406,11 @@ select {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.custom-file-input:lang(es) ~ .custom-file-label::after {
|
||||
content: 'Buscar';
|
||||
}
|
||||
|
||||
.separador {
|
||||
width: 100%;
|
||||
background: #2e5795;
|
||||
|
||||
+23
-45
@@ -64,17 +64,18 @@
|
||||
<td>{{ item.marca }}</td>
|
||||
<td>{{ item.noSerie }}</td>
|
||||
<td>{{ item.procesador }}</td>
|
||||
<td>{{ item.vProcesador }}</td>
|
||||
<td>{{ item.hdd }}</td>
|
||||
<td>{{ item.memoriasz }}</td>
|
||||
<td>{{ item.memoria }}</td>
|
||||
<td>{{ item.vMemoria }}</td>
|
||||
<td>{{ item.graficos }}</td>
|
||||
<td>{{ item.osname }}</td>
|
||||
<td>{{ item.uResponsable }}</td>
|
||||
<td>{{ item.ubicacion }}</td>
|
||||
<td>{{ item.nombreResponsable }}</td>
|
||||
<td>{{ item.uso }}</td>
|
||||
<td>{{ item.noResguardo }}</td>
|
||||
<td>{{ item.uResponsable }}</td>
|
||||
<td>{{ item.nombreResponsable }}</td>
|
||||
<td>{{ item.ubicacion }}</td>
|
||||
<td>{{ item.uso }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -103,6 +104,11 @@
|
||||
<td>{{ item.marca }}</td>
|
||||
<td>{{ item.noSerie }}</td>
|
||||
<td>{{ item.descripcion }}</td>
|
||||
<td>{{ item.noResguardo }}</td>
|
||||
<td>{{ item.uResponsable }}</td>
|
||||
<td>{{ item.nombreResponsable }}</td>
|
||||
<td>{{ item.ubicacion }}</td>
|
||||
<td>{{ item.uso }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -111,41 +117,6 @@
|
||||
<b-spinner variant="primary" label="Spinning" v-if="loading"></b-spinner>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="text-left container-fluid mt-4">
|
||||
Carga masiva de equipos
|
||||
</h4>
|
||||
<div
|
||||
class="d-flex justify-content-start input-group mb-3"
|
||||
>
|
||||
<div class="custom-file">
|
||||
<input
|
||||
type="file"
|
||||
class="custom-file-input thob"
|
||||
id="inputGroupFile04"
|
||||
aria-describedby="inputGroupFileAddon04"
|
||||
@change="previewFile"
|
||||
accept=".csv"
|
||||
/>
|
||||
<label
|
||||
class="custom-file-label"
|
||||
ref="file"
|
||||
for="inputGroupFile04"
|
||||
>
|
||||
Selecciona el archivo
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<button
|
||||
class="btn btn-outline-secondary"
|
||||
type="button"
|
||||
id="inputGroupFileAddon04"
|
||||
v-on:click=""
|
||||
>
|
||||
Subir
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
v-on:click="onDescarga(respuesta)"
|
||||
@@ -204,17 +175,18 @@ export default {
|
||||
"Marca",
|
||||
"Serie",
|
||||
"Procesador",
|
||||
"Velocidad de procesador (MHz)",
|
||||
"ROM (GB)",
|
||||
"RAM (MB)",
|
||||
"Tipo de memoria",
|
||||
"Velocidad de memoria (MHz)",
|
||||
"Gráficos",
|
||||
"Sistema operativo",
|
||||
"Resguardo",
|
||||
"Unidad responsable",
|
||||
"Ubicación",
|
||||
"Responsable",
|
||||
"Uso",
|
||||
"Resguardo"
|
||||
"Ubicación",
|
||||
"Uso"
|
||||
],
|
||||
printerHeads: [
|
||||
"Inventario",
|
||||
@@ -222,13 +194,19 @@ export default {
|
||||
"Modelo",
|
||||
"Marca",
|
||||
"Serie",
|
||||
"Descripción adicional"
|
||||
"Descripción adicional",
|
||||
"Resguardo",
|
||||
"Unidad Responsable",
|
||||
"Responsable",
|
||||
"Ubicacion",
|
||||
"Uso",
|
||||
],
|
||||
respuesta: [],
|
||||
datosmios: [],
|
||||
tipo: [],
|
||||
seleccionado: String,
|
||||
miNoInventario: String,
|
||||
file: null
|
||||
}
|
||||
},
|
||||
|
||||
@@ -274,6 +252,7 @@ export default {
|
||||
this.loading = false;
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.response);
|
||||
if(error.response.status === 409) {
|
||||
localStorage.clear();
|
||||
this.$bvModal.show('session');
|
||||
@@ -316,7 +295,6 @@ export default {
|
||||
|
||||
},
|
||||
admin() {
|
||||
// return !!window.localStorage.isAdmin;
|
||||
return JSON.parse(window.localStorage.isAdmin);
|
||||
},
|
||||
onDescarga(datos){
|
||||
@@ -338,10 +316,10 @@ export default {
|
||||
}
|
||||
MiXLSX.utils.sheet_add_json(miDato,this.datosmios,{
|
||||
skipHeader:true, origin : "A2"});
|
||||
let miDato = MiXLSX.utils.json_to_sheet(datos);
|
||||
const LibroTrabajo = MiXLSX.utils.book_new();
|
||||
MiXLSX.utils.book_append_sheet(LibroTrabajo, miDato, "SalidaFalsa");
|
||||
MiXLSX.writeFile(LibroTrabajo, "SalidaFalsa.xlsx");
|
||||
console.log("Terminado");
|
||||
return JSON.parse(localStorage.isAdmin);
|
||||
},
|
||||
previewFile(event) {
|
||||
|
||||
Reference in New Issue
Block a user