diff --git a/package-lock.json b/package-lock.json index 36b4dfe..8d0e0d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1786,6 +1786,16 @@ "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", "dev": true }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "optional": true, + "requires": { + "color-convert": "^2.0.1" + } + }, "cacache": { "version": "13.0.1", "resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz", @@ -1812,6 +1822,34 @@ "unique-filename": "^1.1.1" } }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "optional": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "optional": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "optional": true + }, "find-cache-dir": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", @@ -1833,6 +1871,25 @@ "path-exists": "^4.0.0" } }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "optional": true + }, + "loader-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", + "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", + "dev": true, + "optional": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -1897,6 +1954,16 @@ "minipass": "^3.1.1" } }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "optional": true, + "requires": { + "has-flag": "^4.0.0" + } + }, "terser-webpack-plugin": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz", @@ -1913,6 +1980,18 @@ "terser": "^4.6.12", "webpack-sources": "^1.4.3" } + }, + "vue-loader-v16": { + "version": "npm:vue-loader@16.0.0-rc.1", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-rc.1.tgz", + "integrity": "sha512-yR+BS90EOXTNieasf8ce9J3TFCpm2DGqoqdbtiwQ33hon3FyIznLX7sKavAq1VmfBnOeV6It0Htg4aniv8ph1g==", + "dev": true, + "optional": true, + "requires": { + "chalk": "^4.1.0", + "hash-sum": "^2.0.0", + "loader-utils": "^2.0.0" + } } } }, @@ -11331,87 +11410,6 @@ } } }, - "vue-loader-v16": { - "version": "npm:vue-loader@16.0.0-beta.9", - "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-beta.9.tgz", - "integrity": "sha512-mu9pg6554GbXDSO8LlxkQM6qUJzUkb/A0FJc9LgRqnU9MCnhzEXwCt1Zx5NObvFpzs2mH2dH/uUCDwL8Qaz9sA==", - "dev": true, - "optional": true, - "requires": { - "chalk": "^4.1.0", - "hash-sum": "^2.0.0", - "loader-utils": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "optional": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "optional": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "optional": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "optional": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "optional": true - }, - "loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", - "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", - "dev": true, - "optional": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "optional": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, "vue-router": { "version": "3.4.5", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.5.tgz", diff --git a/src/views/User.vue b/src/views/User.vue index bfc8814..33a06c8 100644 --- a/src/views/User.vue +++ b/src/views/User.vue @@ -16,7 +16,7 @@ Ver impresoras Ver computadoras -
Se observan {{ contador }} registros
+
Se observan {{ datosmios.length }} registros de un total de {{ respuesta.length }}
@@ -35,17 +35,28 @@
-
+
+ +
+ +
+
- +
@@ -148,8 +159,7 @@ + > {{ item.noInventario }} {{ item.tipo }} @@ -268,7 +278,6 @@ export default { seleccionadoProcesador: String, seleccionadoOS: String, miNoInventario: String, - contador: 10, file: null } }, @@ -287,13 +296,13 @@ export default { this.seleccionadoOS = "Todos"; this.miNoInventario = ""; this.contador = 0; - this.generaMisDatos(); }, methods: { async getComputers() { this.loading = true; this.respuesta = []; + this.datosmios = []; const localToken = window.localStorage.token; axios.get(`${ config.api }/api/computers`, { headers: { @@ -310,10 +319,26 @@ export default { this.$bvModal.show('session'); } }); + axios.get(`${ config.api }/api/computers`, { + headers: { + token: localToken + } + }) + .then(res => { + this.datosmios = res.data.equipo; + this.loading = false; + }) + .catch((error) => { + if(error.response.status === 409) { + localStorage.clear(); + this.$bvModal.show('session'); + } + }); }, async getPrinters() { this.loading = true; this.respuesta = []; + this.datosmios = []; const localToken = window.localStorage.token; axios.get(`${ config.api }/api/printers`, { headers: { @@ -331,6 +356,22 @@ export default { this.$bvModal.show('session'); } }); + axios.get(`${ config.api }/api/printers`, { + headers: { + token: localToken + } + }) + .then(res => { + this.datosmios = res.data.printers; + this.loading = false; + }) + .catch(error => { + console.log(error.response); + if(error.response.status === 409) { + localStorage.clear(); + this.$bvModal.show('session'); + } + }); }, watchRow(noInventario) { localStorage.setItem('noInventario', noInventario); @@ -386,7 +427,7 @@ export default { token: localToken } }) - .then(res => this.sisoper = res.data.procesador) + .then(res => this.procesa = res.data.procesador) .catch(err => console.log(err)); }, async traetipoImpresora(){ @@ -412,17 +453,6 @@ export default { this.traetipoImpresora(); this.traeUso(); this.traeUbica(); - this.seleccionado = "Todos"; - this.seleccionadoUbica = "Todos"; - this.seleccionadoUso = "Todos"; - this.seleccionadoProcesador = "Todos"; - this.seleccionadoOS = "Todos"; - this.miNoInventario = ""; - this.tipo=[' ']; - this.Ubica=[' ']; - this.uso=[' ']; - this.procesa=[' ']; - this.os=['']; } else{ this.pcView = !this.pcView; @@ -432,13 +462,18 @@ export default { this.traeUso(); this.traeProcesador(); this.traeOS(); - this.seleccionado = "Todos"; - this.seleccionadoUbica = "Todos"; - this.seleccionadoUso = "Todos"; - this.seleccionadoProcesador = "Todos"; - this.seleccionadoOS = "Todos" - this.miNoInventario = ""; } + this.seleccionado = "Todos"; + this.seleccionadoUbica = "Todos"; + this.seleccionadoUso = "Todos"; + this.seleccionadoProcesador = "Todos"; + this.seleccionadoOS = "Todos"; + this.miNoInventario = ""; + this.tipo=['']; + this.Ubica=['']; + this.uso=['']; + this.procesa=['']; + this.os=['']; this.generaMisDatos(); }, admin() { @@ -453,18 +488,20 @@ export default { && (this.seleccionadoUso == this.respuesta[i].uso || this.seleccionadoUso == 'Todos') && (this.seleccionadoOS == this.respuesta[i].osname || this.seleccionadoOS == 'Todos') && (this.seleccionadoProcesador == this.respuesta[i].procesador || this.seleccionadoProcesador == 'Todos') - && (this.respuesta[i].noInventario.indexOf(this.miNoInventario) != -1)){ + && ((this.respuesta[i].noInventario.indexOf(this.miNoInventario) != -1) || (this.respuesta[i].noSerie.indexOf(this.miNoInventario) != -1))){ this.datosmios[j++] = this.respuesta[i]; } } } else { for (let i = 0, j = 0; i < this.respuesta.length; i++){ - if (this.seleccionado == "Todos" || this.seleccionado == this.respuesta[i].tipo){ + if ((this.seleccionado == "Todos" || this.seleccionado == this.respuesta[i].tipo) + && (this.seleccionadoUbica == this.respuesta[i].ubicacion || this.seleccionadoUbica == 'Todos') + && (this.seleccionadoUso == this.respuesta[i].uso || this.seleccionadoUso == 'Todos') + && ((this.respuesta[i].noInventario.indexOf(this.miNoInventario) != -1) || (this.respuesta[i].noSerie.indexOf(this.miNoInventario) != -1))){ this.datosmios[j++] = this.respuesta[i]; } } } - this.contador = this.datosmios.length; }, onDescarga(datos){ var miDato;