3 Commits

Author SHA1 Message Date
danielGe 5105553dea creacion de la descarga del excel 2021-02-03 20:55:45 -06:00
danielGe c63ecf3064 constuido para pruebas, cambio del deseño del tabla 2021-01-28 13:16:38 -06:00
danielGe d72e18d95a agregar catalogos 2021-01-27 22:59:00 -06:00
17 changed files with 12600 additions and 12248 deletions
-1
View File
@@ -1 +0,0 @@
.boton-footer[data-v-02dfa168]{background-color:#b80;color:#fff;width:14rem;font-size:.8rem}.dos[data-v-02dfa168],.tres[data-v-02dfa168],.uno[data-v-02dfa168]{margin-right:1rem}.btn[data-v-02dfa168]{margin-bottom:1rem}.Azul-puma[data-v-02dfa168]{background-color:#1e3c70}.footer[data-v-02dfa168]{text-align:center;color:#fff}@media (max-width:768px){.tres[data-v-02dfa168],.uno[data-v-02dfa168]{margin-right:4rem}.dos[data-v-02dfa168]{margin-right:0}.footer[data-v-02dfa168]{font-size:.7rem}}@media (max-width:970px){.dos[data-v-02dfa168],.tres[data-v-02dfa168],.uno[data-v-02dfa168]{margin-right:.5rem}.footer[data-v-02dfa168]{font-size:.7rem}}[data-v-30e9b756]{margin:0;padding:0}.divMaster[data-v-30e9b756]{height:auto;margin:0 auto}nav[data-v-30e9b756]{padding:0}.azulUnam[data-v-30e9b756]{background-color:#1e3c70}.doradoUnam[data-v-30e9b756],.dropdown-item[data-v-30e9b756]:hover{background-color:#b80}.dropdown-itemBusqueda[data-v-30e9b756]:hover{background-color:#1e3c70;color:#fff}.nav-link[data-v-30e9b756]:focus{background-color:#1e3c70;border-radius:1rem}.nav-link[data-v-30e9b756]:hover{background-color:#1e3c70;color:#fff;border-radius:.2rem}.nav-link[data-v-30e9b756]{transition:.3s;font-size:20px}.dropdown-item[data-v-30e9b756]{padding:.3rem 1rem}.dropdown[data-v-30e9b756]{position:relative;display:inline-block;height:auto}.dropdown-content[data-v-30e9b756]{position:absolute;background-color:#f9f9f9;min-width:160px;box-shadow:0 8px 16px 0 rgba(0,0,0,.2);top:.8rem;left:-10rem;display:block}.navbar-dark[data-v-30e9b756],.navbar-toggler[data-v-30e9b756]{font-size:1rem;border:none}@media (max-width:450px){.buscador[data-v-30e9b756],.menuText[data-v-30e9b756]{display:block!important}.dropdown-menu[data-v-30e9b756]{width:80vw!important}}.divMaster{height:8rem;margin:0;width:auto}.azulUnam{background-color:#1e3c70}.sizeImg{height:5rem}.logo_acatlan_resp{display:none!important}@media (max-width:450px){.logo_acatlan,.logo_unam{display:none!important}.logo_acatlan_resp{display:block!important}.logo_acatlan_resp a img{height:5rem}}#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50}a[data-v-eacb7b7a]{font-size:14px;margin-bottom:6px;font-weight:400}.button[data-v-6e1c8750]{background-color:#1b3d70;border:none;color:#fff;height:4rem;width:15rem;text-align:center;text-decoration:none;display:inline-block;font-size:1.5rem;border-radius:1rem;transition-duration:.4s;box-shadow:0 8px 16px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19);margin-left:2rem;margin-right:2rem;margin-bottom:2rem;margin-top:2rem}.button[data-v-6e1c8750]:hover{background-color:#b80;color:#fff}.button[data-v-4f1ed9c0]{background-color:#1b3d70;border:none;color:#fff;height:4rem;width:15rem;text-align:center;text-decoration:none;display:inline-block;font-size:1.5rem;border-radius:1rem;transition-duration:.4s;box-shadow:0 8px 16px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19);margin-left:2rem;margin-right:2rem;margin-bottom:2rem;margin-top:2rem}.button[data-v-4f1ed9c0]:hover{background-color:#b80;color:#fff}.button[data-v-231605bd]{background-color:#1b3d70;border:none;color:#fff;height:4rem;width:15rem;text-align:center;text-decoration:none;display:inline-block;font-size:1.5rem;border-radius:1rem;transition-duration:.4s;box-shadow:0 8px 16px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19);margin-left:2rem;margin-right:2rem;margin-bottom:2rem;margin-top:2rem}.button[data-v-231605bd]:hover{background-color:#b80;color:#fff}.button[data-v-0e9e5529]{background-color:#1b3d70;border:none;color:#fff;height:2.5rem;width:14rem;text-align:center;text-decoration:none;display:inline-block;font-size:1rem;border-radius:.3rem;transition-duration:.4s;box-shadow:0 8px 16px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19);margin-top:.3rem}.button[data-v-0e9e5529]:hover{background-color:#b80;color:#fff}
+1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>censo_front</title><link href="css/app.46afbad4.css" rel="preload" as="style"><link href="css/chunk-vendors.9e1d7bb4.css" rel="preload" as="style"><link href="js/app.1d637d17.js" rel="preload" as="script"><link href="js/chunk-vendors.7c846a9f.js" rel="preload" as="script"><link href="css/chunk-vendors.9e1d7bb4.css" rel="stylesheet"><link href="css/app.46afbad4.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but censo_front doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.7c846a9f.js"></script><script src="js/app.1d637d17.js"></script></body></html>
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>censo_front</title><link href="css/app.531bacc5.css" rel="preload" as="style"><link href="css/chunk-vendors.9e1d7bb4.css" rel="preload" as="style"><link href="js/app.0d5f6afd.js" rel="preload" as="script"><link href="js/chunk-vendors.5bfa42cc.js" rel="preload" as="script"><link href="css/chunk-vendors.9e1d7bb4.css" rel="stylesheet"><link href="css/app.531bacc5.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but censo_front doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.5bfa42cc.js"></script><script src="js/app.0d5f6afd.js"></script></body></html>
+2
View File
File diff suppressed because one or more lines are too long
+1
View File
File diff suppressed because one or more lines are too long
-2
View File
File diff suppressed because one or more lines are too long
-1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+12050 -12052
View File
File diff suppressed because it is too large Load Diff
+62 -65
View File
@@ -21,14 +21,15 @@
<b-col sm="9">
<div class="dropdown-container" v-if="opciones.length!=0">
<div class="dropdown">
<button class="btn dropdown-toggle btn btn-outline-primary dropdown-toggle btn-block short" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{opcionSeleted != '' ? opcionSeleted.nombre : campo}}
{{opcionSeleted != '' ? opcionSeleted.text : campo}}
</button>
<div class="dropdown-menu " aria-labelledby="dropdownMenuButton">
<div class="containerDrop" v-for="(opcion,index) in opciones" v-bind:key="index" @click="opcionSeleted=opcion">
<a class="dropdown-item " ><p> {{opcion.nombre}}</p></a>
</div>
<a class="dropdown-item"><p> {{opcion.text}}</p></a>
</div>
</div>
</div>
</div>
@@ -52,11 +53,11 @@
<style scoped>
.dropdown-item,.short{
width: 100%;
overflow: hidden;
white-space: pre;
text-overflow: ellipsis;
-webkit-appearance: none;
word-wrap: break-word;
overflow: hidden;
white-space: pre;
text-overflow: ellipsis;
-webkit-appearance: none;
word-wrap: break-word;
text-overflow: inherit;
white-space: normal;
}
@@ -68,9 +69,9 @@
}
.dropdown-menu{
height: 20rem;
width: 100%;
overflow-y: scroll;
max-height: 20rem;
width: 100%;
overflow-y: scroll;
}
</style>
@@ -104,60 +105,56 @@ export default {
},
async actualizarCampo(){
try{
if(this.opcionSeleted === "" && this.campoValue === ""){
await Swal.fire(
'¿Aún no has llenado el campo a editar?',
'',
'question'
);
return;
}
let data = {};
let valueCampo = '';
if(this.opciones.length!=0){
valueCampo = this.opcionSeleted.id;
}
else{
valueCampo = this.campoValue;
}
data ={
keyTable : this.pcSelected.keyTable,
idEquipo : this.objectPc.idEquipo,
idInventario: this.objectPc.idInventario,
value: valueCampo,
equipo: false
}
if( this.pcSelected.keyTable !== 'noInventario' && this.pcSelected.keyTable !== 'noResguardo' && this.pcSelected.keyTable !== 'idUnidadResponsable'){
data.equipo = true;
}
try{
await axios.post( `${config.api}/editarCampoEquipo`, data );
await Swal.fire(
'Se actualizo con exito el campo',
'',
'success'
);
location.reload();
return;
}
catch(error){
console.log(error);
await Swal.fire(
'No se pudo actualizar el campo',
`Error en consola ${error}`,
'error'
);
return;
}
}
catch(error){
console.log(error);
}
}
if(this.opcionSeleted === "" && this.campoValue === ""){
await Swal.fire(
'¿Aún no has llenado el campo a editar?',
'',
'question'
);
return;
}
let data = {};
let valueCampo = '';
if(this.opciones.length!=0){
valueCampo = this.opcionSeleted.id;
}
else{
valueCampo = this.campoValue;
}
data ={
keyTable : this.pcSelected.keyTable,
idEquipo : this.objectPc.idEquipo,
idInventario: this.objectPc.idInventario,
value: valueCampo,
equipo: false
}
if( this.pcSelected.keyTable !== 'noInventario' && this.pcSelected.keyTable !== 'noResguardo' && this.pcSelected.keyTable !== 'idUnidadResponsable'){
data.equipo = true;
}
try{
await axios.post( `${config.api}/editarCampoEquipo`, data );
await Swal.fire(
'Se actualizo con exito el campo',
'',
'success'
);
location.reload();
return;
}
catch(error){
console.log(error);
await Swal.fire(
'No se pudo actualizar el campo',
`Error en consola ${error}`,
'error'
);
return;
}
}
catch(error){
console.log(error);
}
}
},
computed:{
selectPC : function(){
+205 -56
View File
@@ -1,52 +1,93 @@
<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 >
<div class="flex-container">
<button style="align-self: center" class="btn nav-link " type="button" aria-haspopup="true" aria-expanded="false">
Eliminar
</button>
</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}}
<div>
<div class="row">
<div class="col-12">
<h3 style="text-align: right; margin-bottom: 1rem;">Totales: {{pcTablesFiltrada.length}} </h3>
<div class="table-responsive" style="height : 35rem">
<table class="table tableFixHead" >
<thead>
<tr>
<th >
<div class="flex-container">
<button style="align-self: center" class="btn nav-link " type="button" aria-haspopup="true" aria-expanded="false">
Eliminar
</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>
<b-button variant="outline-danger" @click="eliminar(pc.objectPc)">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" >
{{pcCampo.value}}
</td>
</tr>
</tbody>
</table>
</th>
<th v-for="(item,indexHeader) in pcHeaders" v-bind:key="indexHeader" scope="col" >
<div class="flex-container">
<div >
<div v-if="item.data.length != 0">
<div>
<div class="dropdown">
<button role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="align-self: center" class="btn nav-link dropdown-toggle" @click="llenarFiltro( indexHeader)">
{{item.nombre}}
</button>
<div class="dropdown-menu" aria-labelledby="navbarDropdown" >
<form style="padding: 10px">
<div class="form-check" >
<input type="checkbox" :checked="seleccionado(indexHeader)" @click="seleccionarDatos(item,indexHeader)" class="form-check-input" :id="item.nombre">
<label class="form-check-label" :for="item.nombre">Seleccionar todos</label>
</div>
<b-form-checkbox-group
:id="item.nombre"
v-model="selected"
:options="item.data"
:name="item.nombre"
stacked
></b-form-checkbox-group>
</form>
<div class="dropdown-divider"></div>
<div class="text-center">
<b-button center @click="filtrar(indexHeader)">Filtrar</b-button>
</div>
</div>
</div>
</div>
</div>
<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>
</div>
</th>
</tr>
</thead>
<tbody>
<tr v-for="(pc,index) in pcTablesFiltrada" v-bind:key="index">
<td>
<b-button variant="outline-danger" @click="eliminar(pc.objectPc)">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" >
{{pcCampo.value}}
</td>
</tr>
</tbody>
</table>
</div>
</div>
<Modal v-bind:campo="campo" v-bind:pcSelected="valueCampo" v-bind:opciones="opciones" v-bind:objectPc="pcSelected" />
</div>
<div class="row" style="margin-bottom: 3rem;" >
<div class="col-12">
<div class="pure-u-1 pure-u-md-1-2">
<b-button v-if="!loadExcel" class="button" @click="descargarExcel()"><a>Descargar</a></b-button>
<!-- <button class="button" @click="descargarExcel()" >
Descargar Excel
</button> -->
<div v-else class=" mb-3" style="margin-top: 3rem; ">
<b-spinner variant="primary" style="width: 5rem; height: 5rem;" label="Caragndo..."></b-spinner><br/>
<strong >Cargando...</strong>
</div>
</div>
</div>
</div>
<Modal v-bind:campo="campo" v-bind:pcSelected="valueCampo" v-bind:opciones="opciones" v-bind:objectPc="pcSelected" />
</div>
</template>
@@ -72,12 +113,75 @@ export default {
tableName: "",
opciones: [],
pcSelected: null,
opcionSeletedTable: {value: ''}
opcionSeletedTable: {value: ''},
selected: [],
link: null,
loadExcel: false,
}
},
methods: {
async descargarExcel(){
this.loadExcel = true;
const data = {
pcHeaders: this.pcHeaders,
table: this.pcTablesFiltrada
}
await axios.post( `${config.api}/createExcel`, data).then(async()=>{
this.loadExcel = false;
await Swal.fire(
'Se ha creado con exito el archvio',
'',
'success'
).then(()=>{
window.location.href = `${config.api}/getExcel`;
});
}).catch(error=>{
console.log(error);
Swal.fire({
icon: 'error',
title: 'Sucedio un error al crear el excel',
text: `${error}`,
});
});
},
async llenarFiltro(key){
for(let index in this.pcData){
let pc = this.pcData[index];
if(pc.headers[key] && !(this.selected.indexOf(pc.datos[key].value) > -1)){
this.selected.push(pc.datos[key].value);
}
}
},
seleccionado(key){
for(let index in this.pcData){
let pc = this.pcData[index];
if(!pc.headers[key] ){
return false;
}
}
return true;
},
async seleccionarDatos(datos,key){
if(this.seleccionado(key)){
this.selected = [];
}
else{
this.selected = [];
for(let index in datos.data){
this.selected.push(datos.data[index].value);
}
}
},
async filtrar(key){
for(let index in this.pcData){
let pc = this.pcData[index];
pc.headers[key] = (this.selected.indexOf(pc.datos[key].value) > -1);
}
},
async eliminar(pcData){
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-outline-success',
@@ -120,13 +224,6 @@ export default {
}
})
},
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 {
@@ -172,9 +269,61 @@ export default {
};
</script>
<style scoped>
.button {
background-color: #1b3d70; /* Green */
border: none;
color: white;
height: 4rem;
width: 15rem;
text-align: center;
text-decoration: none;
display: inline-block;
border-radius: 1rem;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
margin-left: 2rem;
margin-right: 2rem;
margin-bottom: 2rem;
margin-top: 2rem;
}
.button:hover {
background-color: #bb8800;
color: white;
}
a{
font-size: 14px;
margin-bottom: 6px;
font-weight: normal;
font-size: 1.7rem;
padding-top: .6rem;
}
.tableFixHead { overflow-y: auto; height: 100px; }
.tableFixHead thead th { position: sticky; top: 0; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 16px; }
th { background:#eee; }
.colorGris{
background:#eee;
}
.dropdown-item,.short{
width: 100%;
overflow: hidden;
white-space: pre;
text-overflow: ellipsis;
-webkit-appearance: none;
word-wrap: break-word;
text-overflow: inherit;
white-space: normal;
}
.dropdown {
position: relative ;
display: inline-block;
height: auto;
width: 100% !important;
}
.dropdown-menu{
max-height: 25rem;
width: 20rem;
overflow-y: scroll;
}
</style>
+72 -22
View File
@@ -5,27 +5,27 @@
<b-card title="Card Title" no-body style="margin-bottom: 4rem;">
<b-card-header header-tag="nav">
<b-nav card-header tabs>
<b-nav-item @click="textSelected= 'Tipo de Impresora'" v-bind:active="textSelected=='Tipo de Impresora'">Tipo de Impresora</b-nav-item>
<b-nav-item @click="textSelected= 'Marca de Impresora'" v-bind:active="textSelected=='Marca de Impresora'">Marca de Impresora</b-nav-item>
<b-nav-item @click="textSelected= 'Tipo de Uso'" v-bind:active="textSelected== 'Tipo de Uso'">Tipo de Uso </b-nav-item>
<b-nav-item @click="textSelected= 'Procesador'" v-bind:active="textSelected== 'Procesador'">Procesador</b-nav-item>
<b-nav-item @click="textSelected= 'Marca '" v-bind:active="textSelected== 'Sistema Operativo'">Sistema Operativo</b-nav-item>
<b-nav-item @click="textSelected= 'Tarjeta Grafica'" v-bind:active="textSelected== 'Tarjeta Grafica'">Tarjeta Grafica</b-nav-item>
<b-nav-item @click="textSelected= 'Tipo de memoride Equipo'" v-bind:active="textSelected== 'Marca de Equipo'">Marca de Equipo</b-nav-item>
<b-nav-item @click="textSelected= 'Sistema Operativoa Ram'" v-bind:active="textSelected== 'Tipo de memoria Ram'">Tipo de memoria Ram</b-nav-item>
<b-nav-item @click="textSelected= 'Tipo de Equipo de Computo'" v-bind:active="textSelected== 'Tipo de Equipo de Computo'">Tipo de Equipo de Computo</b-nav-item>
<b-nav-item @click="textSelected= 'Unidad Responsable'" v-bind:active="textSelected== 'Unidad Responsable'">Unidad Responsable</b-nav-item>
<b-nav-item @click="valueText='', textSelected= 'Tipo de Impresora'" v-bind:active="textSelected=='Tipo de Impresora'">Tipo de Impresora</b-nav-item>
<b-nav-item @click="valueText='', textSelected= 'Marca de Impresora'" v-bind:active="textSelected=='Marca de Impresora'">Marca de Impresora</b-nav-item>
<b-nav-item @click="valueText='', textSelected= 'Tipo de Uso'" v-bind:active="textSelected== 'Tipo de Uso'">Tipo de Uso </b-nav-item>
<b-nav-item @click="valueText='', textSelected= 'Procesador'" v-bind:active="textSelected== 'Procesador'">Procesador</b-nav-item>
<b-nav-item @click="valueText='', textSelected= 'Sistema Operativo'" v-bind:active="textSelected== 'Sistema Operativo'">Sistema Operativo</b-nav-item>
<b-nav-item @click="valueText='', textSelected= 'Tarjeta Grafica'" v-bind:active="textSelected== 'Tarjeta Grafica'">Tarjeta Grafica</b-nav-item>
<b-nav-item @click="valueText='', textSelected= 'Marca de Equipo'" v-bind:active="textSelected== 'Marca de Equipo'">Marca de Equipo</b-nav-item>
<b-nav-item @click="valueText='', textSelected= 'Tipo de memoria Ram'" v-bind:active="textSelected== 'Tipo de memoria Ram'">Tipo de memoria Ram</b-nav-item>
<b-nav-item @click="valueText='', textSelected= 'Tipo de Equipo de Computo'" v-bind:active="textSelected== 'Tipo de Equipo de Computo'">Tipo de Equipo de Computo</b-nav-item>
<b-nav-item @click="valueText='', textSelected= 'Unidad Responsable'" v-bind:active="textSelected== 'Unidad Responsable'">Unidad Responsable</b-nav-item>
</b-nav>
</b-card-header>
<b-card-body class="text-center">
<div class="container">
<div class="row" v-if="textSelected!='Unidad Responsable'">
<div class="col-md-8" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" v-bind:placeholder="textSelected"></b-form-input>
<b-form-input style="margin: .5rem;" class="fadeIn second" v-bind:placeholder="textSelected" v-model="valueText"></b-form-input>
</div>
<div class="col-md-4" >
<div class="pure-u-1 pure-u-md-1-2">
<button class="button " >
<button class="button " @click="agregar()">
Agregar
</button>
</div>
@@ -33,17 +33,14 @@
</div>
<div class="row" v-else>
<div class="col-md-12" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Nombre de la Unidad Responsable"></b-form-input>
<b-form-input style="margin: .5rem;" class="fadeIn second" placeholder="Nombre de la Unidad Responsable" v-model="unidadResponsable"></b-form-input>
</div>
<div class="col-md-12" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Nombre del Responsable"></b-form-input>
</div>
<div class="col-md-12" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Ubicación fisica"></b-form-input>
<b-form-input style="margin: .5rem;" class="fadeIn second" placeholder="Nombre del Responsable" v-model="nombreResponsable"></b-form-input>
</div>
<div class="col-md-12" >
<div class="pure-u-1 pure-u-md-1-2">
<button class="button " >
<button class="button " @click="agregar()" >
Agregar
</button>
</div>
@@ -56,19 +53,72 @@
</div>
</template>
<script>
<script>
import axios from "axios";
import config from "../config/config.js";
import Swal from 'sweetalert2';
export default {
name: "home",
components: {
},
data() {
return {
textSelected : 'Tipo de Impresora'
textSelected : 'Tipo de Impresora',
valueText: '',
unidadResponsable: '',
nombreResponsable: '',
}
},
methods: {
async agregar(){
if(this.textSelected !== 'Unidad Responsable' ){
if(this.valueText === ''){
await Swal.fire(
`Aun no has agregado el campo`,
'',
'question'
)
return;
}
}
else{
if(this.unidadResponsable === '' || this.nombreResponsable === '' || this.ubicacion === ''){
await Swal.fire(
`Aun no has agregado los campos`,
'',
'question'
)
return;
}
}
let data = {
valueText : this.valueText,
unidadResponsable : this.unidadResponsable,
nombreResponsable : this.nombreResponsable,
textSelected : this.textSelected
}
try{
await axios.post( `${config.api}/addCatalogo`, data);
await Swal.fire(
'Se ha agregado con exito al catalogo',
'',
'success'
);
location.reload();
return;
}
catch(error){
console.log(error);
await Swal.fire(
'No se pudo agregar al catalogo',
`Error en consola ${error}`,
'error'
);
return;
}
}
}
};
+198 -39
View File
@@ -3,41 +3,70 @@
<h1 style="margin: 2rem">Agregar Equipo</h1>
<div class="row">
<div class="col-md-4" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Número de inventario"></b-form-input>
<b-form-input style="margin: .5rem;" placeholder="Número de inventario" v-model="noInventario"></b-form-input>
</div>
<div class="col-md-4" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Número de resguardo"></b-form-input>
<b-form-input style="margin: .5rem;" placeholder="Número de resguardo" v-model="noResguardo"></b-form-input>
</div>
<div class="col-md-4" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Serie"></b-form-input>
<b-form-input style="margin: .5rem;" placeholder="Serie" v-model="serie"></b-form-input>
</div>
</div>
<div class="row">
<div class="col-md-6" >
<b-form-input style="margin: .5rem;" placeholder="Tamaño de discos" v-model="sizeDiscos"></b-form-input>
</div>
<div class="col-md-6" >
<b-form-input style="margin: .5rem;" placeholder="Número de discos" v-model="numeroDiscos"></b-form-input>
</div>
</div>
<div class="row">
<div class="col-md-4" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Cantidad de memoria RAM"></b-form-input>
<b-form-input style="margin: .5rem;" placeholder="Cantidad de memoria RAM" v-model="cantidadMemoriaRam"></b-form-input>
</div>
<div class="col-md-4" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Velocidad de memoria Ram"></b-form-input>
<b-form-input style="margin: .5rem;" placeholder="Velocidad de memoria Ram" v-model="velocidadMemoriaRam"></b-form-input>
</div>
<div class="col-md-4" >
<b-dropdown v-bind:text="tipoMemoriaRamSelected != null ? tipoMemoriaRamSelected.nombre : 'Tipo de Memoria Ram'" block variant="outline-primary" class="m-2">
<b-dropdown-item v-for="tipo in tipoMemoriaRam" v-bind:key="tipo.id" @click="tipoMemoriaRamSelected = tipo">{{tipo.nombre}}</b-dropdown-item>
</b-dropdown>
<div class="col-md-4">
<div class="dropdown">
<button class="btn dropdown-toggle btn btn-outline-primary dropdown-toggle btn-block short" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{tipoMemoriaRamSelected != null ? tipoMemoriaRamSelected.nombre : 'Tipo de Memoria Ram'}}
</button>
<div class="dropdown-menu " aria-labelledby="dropdownMenuButton">
<div class="containerDrop" v-for="tipo in tipoMemoriaRam" v-bind:key="tipo.id" @click="tipoMemoriaRamSelected = tipo">
<a class="dropdown-item"><p>{{tipo.nombre}}</p></a>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4" >
<b-dropdown v-bind:text="tarjetaGraficaSelected != null ? tarjetaGraficaSelected.nombre : 'Tipo de tarjeta grafica'" block variant="outline-primary" class="m-2">
<b-dropdown-item v-for="tipo in tarjetaGrafica" v-bind:key="tipo.id" @click="tarjetaGraficaSelected = tipo">{{tipo.nombre}}</b-dropdown-item>
</b-dropdown>
<div class="dropdown">
<button class="btn dropdown-toggle btn btn-outline-primary dropdown-toggle btn-block short" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{tarjetaGraficaSelected != null ? tarjetaGraficaSelected.nombre : 'Tipo de tarjeta grafica'}}
</button>
<div class="dropdown-menu " aria-labelledby="dropdownMenuButton">
<div class="containerDrop" v-for="tipo in tarjetaGrafica" v-bind:key="tipo.id" @click="tarjetaGraficaSelected = tipo">
<a class="dropdown-item"><p>{{tipo.nombre}}</p></a>
</div>
</div>
</div>
</div>
<div class="col-md-4" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Tamaño de la tarjeta grafica"></b-form-input>
<b-form-input style="margin: .5rem;" placeholder="Cantidad de memoria de la tarjeta grafica" v-model="cantidadMemoriaGrafica"></b-form-input>
</div>
<div class="col-md-4" >
<b-dropdown v-bind:text="tipoEquipoSelected != null ? tipoEquipoSelected.nombre : 'Tipo de Equipo'" block variant="outline-primary" class="m-2">
<b-dropdown-item v-for="tipo in tipoEquipo" v-bind:key="tipo.id" @click="tipoEquipoSelected = tipo">{{tipo.nombre}}</b-dropdown-item>
</b-dropdown>
<div class="dropdown">
<button class="btn dropdown-toggle btn btn-outline-primary dropdown-toggle btn-block short" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{tipoEquipoSelected != null ? tipoEquipoSelected.nombre : 'Tipo de Equipo'}}
</button>
<div class="dropdown-menu " aria-labelledby="dropdownMenuButton">
<div class="containerDrop" v-for="tipo in tipoEquipo" v-bind:key="tipo.id" @click="tipoEquipoSelected = tipo">
<a class="dropdown-item"><p>{{tipo.nombre}}</p></a>
</div>
</div>
</div>
</div>
</div>
<div class="row">
@@ -47,20 +76,27 @@
</b-dropdown>
</div>
<div class="col-md-4" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Versión"></b-form-input>
<b-form-input style="margin: .5rem;" placeholder="Versión del sistema operativo" v-model="versionOS"></b-form-input>
</div>
<div class="col-md-4" >
<b-dropdown v-bind:text="procesadorSelected != null ? procesadorSelected.nombre : 'Procesador'" block variant="outline-primary" class="m-2">
<b-dropdown-item v-for="tipo in procesador" v-bind:key="tipo.id" @click="procesadorSelected = tipo">{{tipo.nombre}}</b-dropdown-item>
</b-dropdown>
<div class="dropdown">
<button class="btn dropdown-toggle btn btn-outline-primary dropdown-toggle btn-block short" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{procesadorSelected != null ? procesadorSelected.nombre : 'Procesador'}}
</button>
<div class="dropdown-menu " aria-labelledby="dropdownMenuButton">
<div class="containerDrop" v-for="tipo in procesador" v-bind:key="tipo.id" @click="procesadorSelected = tipo">
<a class="dropdown-item"><p>{{tipo.nombre}}</p></a>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Velocidad del procesador GHz"></b-form-input>
<b-form-input style="margin: .5rem;" placeholder="Velocidad del procesador GHz" v-model="velocidadProcesadorGHz"></b-form-input>
</div>
<div class="col-md-8">
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Descripción del procesador"></b-form-input>
<b-form-input style="margin: .5rem;" placeholder="Descripción del procesador" v-model="descripcionProcesador"></b-form-input>
</div>
</div>
<div class="row">
@@ -70,7 +106,7 @@
</b-dropdown>
</div>
<div class="col-md-4" >
<b-form-input style="margin: .5rem;" class="fadeIn second" id="input-small" placeholder="Modelo"></b-form-input>
<b-form-input style="margin: .5rem;" placeholder="Modelo del equipo" v-model="modeloEquipo"></b-form-input>
</div>
<div class="col-md-4" >
<b-dropdown v-bind:text="usoSelected != null ? usoSelected.nombre : 'Uso'" block variant="outline-primary" class="m-2">
@@ -80,24 +116,36 @@
</div>
<div class="row">
<div class="col-md-12" >
<b-dropdown v-bind:text="unidadSelected != null ? unidadSelected.unidadResponsable.nombre : 'Unidad Responsable'" block variant="outline-primary" class="m-2">
<b-dropdown-item v-for="tipo in unidad" v-bind:key="tipo.unidadResponsable.id" @click="unidadSelected = tipo">{{tipo.unidadResponsable.nombre}}</b-dropdown-item>
</b-dropdown>
<div class="col-md-12" style="margin: .5rem;" >
<div class="dropdown">
<button class="btn dropdown-toggle btn btn-outline-primary dropdown-toggle btn-block short" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{unidadSelected != null ? unidadSelected.unidadResponsable.nombre : 'Unidad Responsable'}}
</button>
<div class="dropdown-menu " aria-labelledby="dropdownMenuButton">
<div class="containerDrop" v-for="tipo in unidad" v-bind:key="tipo.unidadResponsable.id" @click="unidadSelected = tipo">
<a class="dropdown-item"><p>{{tipo.unidadResponsable.nombre}}</p></a>
</div>
</div>
</div>
</div>
<div class="col-md-12 " >
<b-dropdown v-bind:text="unidadSelected != null ? unidadSelected.responsable.nombre : 'Nombre del responsable'" block variant="outline-primary" class="m-2">
<b-dropdown-item v-for="tipo in unidad" v-bind:key="tipo.responsable.id" @click="unidadSelected = tipo">{{tipo.responsable.nombre}}</b-dropdown-item>
</b-dropdown>
<div class="col-md-12 " style="margin: .5rem;">
<div class="dropdown">
<button class="btn dropdown-toggle btn btn-outline-primary dropdown-toggle btn-block short" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{unidadSelected != null ? unidadSelected.responsable.nombre : 'Nombre del responsable' }}
</button>
<div class="dropdown-menu " aria-labelledby="dropdownMenuButton">
<div class="containerDrop" v-for="(tipo,index) in unidad" v-bind:key="index" @click="unidadSelected = tipo">
<a class="dropdown-item"><p>{{tipo.responsable.nombre}}</p></a>
</div>
</div>
</div>
</div>
<div class="col-md-12 " >
<b-dropdown v-bind:text="unidadSelected != null ? unidadSelected.ubicacion.nombre : 'Ubicación'" block variant="outline-primary" class="m-2">
<b-dropdown-item v-for="tipo in unidad" v-bind:key="tipo.ubicacion.id" @click="unidadSelected = tipo">{{tipo.ubicacion.nombre}}</b-dropdown-item>
</b-dropdown>
<div class="col-md-12 " >
<b-form-input style="margin: .5rem;" placeholder="Ubicación de la Unidad Responsable" v-model="ubicacionUnidad"></b-form-input>
</div>
</div>
<div class="pure-u-1 pure-u-md-1-2">
<button class="button " >
<button class="button " @click="agregar()">
Agregar
</button>
</div>
@@ -107,6 +155,7 @@
<script>
import axios from "axios";
import config from "../config/config.js";
import Swal from 'sweetalert2';
export default {
@@ -116,6 +165,18 @@ export default {
data() {
return {
typeSelected:"Equipos",
noInventario: "",
noResguardo: "",
serie: "",
cantidadMemoriaRam: "",
velocidadMemoriaRam: "",
cantidadMemoriaGrafica: "",
versionOS:"",
velocidadProcesadorGHz: "",
descripcionProcesador: "",
numeroDiscos: "",
sizeDiscos: "",
modeloEquipo: "",
tipoEquipo : null,
tipoEquipoSelected: null,
tipoMemoriaRam : null,
@@ -131,13 +192,88 @@ export default {
unidad: null,
unidadSelected: null,
uso: null,
usoSelected : null
usoSelected : null,
ubicacionUnidad: ""
}
},
methods: {
async faltaCampo(campo){
await Swal.fire(
`Falta el campo de ${campo} por llenar`,
'',
'warning'
)
return;
},
async agregar() {
if(this.noInventario === "") return this.faltaCampo("Número de inventario");
if(this.noResguardo === "") return this.faltaCampo("Número de resguardo");
if(this.serie === "") return this.faltaCampo("Serie");
if(this.sizeDiscos === "") return this.faltaCampo("El tamaño de disco");
if(this.numeroDiscos === "") return this.faltaCampo("El número de descos");
if(this.cantidadMemoriaRam === "") return this.faltaCampo("Cantidad de memoria RAM");
if(this.velocidadMemoriaRam === "") return this.faltaCampo("Velocidad de la memoria RAM");
if(this.cantidadMemoriaGrafica === "") return this.faltaCampo("Cantidad de la memoria Grafica");
if(this.versionOS ==="") return this.faltaCampo("Versión del Sistema Operativo");
if(this.velocidadProcesadorGHz === "") return this.faltaCampo("Velocidad de procesador");
if(this.descripcionProcesador === "") return this.faltaCampo("Descripción del procesador");
if(this.modeloEquipo === "") return this.faltaCampo("Modelo del equipo");
if(this.ubicacionUnidad === "") return this.faltaCampo("Ubicación de la Unidad responsable");
if(this.tipoEquipoSelected === null) return this.faltaCampo("El tipo de equipo");
if(this.tipoMemoriaRamSelected === null) return this.faltaCampo("El tipo de memoria RAM");
if(this.tarjetaGraficaSelected === null) return this.faltaCampo("El tipo de tarjeta grafica");
if(this.osSelected === null) return this.faltaCampo("El tipo de sistema operativo");
if(this.marcaSelected === null) return this.faltaCampo("La marca del equipo");
if(this.procesadorSelected === null) return this.faltaCampo("El tipo del procesador");
if(this.unidadSelected === null) return this.faltaCampo("La unidad Responsable");
const data ={
noInventario: this.noInventario,
noResguardo: this.noResguardo,
serie: this.serie,
sizeDiscos: this.sizeDiscos,
numeroDiscos: this.numeroDiscos,
cantidadMemoriaRam: this.cantidadMemoriaRam,
velocidadMemoriaRam: this.velocidadMemoriaRam,
cantidadMemoriaGrafica: this.cantidadMemoriaGrafica,
versionOS: this.versionOS,
velocidadProcesadorGHz: this.velocidadProcesadorGHz,
descripcionProcesador: this.descripcionProcesador,
modeloEquipo: this.modeloEquipo,
idTipoEquipo: this.tipoEquipoSelected,
idMemoriaRam: this.tipoMemoriaRamSelected,
idTarjetaGrafica: this.tarjetaGraficaSelected,
idOs: this.osSelected,
idMarcaEquipo: this.marcaSelected,
idProcesador: this.procesadorSelected,
idUso : this.usoSelected,
unidad: this.unidadSelected,
ubicacion: this.ubicacionUnidad,
}
console.log(data);
try{
await axios.post( `${config.api}/addEquipo`, data );
await Swal.fire(
'Se agrego con exito el equipo',
'',
'success'
);
location.reload();
return;
}
catch(error){
console.log(error);
await Swal.fire(
'No se pudo agregar el equipo',
`Error en consola ${error}`,
'error'
);
return;
}
}
},
async created() {
async beforeCreate() {
try {
let catalogo = await axios.get(`${config.api}/getCatalgoEquipo`);
this.tipoEquipo= catalogo.data.catalogos.tipoEquipo;
@@ -180,4 +316,27 @@ export default {
background-color: #bb8800;
color: white;
}
.dropdown-item,.short{
width: 100%;
overflow: hidden;
white-space: pre;
text-overflow: ellipsis;
-webkit-appearance: none;
word-wrap: break-word;
text-overflow: inherit;
white-space: normal;
}
.dropdown{
position: relative ;
display: inline-block;
height: auto;
width: 100% !important;
}
.dropdown-menu{
max-height: 20rem;
width: 100%;
overflow-y: scroll;
}
</style>
+1 -5
View File
@@ -23,11 +23,7 @@
<PrinterTable />
</div>
<div class="pure-u-1 pure-u-md-1-2">
<button class="button " >
Descargar Excel
</button>
</div>
</div>
</template>
+4 -1
View File
@@ -1,4 +1,7 @@
module.exports = {
publicPath: "./"
publicPath: "./",
devServer: {
host: 'localhost'
}
};