/api/computers and /api/printers added.

This commit is contained in:
alfredojl
2020-09-14 18:31:39 -05:00
parent 1c5769016d
commit 379e6f9f85
2 changed files with 47 additions and 57 deletions
+5 -3
View File
@@ -24,7 +24,7 @@
<div
class="header-f"
v-if="!['login', 'start'].includes($route.name)"
v-if="!['login'].includes($route.name)"
>
<div class="container d-flex justify-content-between py-1">
@@ -35,8 +35,10 @@
<div v-if="isAdmin()">
<!-- <router-link to="login" class="text-white align-middle">Añadir equipo</router-link> -->
<b-dropdown id="dropdown-left" text="Añadir " variant="info" class="m-2">
<b-dropdown-item> <router-link to="addEquip" class="text-decoration-none text-body"> Computadora </router-link></b-dropdown-item>
<b-dropdown-item> <router-link to="addPrinter" class="text-decoration-none text-body"> Impresora </router-link></b-dropdown-item>
<b-dropdown-item >Equipo
<!-- <b-dropdown id="dropdown-dropright" class="text-decoration-none text-body m-2" dropright text="Equipo" variant="info"></b-dropdown> -->
</b-dropdown-item>
<b-dropdown id="dropdown-dropright" class="text-decoration-none text-body m-2 active" dropright text="Impresora" variant="info"></b-dropdown>
</b-dropdown>
</div>
</div>
+42 -54
View File
@@ -31,25 +31,25 @@
<th v-for="pcHead in pcHeads" class="sticky-top">{{ pcHead }}</th>
</tr>
</thead>
<tbody class="overflow-auto thov" v-for="item in inventory">
<tbody class="overflow-auto thov" v-for="item in respuesta">
<tr @click="watchRow()">
<td>{{ item.noInventario }}</td>
<td>{{ item.tipo }}</td>
<td>{{ item.activoFijo }}</td>
<td>{{ item.modelo }}</td>
<td>{{ item.marca }}</td>
<td>{{ item.serie }}</td>
<td>{{ item.noSerie }}</td>
<td>{{ item.procesador }}</td>
<td>{{ item.rom }}</td>
<td>{{ item.ram }}</td>
<td>{{ item.tipoM }}</td>
<td>{{ item.speed }}</td>
<td>{{ item.hdd }}</td>
<td>{{ item.memoriasz }}</td>
<td>{{ item.memoria }}</td>
<td>{{ item.vMemoria }}</td>
<td>{{ item.graficos }}</td>
<td>{{ item.so }}</td>
<td>{{ item.unidad }}</td>
<td>{{ item.osname }}</td>
<td>{{ item.uResponsable }}</td>
<td>{{ item.ubicacion }}</td>
<td>{{ item.responsable }}</td>
<td>{{ item.nombreResponsable }}</td>
<td>{{ item.uso }}</td>
<td>{{ item.resguardo }}</td>
<td>{{ item.noResguardo }}</td>
</tr>
</tbody>
@@ -64,20 +64,21 @@
<th v-for="printerHead in printerHeads" class="sticky-top">{{ printerHead }}</th>
</tr>
</thead>
<tbody v-for="item in inventory">
<tbody v-for="item in respuesta">
<tr @click="watchRow()">
<td>{{ item.noInventario }}</td>
<td class="text-primary">{{ item.noInventario }}</td>
<td>{{ item.tipo }}</td>
<td>{{ item.modelo }}</td>
<td>{{ item.marca }}</td>
<td>{{ item.serie }}</td>
<td>{{ item.descAdicional }}</td>
<td>{{ item.noSerie }}</td>
<td>{{ item.descripcion }}</td>
</tr>
</tbody>
</table>
</div>
<button class="btn btn-lg btn-success mt-3">Descargar</button>
</div>
@@ -111,12 +112,13 @@
</template>
<script>
import axios from 'axios';
import config from '../config/config';
export default {
data() {
return {
pcView: true,
alternativeView: 'Ver impresoras',
inventory: [],
pcHeads: [
"Inventario",
"Tipo",
@@ -124,10 +126,10 @@ export default {
"Marca",
"Serie",
"Procesador",
"ROM",
"RAM",
"ROM (GB)",
"RAM (MB)",
"Tipo de memoria",
"Velocidad de memoria",
"Velocidad de memoria (MHz)",
"Gráficos",
"Sistema operativo",
"Unidad responsable",
@@ -143,49 +145,35 @@ export default {
"Marca",
"Serie",
"Descripción adicional"
]
],
respuesta: [],
}
},
created() {
this.fillInventory();
this.getComputers();
},
methods: {
async fillInventory() {
for(let i = 0; i < 20; i++){
this.inventory [i] = {
"noInventario": 2225491,
"tipo": "PC",
"modelo": "PLATINUM",
"marca": "ECOIN",
"serie": 20063502185,
"procesador": "Pentium",
"rom": 256,
"ram": 512,
"tipoM": "DDR2",
"speed": 1200,
"graficos": "Intel",
"so": "Windows 7",
"unidad": "ÁREA DE CURSOS DEL CENTRO DE DESARROLLO TECNOLOGICO",
"ubicacion": "Aula 5",
"responsable": "Lic. José Alfredo Jiménez Lima",
"uso": "Alumno",
"resguardo": 5848
async getComputers() {
const localToken = window.localStorage.token;
axios.get(`${ config.api }/api/computers`, {
headers: {
token: localToken
}
}
})
.then(res => (this.respuesta = res.data.equipo))
.catch(err => console.log(err));
},
async fillPrinters() {
for (let i = 0; i < 20; i++) {
this.inventory [i] = {
"noInventario": 2225492,
"tipo": "Láser",
"modelo": "HP Printer",
"marca": "HP",
"serie": "HQS32364",
"descAdicional": ""
async getPrinters() {
const localToken = window.localStorage.token;
axios.get(`${ config.api }/api/printers`, {
headers: {
token: localToken
}
}
})
.then(res => this.respuesta = res.data.printers)
.catch(err => console.log(err));
},
watchRow() {
if(JSON.parse(window.localStorage.isAdmin))
@@ -194,11 +182,11 @@ export default {
changeView() {
if (this.pcView) {
this.pcView = !this.pcView;
this.fillPrinters();
this.getPrinters();
}
else{
this.pcView = !this.pcView;
this.fillInventory();
this.getComputers();
}
},