agregar a pruebas

This commit is contained in:
2021-01-25 22:22:35 -06:00
parent ca7550bf79
commit c32cd5532b
12 changed files with 428 additions and 120 deletions
+71 -12
View File
@@ -1,32 +1,45 @@
<template>
<b-modal id="actualizarCampo" centered size="lg" hide-footer title="Actualizar Campo">
<b-modal id="actualizarCampo" centered size="lg" hide-footer title="Actualizar Campo" style="height: auto;">
<b-container fluid>
<b-row class="my-1">
<b-col >
<h1>Actualizar {{campo}}</h1>
<h2 style="text-align: center; margin-bottom: 1.5rem;"> {{campo}}</h2>
</b-col>
</b-row>
<b-row>
<b-row style="margin-bottom: 1rem;">
<b-col sm="3">
<h4>Actual: </h4>
</b-col>
<b-col sm="9">
<h4><strong>{{campo}}</strong></h4>
<h4><strong>{{pcSelected.value}}</strong></h4>
</b-col>
</b-row>
<b-row>
<b-row style="margin-bottom: 1rem;">
<b-col sm="3">
<label for="changeValue">Actualizar: </label>
<label style=" padding-top:1rem;">Actualizar: </label>
</b-col>
<b-col sm="9">
<b-form-input id="changeValue" placeholder="Actualizar campo"></b-form-input>
<div v-if="opciones.length!=0">
<b-dropdown
split
block
split-variant="outline-primary"
variant="primary"
v-bind:text="opcionSeleted != '' ? opcionSeleted.nombre : campo"
class="m-2"
style="margin: 0"
>
<b-dropdown-item v-for="(opcion,index) in opciones" v-bind:key="index" @click="opcionSeleted=opcion">{{opcion.nombre}}</b-dropdown-item>
</b-dropdown>
</div>
<b-form-input v-else class="m-2" placeholder="Actualizar campo" style="margin: 0"></b-form-input>
</b-col>
</b-row>
<b-row>
<b-col>
<div style="margin-top: 2rem;">
<b-button class="btn btn-outline-success float-right" @click="enviarFicha()" style="width: 30%; ">Enviar</b-button>
<b-button @click="$bvModal.hide('fichaDeposito')" variant="outline-danger" class="btn float-left" style="width: 30%; ">Cancelar</b-button>
<b-button variant="outline-success" class="float-right" style="width: 30%; " @click="actualizarLibro()">Actualizar</b-button>
<b-button @click="$bvModal.hide('actualizarCampo')" variant="outline-danger" class="btn float-left" style="width: 30%; ">Cancelar</b-button>
</div>
</b-col>
</b-row>
@@ -34,10 +47,56 @@
</b-modal>
</template>
<script>
import Swal from 'sweetalert2';
export default {
props: {
campo: String,
value: String
}
campo: String,
pcSelected: Object,
opciones: Array,
objectPc: Object,
opcionSeletedTable: Object
},
data() {
return {
opcionSeleted: this.opcionSeletedTable.value,
campoValue:''
}
},
methods:{
async actualizarLibro(){
try{
if(this.opcionSeleted === "" && this.campoValue === ""){
await Swal.fire(
'¿Aún no has llenado el campo a editar?',
'',
'question'
);
return;
}
if( this.pcSelected.keyTable !== 'noInventario' && this.pcSelected.keyTable !== 'noResguardo' && this.pcSelected.keyTable !== 'idUnidadResponsable'){
let valueCampo = '';
if(this.opciones.length!=0){
valueCampo = this.opcionSeleted.nombre;
}
else{
valueCampo = this.campoValue;
}
const data ={
keyTable : this.pcSelected.keyTable,
idEquipo : this.objectPc.idEquipo,
value: valueCampo
}
console.log(data);
}
}
catch(error){
console.log(error);
}
}
}
}
</script>
+3
View File
@@ -47,6 +47,9 @@
</div>
</div>
</li>
<li class="nav-item">
<router-link to="/agregarCatalogo"><a class="nav-link text-white">Agregar al catalogo</a></router-link>
</li>
<li>
<div class="d-flex align-items-center mx-4">
<i class='fas fa-user-alt' style='font-size:24px;color:white;margin-right:10px'></i>
+37 -18
View File
@@ -6,32 +6,47 @@
<table class="table">
<thead>
<tr>
<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}}
<th >
<div class="flex-container">
<button style="align-self: center" class="btn nav-link " type="button" aria-haspopup="true" aria-expanded="false">
Eliminar
</button>
<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>
</th>
<th v-for="(item,indexHeader) in pcHeaders" v-bind:key="indexHeader" scope="col" >
<div class="flex-container">
<div >
<button style="align-self: center" v-if="item.data.length != 0" class="btn nav-link dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{item.nombre}}
</button>
<button style="align-self: center; width: 14rem;" v-else class="btn nav-link " type="button" aria-haspopup="true" aria-expanded="false">
{{item.nombre}}
</button>
<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>
</div>
</th>
</tr>
</thead>
<tbody>
<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>
<b-button variant="outline-danger">Eliminar</b-button>
</td>
<td v-for="(pcCampo,key) in pc.datos" v-bind:key="key" v-b-modal.actualizarCampo @click="pcSelected=pc.objectPc ,valueCampo=pcCampo , campo = pcHeaders[key].nombre, opciones = pcHeaders[key].data, opcionSeletedTable = {pcCampo, value:''}" >
{{pcCampo.value}}
</td>
</tr>
<Modal v-bind:campo="campo" v-bind:pcSelected="valueCampo" v-bind:opciones="opciones" v-bind:objectPc="pcSelected" v-bind:opcionSeletedTable="opcionSeletedTable" />
</tbody>
</table>
</div>
</div>
<Modal v-bind:campo="campo" v-bind:value="valueCampo" />
</div>
</template>
@@ -50,9 +65,13 @@ export default {
data() {
return {
campo:"",
valueCampo:"",
valueCampo:{value:''},
pcHeaders: {},
pcData: [],
tableName: "",
opciones: [],
pcSelected: null,
opcionSeletedTable: {value: ''}
}
},
methods: {
@@ -62,7 +81,7 @@ export default {
if(typeof pc.headers[key] !== 'undefined' && typeof pc.datos[key] !== 'undefined' && pc.datos[key] === dato)
pc.headers[key] = !pc.headers[key];
}
}
},
},
async created() {
try {
@@ -93,9 +112,9 @@ export default {
}
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) ;
let searchInventario = (item.datos.numeroInventario.value).includes(this.campoBuscar) ;
let searchResguardo = (item.datos.numeroResguardo.value).includes(this.campoBuscar) ;
let searchSerie = (item.datos.serie.value).includes(this.campoBuscar) ;
if(searchInventario || searchResguardo || searchSerie)
return true;
return false;