incio del proyecto
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h3 style="text-align: right; margin-bottom: 1rem;">Totales: {{pcTablesFiltrada.length}} </h3>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th v-for="item in pcHeaders" v-bind:key="item.nombre" scope="col">
|
||||
<th v-for="(item,indexHeader) in pcHeaders" v-bind:key="indexHeader" scope="col">
|
||||
|
||||
<div class="dropdown">
|
||||
<button class="btn nav-link dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{item.nombre}}
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<b-dropdown-form>
|
||||
<b-form-checkbox v-for="type in item.data" v-bind:key="type" scope="col"><a>{{type.nombre}}</a></b-form-checkbox>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton" style="padding:10px;">
|
||||
<b-dropdown-form >
|
||||
<div class="checkBox" v-for="(type,index) in item.data" v-bind:key="index" ><b-form-checkbox @change="filtrar(indexHeader, type.nombre)" v-model="type.value" ><a>{{type.nombre}}</a></b-form-checkbox></div>
|
||||
</b-dropdown-form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -20,8 +22,8 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="pc in pcData" v-bind:key="pc.index">
|
||||
<td v-for="(pcCampo,key) in pc" v-bind:key="pcCampo" v-b-modal.actualizarCampo @click="campo=pcCampo ,valueCampo = pcHeaders[key].nombre" >
|
||||
<tr v-for="(pc,index) in pcTablesFiltrada" v-bind:key="index">
|
||||
<td v-for="(pcCampo,key) in pc.datos" v-bind:key="key" v-b-modal.actualizarCampo @click="campo=pcCampo ,valueCampo = pcHeaders[key].nombre" >
|
||||
{{pcCampo}}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -34,60 +36,81 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import axios from "axios";
|
||||
import config from "../config/config.js";
|
||||
import Modal from './modalActualizar.vue'
|
||||
export default {
|
||||
name: "home",
|
||||
components: {
|
||||
Modal,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
campo:"",
|
||||
valueCampo:"",
|
||||
pcHeaders: {
|
||||
noInventario: {nombre: "Inventario", data: []},
|
||||
activoFijo: {nombre: "Tipo", data: [{nombre: "compu", value: true}, {nombre: "dos", value: true}]},
|
||||
modelo: {nombre: "Modelo", data: []},
|
||||
marca: {nombre: "Marca", data: []},
|
||||
noSerie: {nombre: "Serie", data: []},
|
||||
procesador: {nombre: "Procesador", data: []},
|
||||
vProcesador: {nombre: "Velocidad de procesador (MHz)", data: []},
|
||||
hdd: {nombre: "ROM (GB)", data: []},
|
||||
memoriasz: {nombre: "RAM (MB)", data: []},
|
||||
memoria: {nombre: "Tipo de memoria", data: []},
|
||||
vMemoria: {nombre: "Velocidad de memoria (MHz)", data: []},
|
||||
graficos:{nombre: "Gráficos", data: []},
|
||||
osname: {nombre: "Sistema operativo", data: []},
|
||||
noResguardo: {nombre: "Resguardo", data: []},
|
||||
uResponsable: {nombre: "Unidad responsable", data: []},
|
||||
nombreResponsable: {nombre: "Responsable", data: []},
|
||||
ubicacion: {nombre: "Ubicación", data: []},
|
||||
uso: {nombre: "Uso", data: []}
|
||||
},
|
||||
pcData: [
|
||||
{ noInventario: "Inventario",
|
||||
activoFijo: "Tipo",
|
||||
modelo: "Modelo",
|
||||
marca: "Marca",
|
||||
noSerie: "Serie",
|
||||
procesador: "Procesador",
|
||||
vProcesador: "Velocidad de procesador (MHz)",
|
||||
hdd: "ROM (GB)",
|
||||
memoriasz: "RAM (MB)",
|
||||
memoria: "Tipo de memoria",
|
||||
vMemoria: "Velocidad de memoria (MHz)",
|
||||
graficos: "Gráficos",
|
||||
osname: "Sistema operativo",
|
||||
noResguardo: "Resguardo",
|
||||
uResponsable: "Unidad responsable",
|
||||
nombreResponsable: "Responsable",
|
||||
ubicacion: "Ubicación",
|
||||
uso: "Uso" },
|
||||
],
|
||||
}
|
||||
props: {
|
||||
campoBuscar: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
campo:"",
|
||||
valueCampo:"",
|
||||
pcHeaders: {},
|
||||
pcData: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async filtrar(key, dato){
|
||||
for(let index in this.pcData){
|
||||
let pc = this.pcData[index];
|
||||
if(typeof pc.headers[key] !== 'undefined' && typeof pc.datos[key] !== 'undefined' && pc.datos[key] === dato)
|
||||
pc.headers[key] = !pc.headers[key];
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
try {
|
||||
let computadoras = await axios.get(`${config.api}/getHeadersComputadoras`);
|
||||
this.pcHeaders = computadoras.data.data;
|
||||
}
|
||||
catch(error){
|
||||
console.log(error);
|
||||
}
|
||||
try {
|
||||
let computadoras = await axios.get(`${config.api}/getComputadoras`);
|
||||
this.pcData = computadoras.data.data;
|
||||
}
|
||||
catch(error){
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
pcTablesFiltrada: function()
|
||||
{
|
||||
return this.pcData.filter( (item)=>{
|
||||
let header = true;
|
||||
for(let campo in item.headers){
|
||||
if(!item.headers[campo]){
|
||||
header = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!header)
|
||||
return false;
|
||||
let searchInventario = (item.datos.numeroInventario).includes(this.campoBuscar) ;
|
||||
let searchResguardo = (item.datos.numeroResguardo).includes(this.campoBuscar) ;
|
||||
let searchSerie = (item.datos.serie).includes(this.campoBuscar) ;
|
||||
if(searchInventario || searchResguardo || searchSerie)
|
||||
return true;
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
<style scoped>
|
||||
a{
|
||||
font-size: 14px;
|
||||
margin-bottom: 6px;
|
||||
font-weight: normal;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user