Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad9ce556e5 | |||
| 2233b3d918 | |||
| 7b549a66cd | |||
| da424b4ff3 | |||
| 85656d1559 | |||
| 7383b33989 | |||
| 571f7e14cf | |||
| 99f2de9496 | |||
| a5d94893db | |||
| c577603f09 | |||
| 247dbab277 | |||
| f26d5244cd | |||
| 18efd180d8 | |||
| 40c52898da | |||
| 1d4a35716b | |||
| a913579e9c | |||
| d12230e429 | |||
| 2d1f160ef2 | |||
| 9d675f3d4b | |||
| edae83a47b | |||
| f97f971a26 | |||
| 302aac25e2 | |||
| d31a83cef4 | |||
| e9b2b53dea | |||
| 4b48735210 | |||
| 8be42212c3 | |||
| f8b222c3b6 | |||
| e289a2e914 | |||
| cb5c259a22 | |||
| 111acdfc74 | |||
| aa1061a633 | |||
| 23f54fc58a | |||
| de28099500 | |||
| ab8c0b4d84 | |||
| 7ca15fefdd | |||
| fd12449a6e | |||
| e89f3369be | |||
| 188edb0002 | |||
| fb777ba18a | |||
| 5bf991f0d0 | |||
| 9423936548 | |||
| 5bcc1dcdb0 | |||
| 26bbefb406 | |||
| 6777c24879 | |||
| 7acaa605ac | |||
| 5a5f40ccb3 | |||
| d77cf19d18 | |||
| a1f70071b1 | |||
| 1fc96d23d0 | |||
| 7e5113a588 | |||
| 799cb017a7 | |||
| 379e6f9f85 | |||
| 1c5769016d | |||
| 30550e58f8 | |||
| 7055bddea8 | |||
| bd7c2679b4 | |||
| a48da7022b | |||
| 6edcfd4559 | |||
| bf4fdad21e | |||
| 97b4fdf62d | |||
| 49eeb107c9 | |||
| 2cf37381e3 | |||
| 1476cacf43 | |||
| cd6df6188d |
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) <year> <copyright holders>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is furnished
|
|
||||||
to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice (including the next
|
|
||||||
paragraph) shall be included in all copies or substantial portions of the
|
|
||||||
Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
|
||||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
||||||
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
@@ -1,2 +1,24 @@
|
|||||||
# censo2020
|
# censofront
|
||||||
|
|
||||||
|
## Project setup
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and hot-reloads for development
|
||||||
|
```
|
||||||
|
npm run serve
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and minifies for production
|
||||||
|
```
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Lints and fixes files
|
||||||
|
```
|
||||||
|
npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
|
### Customize configuration
|
||||||
|
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
presets: [
|
||||||
|
'@vue/cli-plugin-babel/preset'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=./src/img/escudo-unam.ico><title>Censo</title><link href=css/app.cfbc4946.css rel=preload as=style><link href=css/chunk-vendors.ab91ceed.css rel=preload as=style><link href=js/app.fc975bee.js rel=preload as=script><link href=js/chunk-vendors.6d6b9537.js rel=preload as=script><link href=css/chunk-vendors.ab91ceed.css rel=stylesheet><link href=css/app.cfbc4946.css rel=stylesheet></head><body><div id=app></div><script src=/dist/build.js></script><script src=js/chunk-vendors.6d6b9537.js></script><script src=js/app.fc975bee.js></script></body></html>
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"name": "censofront",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"serve": "vue-cli-service serve",
|
||||||
|
"build": "vue-cli-service build",
|
||||||
|
"lint": "vue-cli-service lint"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@fortawesome/fontawesome-svg-core": "^1.2.31",
|
||||||
|
"@fortawesome/free-brands-svg-icons": "^5.15.0",
|
||||||
|
"@fortawesome/free-regular-svg-icons": "^5.15.0",
|
||||||
|
"@fortawesome/free-solid-svg-icons": "^5.15.0",
|
||||||
|
"@fortawesome/vue-fontawesome": "^2.0.0",
|
||||||
|
"axios": "^0.20.0",
|
||||||
|
"bootstrap": "^4.5.2",
|
||||||
|
"bootstrap-vue": "^2.17.3",
|
||||||
|
"core-js": "^3.6.5",
|
||||||
|
"csv": "^5.3.2",
|
||||||
|
"file-system": "^2.2.2",
|
||||||
|
"fs": "0.0.1-security",
|
||||||
|
"jsonwebtoken": "^8.5.1",
|
||||||
|
"vue": "^2.6.11",
|
||||||
|
"vue-router": "^3.4.5",
|
||||||
|
"vue-sweetalert2": "^3.0.8",
|
||||||
|
"xlsx": "^0.16.7"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vue/cli-plugin-babel": "~4.5.0",
|
||||||
|
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||||
|
"@vue/cli-service": "~4.5.0",
|
||||||
|
"babel-eslint": "^10.1.0",
|
||||||
|
"eslint": "^6.7.2",
|
||||||
|
"eslint-plugin-vue": "^6.2.2",
|
||||||
|
"vue-template-compiler": "^2.6.11"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"root": true,
|
||||||
|
"env": {
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"plugin:vue/essential",
|
||||||
|
"eslint:recommended"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"parser": "babel-eslint"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-unused-vars": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions",
|
||||||
|
"not dead"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 132 KiB |
@@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="icon" href="./src/img/escudo-unam.ico">
|
||||||
|
<title>Censo</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script src="/dist/build.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<div id="app">
|
||||||
|
<Header />
|
||||||
|
<router-view></router-view>
|
||||||
|
<Footer />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Header from './components/Header'
|
||||||
|
import Footer from './components/Footer'
|
||||||
|
|
||||||
|
import Vue from 'vue'
|
||||||
|
import BootstrapVue from 'bootstrap-vue'
|
||||||
|
|
||||||
|
|
||||||
|
Vue.use(BootstrapVue)
|
||||||
|
|
||||||
|
import 'bootstrap/dist/css/bootstrap.css'
|
||||||
|
import 'bootstrap-vue/dist/bootstrap-vue.css'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'app',
|
||||||
|
components: {
|
||||||
|
Header,
|
||||||
|
Footer
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
#app {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<template>
|
||||||
|
<footer id="footer" v-if="['login', 'start'].includes($route.name)">
|
||||||
|
<div class="separador"></div>
|
||||||
|
<div class="contenedor-footer p-3">
|
||||||
|
<div class="cont-text-foo text-white text-center">
|
||||||
|
<p>
|
||||||
|
Hecho en México, todos los derechos reservados 2020.
|
||||||
|
<br />
|
||||||
|
Esta página puede ser reproducida con fines no lucrativos,
|
||||||
|
siempre y cuando no se mutile, se cite la fuente
|
||||||
|
<br />
|
||||||
|
completa y su dirección electrónica. De otra forma, requiere
|
||||||
|
permiso previo por escrito de la institución.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
* {
|
||||||
|
margin: 0px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
#footer {
|
||||||
|
bottom: 0px;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.separador {
|
||||||
|
width: 100%;
|
||||||
|
background: #2e5795;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contenedor-footer {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cont-text-foo {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
background: #1b3d70;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
<template>
|
||||||
|
<header id="iniLetter">
|
||||||
|
<div class="container-fluid header-h">
|
||||||
|
<div class="col-4 offset-1 d-inline-flex p-0 align-items-center">
|
||||||
|
<a href="https://www.unam.mx/"
|
||||||
|
><img
|
||||||
|
src="../img/Logo-UNAM.png"
|
||||||
|
class="img-fluid"
|
||||||
|
alt="Logo UNAM"
|
||||||
|
/></a>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="col-4 offset-2 d-inline-flex justify-content-end p-0 align-items-center"
|
||||||
|
>
|
||||||
|
<a href="http://www.acatlan.unam.mx/">
|
||||||
|
<img
|
||||||
|
src="../img/logo_fesa.png"
|
||||||
|
class="img-fluid"
|
||||||
|
alt="Logo Fes Acatlán"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="header-f"
|
||||||
|
v-if="!['login'].includes($route.name)"
|
||||||
|
>
|
||||||
|
|
||||||
|
<div class="container d-flex justify-content-between py-0 my-2">
|
||||||
|
|
||||||
|
<div class="d-flex">
|
||||||
|
<font-awesome-icon v-if="!['login'].includes($route.name)" icon="home" class="my-auto text-white" style="cursor:pointer" @click="$router.push('user')"/>
|
||||||
|
|
||||||
|
<div class="d-flex align-items-center mx-4">
|
||||||
|
<font-awesome-icon icon="user" v-if="!!setCurrentUser()" class="my-auto mr-2 text-white" />
|
||||||
|
<span class="text-white my-auto" v-text="setCurrentUser()">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<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="">
|
||||||
|
<b-dropdown-item @click="$router.push('addEquip')">Equipo</b-dropdown-item>
|
||||||
|
<b-dropdown-item @click="$router.push('addPrinter')">Impresora</b-dropdown-item>
|
||||||
|
</b-dropdown>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="my-auto">
|
||||||
|
<span
|
||||||
|
class="btn btn-danger" style="font-family: Arial:none;"
|
||||||
|
v-on:click="logout()"
|
||||||
|
>
|
||||||
|
Cerrar sesión
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</header>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setCurrentUser(){
|
||||||
|
return window.localStorage.user;
|
||||||
|
},
|
||||||
|
logout: function() {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$router.replace('/login')
|
||||||
|
},
|
||||||
|
isAdmin: function() {
|
||||||
|
return JSON.parse(localStorage.getItem('isAdmin'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.header-h {
|
||||||
|
/* background: #1b3d70; */
|
||||||
|
background: #1b3d70;
|
||||||
|
padding: 1rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contenedor-header {
|
||||||
|
padding: 1rem 0;
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contenedor-img {
|
||||||
|
width: 40%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.contenedor-img img {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-f {
|
||||||
|
padding: 0.1rem 0;
|
||||||
|
background-color: #bb8800;
|
||||||
|
|
||||||
|
}
|
||||||
|
#info {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.sesion {
|
||||||
|
margin: 0.5rem;
|
||||||
|
line-height: 0.5rem !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
const config = {
|
||||||
|
api: 'https://venus.acatlan.unam.mx/censo-pruebas/',
|
||||||
|
//api: 'https://venus.acatlan.unam.mx/censo_orion',
|
||||||
|
//api: 'http://localhost:3000',
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = config
|
||||||
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 309 B |
|
After Width: | Height: | Size: 9.2 KiB |
@@ -0,0 +1,39 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import App from './App.vue'
|
||||||
|
import router from './routes'
|
||||||
|
|
||||||
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
|
import {
|
||||||
|
faUserSecret,
|
||||||
|
faUser,
|
||||||
|
faLock,
|
||||||
|
faGraduationCap,
|
||||||
|
faExternalLinkAlt,
|
||||||
|
faKey,
|
||||||
|
faExclamationCircle,
|
||||||
|
faEnvelope,
|
||||||
|
faHome,
|
||||||
|
faSearch
|
||||||
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
||||||
|
|
||||||
|
library.add(faUserSecret)
|
||||||
|
library.add(faUser)
|
||||||
|
library.add(faLock)
|
||||||
|
library.add(faExternalLinkAlt)
|
||||||
|
library.add(faGraduationCap)
|
||||||
|
library.add(faExclamationCircle)
|
||||||
|
library.add(faKey)
|
||||||
|
library.add(faEnvelope)
|
||||||
|
library.add(faHome)
|
||||||
|
library.add(faSearch)
|
||||||
|
|
||||||
|
Vue.component('font-awesome-icon', FontAwesomeIcon)
|
||||||
|
|
||||||
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
// el: '#app',
|
||||||
|
new Vue({
|
||||||
|
render: h => h(App),
|
||||||
|
router,
|
||||||
|
}).$mount('#app')
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import VueRouter from 'vue-router'
|
||||||
|
|
||||||
|
import Login from './views/Login.vue'
|
||||||
|
import User from './views/User.vue'
|
||||||
|
import AddEquip from './views/AddEquip.vue'
|
||||||
|
import AddPrinter from './views/AddPrinter.vue'
|
||||||
|
import UpdateEquip from './views/UpdateEquip.vue'
|
||||||
|
import UpdatePrinter from './views/UpdatePrinter.vue'
|
||||||
|
|
||||||
|
|
||||||
|
const routes = [{
|
||||||
|
path: '*',
|
||||||
|
redirect: 'login'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
name: 'root',
|
||||||
|
redirect: 'login'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/login',
|
||||||
|
component: Login,
|
||||||
|
name: 'login',
|
||||||
|
meta: { isPublic: true },
|
||||||
|
beforeEnter: (to, from, next) => {
|
||||||
|
if (isAuthenticated())
|
||||||
|
next('/user');
|
||||||
|
else
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/user',
|
||||||
|
component: User,
|
||||||
|
name: 'user',
|
||||||
|
meta: { isPublic: true },
|
||||||
|
beforeEnter: (to, from, next) => {
|
||||||
|
if (isAuthenticated())
|
||||||
|
next(true);
|
||||||
|
else
|
||||||
|
next(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/addEquip',
|
||||||
|
component: AddEquip,
|
||||||
|
name: 'addEquip',
|
||||||
|
meta: { perm: true },
|
||||||
|
beforeEnter: (to, from, next) => {
|
||||||
|
if (!isAuthenticated())
|
||||||
|
next('/login');
|
||||||
|
else if (isAuthenticated() && !isAdmin())
|
||||||
|
next(false)
|
||||||
|
else
|
||||||
|
next(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/addPrinter',
|
||||||
|
component: AddPrinter,
|
||||||
|
name: 'addPrinter',
|
||||||
|
meta: { perm: true },
|
||||||
|
beforeEnter: (to, from, next) => {
|
||||||
|
if (!isAuthenticated())
|
||||||
|
next('/login');
|
||||||
|
else if (isAuthenticated() && !isAdmin())
|
||||||
|
next(false)
|
||||||
|
else
|
||||||
|
next(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/updateEquip',
|
||||||
|
component: UpdateEquip,
|
||||||
|
name: 'updateEquip',
|
||||||
|
meta: { perm: true },
|
||||||
|
beforeEnter: (to, from, next) => {
|
||||||
|
if (!isAuthenticated())
|
||||||
|
next('/login');
|
||||||
|
else if (isAuthenticated() && !isAdmin())
|
||||||
|
next(false)
|
||||||
|
else
|
||||||
|
next(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/updatePrinter',
|
||||||
|
component: UpdatePrinter,
|
||||||
|
name: 'updatePrinter',
|
||||||
|
meta: { perm: true },
|
||||||
|
beforeEnter: (to, from, next) => {
|
||||||
|
if (!isAuthenticated())
|
||||||
|
next('/login');
|
||||||
|
else if (isAuthenticated() && !isAdmin())
|
||||||
|
next(false)
|
||||||
|
else
|
||||||
|
next(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
Vue.use(VueRouter)
|
||||||
|
/* Produccción */
|
||||||
|
// const router = new VueRouter({mode: 'history', routes})
|
||||||
|
/* Pruebas */
|
||||||
|
const router = new VueRouter({ routes })
|
||||||
|
|
||||||
|
const isAuthenticated = function() {
|
||||||
|
return !!window.localStorage.token
|
||||||
|
}
|
||||||
|
|
||||||
|
const isAdmin = function() {
|
||||||
|
return JSON.parse(window.localStorage.isAdmin)
|
||||||
|
}
|
||||||
|
|
||||||
|
//const isAdmon = window.localStorage.getItem('rol') ? true : false
|
||||||
|
|
||||||
|
/*router.beforeEach((to, from, next) => {
|
||||||
|
|
||||||
|
if (to.path !== '/login' && !isAuthenticated()) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
//console.log("Entrando");
|
||||||
|
return next({ name: 'login' })
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
|
||||||
|
if (isAuthenticated() && isAdmin() === false && to.path !== '/user') {
|
||||||
|
return next({ name: 'user' })
|
||||||
|
}
|
||||||
|
|
||||||
|
return next()
|
||||||
|
})*/
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -0,0 +1,487 @@
|
|||||||
|
<template>
|
||||||
|
<div class="container mt-5">
|
||||||
|
<b-overlay :show="page"
|
||||||
|
variant="transparent"
|
||||||
|
opacity="1"
|
||||||
|
blur="5px"
|
||||||
|
no-wrap
|
||||||
|
spinner-variant="primary"
|
||||||
|
rounded="lg"
|
||||||
|
>
|
||||||
|
</b-overlay>
|
||||||
|
|
||||||
|
<b-modal id="session" ref="" hide-footer hide-header>
|
||||||
|
<div class="d-block text-center">
|
||||||
|
<h3>La sesión ha caducado</h3>
|
||||||
|
</div>
|
||||||
|
<b-button class="mt-3" variant="primary" block @click="$router.replace('/login')">¡Llévame al login!</b-button>
|
||||||
|
</b-modal>
|
||||||
|
|
||||||
|
<div v-if="loading" class="container text-center p-5">
|
||||||
|
<b-spinner variant="primary" label="Spinning" class="m-4 p-5"></b-spinner>
|
||||||
|
</div>
|
||||||
|
<div v-else class="d-flex flex-column">
|
||||||
|
<h1 class="text-center">Agregar equipo</h1>
|
||||||
|
|
||||||
|
<h4 class="text-left container-fluid mt-4 pt-2 px-0">
|
||||||
|
Añadir equipos desde archivo excel
|
||||||
|
</h4>
|
||||||
|
<div
|
||||||
|
class="d-flex justify-content-start input-group mb-3"
|
||||||
|
>
|
||||||
|
<b-input-group-append class="py-2 sel-form-add">
|
||||||
|
|
||||||
|
<b-form-file
|
||||||
|
v-model="file"
|
||||||
|
placeholder="Seleccione un excel a cargar..."
|
||||||
|
drop-placeholder="Drop file here..."
|
||||||
|
browse-text="Seleccionar"
|
||||||
|
>
|
||||||
|
</b-form-file>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button
|
||||||
|
class="btn btn-outline-secondary"
|
||||||
|
type="button"
|
||||||
|
id="inputGroupFileAddon04"
|
||||||
|
v-on:click="cargaMasiva"
|
||||||
|
>
|
||||||
|
Subir
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</b-input-group-append>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 class="text-left mt-4">Datos generales:</h3>
|
||||||
|
|
||||||
|
<form
|
||||||
|
class="mb-5 form-add-user pl-0"
|
||||||
|
enctype="multipart/form-data"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
v-model.number="equipo.noInventario"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Número de inventario:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<input
|
||||||
|
v-model="equipo.noResguardo"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Número de resguardo:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<b-select class="py-2 my-4 sel-form-add"
|
||||||
|
v-model="equipo.idUnidadResponsable"
|
||||||
|
:options="respuesta.unidades"
|
||||||
|
value-field="idUnidadResponsable"
|
||||||
|
text-field="uResponsable">
|
||||||
|
<template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Unidad Responsable:</b-select-option>
|
||||||
|
</template>
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<b-select class="py-2 my-4 sel-form-add"
|
||||||
|
v-model="equipo.idUbicacion"
|
||||||
|
:options="respuesta.ubicaciones"
|
||||||
|
value-field="idUbicacion"
|
||||||
|
text-field="ubicacion"
|
||||||
|
>
|
||||||
|
<template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Ubicación:</b-select-option>
|
||||||
|
</template>
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<b-select class="py-2 my-4 sel-form-add"
|
||||||
|
v-model="equipo.idUso"
|
||||||
|
:options="respuesta.usos"
|
||||||
|
value-field="idUso"
|
||||||
|
text-field="uso"
|
||||||
|
>
|
||||||
|
<template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Uso:</b-select-option>
|
||||||
|
</template>
|
||||||
|
</b-select>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3>Equipo:</h3>
|
||||||
|
|
||||||
|
<form
|
||||||
|
class="mb-5 form-add-user pl-0"
|
||||||
|
enctype="multipart/form-data"
|
||||||
|
>
|
||||||
|
|
||||||
|
<b-select class="py-2 my-4 sel-form-add"
|
||||||
|
v-model="equipo.idActivoFijo"
|
||||||
|
:options="respuesta.activosFijos"
|
||||||
|
value-field="idActivoFijo"
|
||||||
|
text-field="activoFijo"
|
||||||
|
>
|
||||||
|
<template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Tipo de equipo:</b-select-option>
|
||||||
|
</template>
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<input
|
||||||
|
v-model="equipo.modelo"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Modelo:"
|
||||||
|
/>
|
||||||
|
<b-select class="py-2 my-4 sel-form-add"
|
||||||
|
v-model="equipo.idMarca"
|
||||||
|
:options="respuesta.marcas"
|
||||||
|
value-field="idMarca"
|
||||||
|
text-field="marca"
|
||||||
|
>
|
||||||
|
<template v-slot:first>
|
||||||
|
<b-select-option :value="null" disable>Marca:</b-select-option>
|
||||||
|
</template>
|
||||||
|
</b-select>
|
||||||
|
<input
|
||||||
|
v-model="equipo.noSerie"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Número de serie:"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
v-model="equipo.procesador"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Procesador:"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
v-model="equipo.vProcesador"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Velocidad del procesador en MHz:"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
v-model="equipo.hdd"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Memoria ROM en GB:"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
v-model="equipo.memoriasz"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Memoria RAM en MB:"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
v-model="equipo.memoria"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Tipo de memoria:"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
v-model="equipo.vMemoria"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Velocidad de memoria en MHz:"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
v-model="equipo.graficos"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Gráficos:"
|
||||||
|
/>
|
||||||
|
<b-select class="py-2 my-4 sel-form-add"
|
||||||
|
v-model="equipo.idOS"
|
||||||
|
:options="respuesta.distros"
|
||||||
|
value-field="idOS"
|
||||||
|
text-field="osname"
|
||||||
|
>
|
||||||
|
<template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Sistema Operativo:</b-select-option>
|
||||||
|
</template>
|
||||||
|
</b-select>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="">
|
||||||
|
<button
|
||||||
|
class="btn btn-lg btn-primary mr-4"
|
||||||
|
@click="$router.push('./user')"
|
||||||
|
>
|
||||||
|
Regresar
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-lg btn-success"
|
||||||
|
@click.prevent="addEquip()"
|
||||||
|
>
|
||||||
|
Añadir
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style="margin-top:200px; left: 0px; position: absolute;"
|
||||||
|
class="container-fluid px-0"
|
||||||
|
>
|
||||||
|
<footer id="footer" style="left: 0px;" class="text-center">
|
||||||
|
<div class="separador"></div>
|
||||||
|
<div class="contenedor-footer p-3">
|
||||||
|
<div class="text-white mt-3" style="font-size: 11px;">
|
||||||
|
<p>
|
||||||
|
Hecho en México, todos los derechos reservados 2020.
|
||||||
|
<br />
|
||||||
|
Esta página puede ser reproducida con fines no
|
||||||
|
lucrativos, siempre y cuando no se mutile, se cite
|
||||||
|
la fuente
|
||||||
|
<br />
|
||||||
|
completa y su dirección electrónica. De otra forma,
|
||||||
|
requiere permiso previo por escrito de la
|
||||||
|
institución.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Swal from 'sweetalert2';
|
||||||
|
import axios from 'axios';
|
||||||
|
import config from '../config/config';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: null,
|
||||||
|
file: null,
|
||||||
|
page: false,
|
||||||
|
equipo: {
|
||||||
|
noInventario: null,
|
||||||
|
noResguardo: null,
|
||||||
|
// nombreResponsable: null,
|
||||||
|
idUnidadResponsable: null,
|
||||||
|
idUbicacion: null,
|
||||||
|
idUso: null,
|
||||||
|
idActivoFijo: null,
|
||||||
|
modelo: null,
|
||||||
|
idMarca: null,
|
||||||
|
noSerie: null,
|
||||||
|
procesador: null,
|
||||||
|
vProcesador: null,
|
||||||
|
hdd: null,
|
||||||
|
idOS: null,
|
||||||
|
memoriasz: null,
|
||||||
|
memoria: null,
|
||||||
|
vMemoria: null,
|
||||||
|
graficos: null
|
||||||
|
},
|
||||||
|
respuesta: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getAll();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
addEquip() {
|
||||||
|
const data = this.equipo;
|
||||||
|
Swal.fire({
|
||||||
|
title: '¿Está seguro de querer añadir este equipo?',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Sí, estoy seguro',
|
||||||
|
cancelButtonText: 'Cancelar'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.value) {
|
||||||
|
axios
|
||||||
|
.post(`${config.api}/api/AddEquip`, data, {
|
||||||
|
headers: {
|
||||||
|
token: localStorage.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
Swal.fire({
|
||||||
|
title: '¡Hecho!',
|
||||||
|
text: 'Equipo agregado correctamente.',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
Object.keys(this.equipo).forEach(key => this.equipo[key] = null);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
else Swal.fire({
|
||||||
|
title: '¡Error!',
|
||||||
|
text: 'No se pudo agregar el equipo al inventario.',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getAll() {
|
||||||
|
this.loading = true;
|
||||||
|
axios
|
||||||
|
.get(`${config.api}/api/addEquip`, {
|
||||||
|
headers: {
|
||||||
|
token: localStorage.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
// console.log();
|
||||||
|
this.respuesta = res.data;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// previewFile(event) {
|
||||||
|
// this.file = event.target.files[0]
|
||||||
|
// // eslint-disable-next-line
|
||||||
|
// this.$refs.file.innerText = this.file.name
|
||||||
|
// },
|
||||||
|
cargaMasiva() {
|
||||||
|
if(!this.file)
|
||||||
|
return Swal.fire({
|
||||||
|
title: 'Primero seleccione un archivo.',
|
||||||
|
icon: 'warning',
|
||||||
|
confirmButtonText: 'Aceptar',
|
||||||
|
});
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: '¿Está seguro de querer subir nuevos equipos?',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Aceptar',
|
||||||
|
cancelButtonText: 'Cancelar',
|
||||||
|
}).then(result => {
|
||||||
|
if (result.value) {
|
||||||
|
this.page = true;
|
||||||
|
let formData = new FormData()
|
||||||
|
formData.append('equipos', this.file)
|
||||||
|
axios
|
||||||
|
.post(`${config.api}/upload/equips`, formData, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data',
|
||||||
|
token: window.localStorage.getItem('token'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.page = false;
|
||||||
|
Swal.fire({
|
||||||
|
title:
|
||||||
|
'Se cargaron los equipos correctamente',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'Aceptar',
|
||||||
|
})
|
||||||
|
// eslint-disable-next-line
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.page = false;
|
||||||
|
if (error.response) {
|
||||||
|
if(error.response.status === 500)
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Hubo un error al subir los equipos',
|
||||||
|
icon: 'warning',
|
||||||
|
confirmButtonText: 'Aceptar',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
select {
|
||||||
|
padding: 10px;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
-o-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
-ms-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
display: block;
|
||||||
|
margin: 30px 0;
|
||||||
|
padding: 10px 50px 10px 10px;
|
||||||
|
background: url('../img/select-triangleb.png') no-repeat 97% center !important;
|
||||||
|
background-color: #FFE4E1!important;
|
||||||
|
cursor: pointer;
|
||||||
|
color: black;
|
||||||
|
border-radius: 2px;
|
||||||
|
border-color: black;
|
||||||
|
background-size: 12px !important;
|
||||||
|
}
|
||||||
|
.custom-file-input:lang(es) ~ .custom-file-label::after {
|
||||||
|
content: 'Buscar';
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'] {
|
||||||
|
text-align: left;
|
||||||
|
width: 60%;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1.5px solid #000;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-add-user input[type='text']:focus {
|
||||||
|
outline-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sel-form-add {
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
bottom: 0px;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.separador {
|
||||||
|
width: 100%;
|
||||||
|
background: #2e5795;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contenedor-footer {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cont-text-foo {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
background: #1b3d70;
|
||||||
|
}
|
||||||
|
@media (max-width: 577px) {
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'],
|
||||||
|
.sel-form-add{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 578px) and (max-width: 980px) {
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'],
|
||||||
|
.sel-form-add{
|
||||||
|
width: 75%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,446 @@
|
|||||||
|
<template>
|
||||||
|
<div class="container mt-5 justify-content-center">
|
||||||
|
<b-overlay :show="page"
|
||||||
|
variant="transparent"
|
||||||
|
opacity="1"
|
||||||
|
blur="5px"
|
||||||
|
no-wrap
|
||||||
|
spinner-variant="primary"
|
||||||
|
rounded="lg"
|
||||||
|
>
|
||||||
|
</b-overlay>
|
||||||
|
|
||||||
|
<b-modal id="session" ref="" hide-footer hide-header>
|
||||||
|
<div class="d-block text-center">
|
||||||
|
<h3>La sesión ha caducado</h3>
|
||||||
|
</div>
|
||||||
|
<b-button class="mt-3" variant="primary" block @click="$router.replace('/login')">¡Llévame al login!</b-button>
|
||||||
|
</b-modal>
|
||||||
|
|
||||||
|
<div v-if="loading" class="container text-center p-5">
|
||||||
|
<b-spinner variant="primary" label="Spinning" class="m-4 p-5"></b-spinner>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="d-flex flex-column">
|
||||||
|
|
||||||
|
<h1 class="text-center">Agregar impresora</h1>
|
||||||
|
|
||||||
|
<h4 class="text-left container-fluid mt-4 pt-2 px-0">
|
||||||
|
Añadir impresoras desde archivo excel
|
||||||
|
</h4>
|
||||||
|
<div
|
||||||
|
class="d-flex justify-content-start input-group mb-3"
|
||||||
|
>
|
||||||
|
<b-input-group-append class="py-2 sel-form-add">
|
||||||
|
|
||||||
|
<b-form-file
|
||||||
|
v-model="file"
|
||||||
|
placeholder="Seleccione un excel a cargar..."
|
||||||
|
drop-placeholder="Drop file here..."
|
||||||
|
browse-text="Seleccionar"
|
||||||
|
>
|
||||||
|
</b-form-file>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button
|
||||||
|
class="btn btn-outline-secondary"
|
||||||
|
type="button"
|
||||||
|
id="inputGroupFileAddon04"
|
||||||
|
v-on:click="cargaMasiva"
|
||||||
|
>
|
||||||
|
Subir
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</b-input-group-append>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 class="text-left mt-4">Datos generales:</h3>
|
||||||
|
|
||||||
|
<form
|
||||||
|
class="mb-5 form-add-user pl-0"
|
||||||
|
enctype="multipart/form-data"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
v-model="printer.noInventario"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Número de inventario:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<input
|
||||||
|
v-model="printer.noResguardo"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Número de resguardo:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- <input
|
||||||
|
v-model=""
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Nombre del responsable:"
|
||||||
|
/> -->
|
||||||
|
|
||||||
|
<b-select class="py-2 my-4 sel-form-add"
|
||||||
|
v-model="printer.idUnidadResponsable"
|
||||||
|
:options="respuesta.unidades"
|
||||||
|
value-field="idUnidadResponsable"
|
||||||
|
text-field="uResponsable">
|
||||||
|
<template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Unidad Responsable:</b-select-option>
|
||||||
|
</template>
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<b-select class="py-2 my-4 sel-form-add"
|
||||||
|
v-model="printer.idUbicacion"
|
||||||
|
:options="respuesta.ubicaciones"
|
||||||
|
value-field="idUbicacion"
|
||||||
|
text-field="ubicacion"
|
||||||
|
>
|
||||||
|
<template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Ubicación:</b-select-option>
|
||||||
|
</template>
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<b-select class="py-2 my-4 sel-form-add"
|
||||||
|
v-model="printer.idUso"
|
||||||
|
:options="respuesta.usos"
|
||||||
|
value-field="idUso"
|
||||||
|
text-field="uso"
|
||||||
|
>
|
||||||
|
<template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Uso:</b-select-option>
|
||||||
|
</template>
|
||||||
|
</b-select>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3>Impresora</h3>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<form
|
||||||
|
class="mb-5 form-add-user pl-0"
|
||||||
|
enctype="multipart/form-data"
|
||||||
|
>
|
||||||
|
|
||||||
|
<b-select class="py-2 my-4 sel-form-add"
|
||||||
|
v-model="printer.idTipo"
|
||||||
|
:options="respuesta.tipos"
|
||||||
|
value-field="idTipo"
|
||||||
|
text-field="tipo"
|
||||||
|
>
|
||||||
|
<template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Tipo de impresora:</b-select-option>
|
||||||
|
</template>
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<b-select class="py-2 my-4 sel-form-add"
|
||||||
|
v-model="printer.idMarca"
|
||||||
|
:options="respuesta.marcas"
|
||||||
|
value-field="idMarca"
|
||||||
|
text-field="marca"
|
||||||
|
>
|
||||||
|
<template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Marca:</b-select-option>
|
||||||
|
</template>
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<input
|
||||||
|
v-model="printer.modelo"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Modelo:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<input
|
||||||
|
v-model="printer.noSerie"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Número de serie:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<b-textarea
|
||||||
|
v-model="printer.descripcion"
|
||||||
|
class="pb-2 my-4 sel-form-add"
|
||||||
|
placeholder="Descripcion adicional:"
|
||||||
|
rows="3"
|
||||||
|
no-resize
|
||||||
|
></b-textarea>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="">
|
||||||
|
<button
|
||||||
|
class="btn btn-lg btn-primary mr-4"
|
||||||
|
@click="$router.push('./user')"
|
||||||
|
>
|
||||||
|
Regresar
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-lg btn-success"
|
||||||
|
@click.prevent="addEquip()"
|
||||||
|
>
|
||||||
|
Añadir
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style="margin-top:200px; left: 0px; position: absolute;"
|
||||||
|
class="container-fluid px-0"
|
||||||
|
>
|
||||||
|
<footer id="footer" style="left: 0px;" class="text-center">
|
||||||
|
<div class="separador"></div>
|
||||||
|
<div class="contenedor-footer p-3">
|
||||||
|
<div class="text-white mt-3" style="font-size: 11px;">
|
||||||
|
<p>
|
||||||
|
Hecho en México, todos los derechos reservados 2020.
|
||||||
|
<br />
|
||||||
|
Esta página puede ser reproducida con fines no
|
||||||
|
lucrativos, siempre y cuando no se mutile, se cite
|
||||||
|
la fuente
|
||||||
|
<br />
|
||||||
|
completa y su dirección electrónica. De otra forma,
|
||||||
|
requiere permiso previo por escrito de la
|
||||||
|
institución.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Swal from 'sweetalert2'
|
||||||
|
import axios from 'axios';
|
||||||
|
import config from '../config/config';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
page: false,
|
||||||
|
file: null,
|
||||||
|
loading: true,
|
||||||
|
printer: {
|
||||||
|
noInventario: null,
|
||||||
|
noResguardo: null,
|
||||||
|
// nombreResponsable: null,
|
||||||
|
idUnidadResponsable: null,
|
||||||
|
idUbicacion: null,
|
||||||
|
idUso: null,
|
||||||
|
idTipo: null,
|
||||||
|
modelo: null,
|
||||||
|
idMarca: null,
|
||||||
|
noSerie: null,
|
||||||
|
descripcion: null
|
||||||
|
},
|
||||||
|
respuesta: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getAll();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
addEquip() {
|
||||||
|
const data = this.printer;
|
||||||
|
Swal.fire({
|
||||||
|
title: '¿Está seguro de querer añadir esta impresora?',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Sí, estoy seguro',
|
||||||
|
cancelButtonText: 'Cancelar'
|
||||||
|
})
|
||||||
|
.then((result) => {
|
||||||
|
if (result.value) {
|
||||||
|
axios
|
||||||
|
.post(`${config.api}/api/addPrinter`, data, {
|
||||||
|
headers: {
|
||||||
|
token: localStorage.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
Swal.fire({
|
||||||
|
title: '¡Hecho!',
|
||||||
|
text: 'Impresora agregada correctamente.',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
Object.keys(this.printer).forEach(key => this.printer[key] = null);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
else Swal.fire({
|
||||||
|
title: '¡Error!',
|
||||||
|
text: 'No se pudo agregar la impresora al inventario.',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getAll() {
|
||||||
|
this.loading = true;
|
||||||
|
this.respuesta = [];
|
||||||
|
axios
|
||||||
|
.get(`${config.api}/api/addPrinter`, {
|
||||||
|
headers: {
|
||||||
|
token: localStorage.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
this.respuesta = res.data;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
cargaMasiva() {
|
||||||
|
if(!this.file)
|
||||||
|
return Swal.fire({
|
||||||
|
title: 'Primero seleccione un archivo.',
|
||||||
|
icon: 'warning',
|
||||||
|
confirmButtonText: 'Aceptar',
|
||||||
|
});
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: '¿Está seguro de querer subir nuevas impresoras?',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Aceptar',
|
||||||
|
cancelButtonText: 'Cancelar',
|
||||||
|
}).then(result => {
|
||||||
|
if (result.value) {
|
||||||
|
this.page = true;
|
||||||
|
let formData = new FormData()
|
||||||
|
formData.append('printers', this.file)
|
||||||
|
axios
|
||||||
|
.post(`${config.api}/upload/printers`, formData, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data',
|
||||||
|
token: window.localStorage.getItem('token'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.page = false;
|
||||||
|
Swal.fire({
|
||||||
|
title:
|
||||||
|
'Se cargaron los equipos correctamente',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'Aceptar',
|
||||||
|
})
|
||||||
|
// eslint-disable-next-line
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.page = false;
|
||||||
|
if (error.response) {
|
||||||
|
if(error.response.status === 500)
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Hubo un error al subir las impresoras',
|
||||||
|
icon: 'warning',
|
||||||
|
confirmButtonText: 'Aceptar',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
select {
|
||||||
|
padding: 10px;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
-o-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
-ms-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
display: block;
|
||||||
|
margin: 30px 0;
|
||||||
|
padding: 10px 50px 10px 10px;
|
||||||
|
background: url('../img/select-triangleb.png') no-repeat 97% center !important;
|
||||||
|
background-color: #FFE4E1!important;
|
||||||
|
cursor: pointer;
|
||||||
|
color: black;
|
||||||
|
border-radius: 2px;
|
||||||
|
border-color: black;
|
||||||
|
background-size: 12px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'] {
|
||||||
|
text-align: left;
|
||||||
|
width: 60%;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1.5px solid #000;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-add-user input[type='text']:focus {
|
||||||
|
outline-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sel-form-add {
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
bottom: 0px;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-file-input:lang(es) ~ .custom-file-label::after {
|
||||||
|
content: 'Buscar';
|
||||||
|
}
|
||||||
|
|
||||||
|
.separador {
|
||||||
|
width: 100%;
|
||||||
|
background: #2e5795;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contenedor-footer {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cont-text-foo {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
background: #1b3d70;
|
||||||
|
}
|
||||||
|
@media (max-width: 577px) {
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'],
|
||||||
|
.sel-form-add{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 578px) and (max-width: 980px) {
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'],
|
||||||
|
.sel-form-add{
|
||||||
|
width: 75%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
<template>
|
||||||
|
<div class="container cont-log-things">
|
||||||
|
<h1 class="serv-title text-center">Sistema de censo</h1>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="input-group mb-3 col-12 col-sm-9 col-md-8 col-lg-5 my-4 mx-auto"
|
||||||
|
>
|
||||||
|
<div class="input-group-prepend px-auto gp-inp">
|
||||||
|
<span class="input-group-text icon-login-form pl-3 pr-0">
|
||||||
|
<font-awesome-icon icon="user" class="user-icon-input" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="email"
|
||||||
|
v-on:keyup.enter="onLogin()"
|
||||||
|
v-model="name"
|
||||||
|
class="form-control input-login-form shadow-none py-4"
|
||||||
|
placeholder="Usuario"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 col-12 col-sm-9 col-md-8 col-lg-5 my-auto mx-auto">
|
||||||
|
|
||||||
|
<div class="input-group-prepend px-auto gp-inp">
|
||||||
|
<span class="input-group-text icon-login-form pl-3 pr-0">
|
||||||
|
<font-awesome-icon icon="lock" class="user-icon-input" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
v-on:keyup.enter="onLogin()"
|
||||||
|
v-model="password"
|
||||||
|
class="form-control input-login-form shadow-none py-4"
|
||||||
|
placeholder="Contraseña"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
<button
|
||||||
|
v-on:click="onLogin()"
|
||||||
|
class="btn btn-success btn-login mt-4"
|
||||||
|
>
|
||||||
|
Iniciar Sesión
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="alert alert-danger mt-4 mx-auto text-center"
|
||||||
|
style="display: none; width:80%"
|
||||||
|
id="alertErr"
|
||||||
|
role="alert"
|
||||||
|
>
|
||||||
|
Usuario o contraseña incorrectos.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import config from "../config/config";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
name: '',
|
||||||
|
password: '',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onLogin() {
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
name: this.name,
|
||||||
|
password: this.password,
|
||||||
|
}
|
||||||
|
|
||||||
|
axios
|
||||||
|
.post(`${config.api}/login`, data)
|
||||||
|
.then(res => {
|
||||||
|
if (res.status == 200) {
|
||||||
|
|
||||||
|
localStorage.setItem('isAdmin', (res.data.user.isAdmin));
|
||||||
|
localStorage.setItem('token', res.data.token);
|
||||||
|
localStorage.setItem('user', res.data.user.userName);
|
||||||
|
localStorage.setItem(
|
||||||
|
'idAdmin',
|
||||||
|
res.data.user.idAdmin
|
||||||
|
);
|
||||||
|
this.$router.replace('/user');
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function(err) {
|
||||||
|
var alertErr = document.getElementById('alertErr')
|
||||||
|
alertErr.style.display = 'block'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.btn-login {
|
||||||
|
width: 170px;
|
||||||
|
height: 45px;
|
||||||
|
}
|
||||||
|
.input-login-form {
|
||||||
|
border: 0;
|
||||||
|
border-top: 1px solid #bdbdbd;
|
||||||
|
border-right: 1px solid #bdbdbd;
|
||||||
|
border-bottom: 1px solid #bdbdbd;
|
||||||
|
height: 40px;
|
||||||
|
padding-left: 10px;
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-login-form {
|
||||||
|
border: 0;
|
||||||
|
border-top: 1px solid #bdbdbd;
|
||||||
|
border-left: 1px solid #bdbdbd;
|
||||||
|
border-bottom: 1px solid #bdbdbd;
|
||||||
|
width: 40px;
|
||||||
|
background-color: #fff;
|
||||||
|
color: #bdbdbd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cont-log-things {
|
||||||
|
padding: 30px;
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
@media (max-width: 350px) {
|
||||||
|
.serv-title text-center {
|
||||||
|
font-size: 25px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,489 @@
|
|||||||
|
<template>
|
||||||
|
<div class="container mt-5">
|
||||||
|
|
||||||
|
<b-modal id="session" ref="" hide-footer hide-header>
|
||||||
|
<div class="d-block text-center">
|
||||||
|
<h3>La sesión ha caducado</h3>
|
||||||
|
</div>
|
||||||
|
<b-button class="mt-3" variant="primary" block @click="$router.replace('/login')">¡Llévame al login!</b-button>
|
||||||
|
</b-modal>
|
||||||
|
|
||||||
|
<b-modal id="status" ref="" hide-footer hide-header>
|
||||||
|
<div class="d-block text-center">
|
||||||
|
<h3>Error.</h3>
|
||||||
|
<br>
|
||||||
|
<h6>Regrese y seleccione una fila para editar los campos.</h6>
|
||||||
|
</div>
|
||||||
|
<b-button class="mt-3" variant="primary" block @click="$router.replace('/user')">Regresar al inicio.</b-button>
|
||||||
|
</b-modal>
|
||||||
|
|
||||||
|
<div v-if="loading" class="container text-center p-5">
|
||||||
|
<b-spinner variant="primary" label="Spinning" class="m-4 p-5"></b-spinner>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="d-flex flex-column">
|
||||||
|
<h1 class="text-center">Editar información del equipo</h1>
|
||||||
|
|
||||||
|
<h3 class="text-left mt-4 mb-5">Datos generales:</h3>
|
||||||
|
|
||||||
|
<form
|
||||||
|
class="mb-5 form-add-user pl-0"
|
||||||
|
enctype="multipart/form-data"
|
||||||
|
>
|
||||||
|
<h6 class="mb-3"> Numero de inventario:</h6>
|
||||||
|
<input
|
||||||
|
v-model="noInventarioAdd"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h6 class="mb-3"> Numero de resguardo:</h6>
|
||||||
|
<input
|
||||||
|
v-model="equipo.noResguardo"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- <input
|
||||||
|
v-model="equipo."
|
||||||
|
type="text"
|
||||||
|
class="pb-2 my-4"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/> -->
|
||||||
|
|
||||||
|
<h6 class="mb-3"> Unidad responsable:</h6>
|
||||||
|
<b-select class="py-2 mb-5 sel-form-add mt-0"
|
||||||
|
v-model="equipo.idUnidadResponsable"
|
||||||
|
:options="respuesta.unidades"
|
||||||
|
value-field="idUnidadResponsable"
|
||||||
|
text-field="uResponsable">
|
||||||
|
<!-- <template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Unidad Responsable:</b-select-option>
|
||||||
|
</template> -->
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<h6 class="mb-3"> Ubicación:</h6>
|
||||||
|
<b-select class="py-2 mb-5 sel-form-add mt-0"
|
||||||
|
v-model="equipo.idUbicacion"
|
||||||
|
:options="respuesta.ubicaciones"
|
||||||
|
value-field="idUbicacion"
|
||||||
|
text-field="ubicacion"
|
||||||
|
>
|
||||||
|
<!-- <template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Ubicación:</b-select-option>
|
||||||
|
</template> -->
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<h6 class="mb-3"> Uso:</h6>
|
||||||
|
<b-select class="py-2 mb-3 sel-form-add mt-0"
|
||||||
|
v-model="equipo.idUso"
|
||||||
|
:options="respuesta.usos"
|
||||||
|
value-field="idUso"
|
||||||
|
text-field="uso"
|
||||||
|
>
|
||||||
|
<!-- <template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Uso:</b-select-option>
|
||||||
|
</template> -->
|
||||||
|
</b-select>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3 class="mb-5">Equipo:</h3>
|
||||||
|
|
||||||
|
<form
|
||||||
|
class="mb-5 form-add-user pl-0"
|
||||||
|
enctype="multipart/form-data"
|
||||||
|
>
|
||||||
|
<h6 class="mb-3"> Tipo de equipo:</h6>
|
||||||
|
<b-select class="py-2 mb-5 sel-form-add mt-0"
|
||||||
|
v-model="equipo.idActivoFijo"
|
||||||
|
:options="respuesta.activosFijos"
|
||||||
|
value-field="idActivoFijo"
|
||||||
|
text-field="activoFijo"
|
||||||
|
>
|
||||||
|
<!-- <template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Tipo de equipo:</b-select-option>
|
||||||
|
</template> -->
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<h6 class="mb-3"> Modelo:</h6>
|
||||||
|
<input
|
||||||
|
v-model="equipo.modelo"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h6 class="mb-3"> Marca:</h6>
|
||||||
|
<b-select class="py-2 mb-5 sel-form-add mt-0"
|
||||||
|
v-model="equipo.idMarca"
|
||||||
|
:options="respuesta.marcas"
|
||||||
|
value-field="idMarca"
|
||||||
|
text-field="marca"
|
||||||
|
>
|
||||||
|
<!-- <template v-slot:first>
|
||||||
|
<b-select-option :value="null" disable>Marca:</b-select-option>
|
||||||
|
</template> -->
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<h6 class="mb-3"> Número de serie:</h6>
|
||||||
|
<input
|
||||||
|
v-model="equipo.noSerie"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h6 class="mb-3"> Procesador:</h6>
|
||||||
|
<input
|
||||||
|
v-model="equipo.procesador"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
<h6 class="mb-3"> Velocidad del procesador en MHz:</h6>
|
||||||
|
<input
|
||||||
|
v-model="equipo.vProcesador"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
<h6 class="mb-3"> Memoria ROM en GB:</h6>
|
||||||
|
<input
|
||||||
|
v-model="equipo.hdd"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
<h6 class="mb-3"> Memoria RAM en MB:</h6>
|
||||||
|
<input
|
||||||
|
v-model="equipo.memoriasz"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
<h6 class="mb-3"> Tipo de memoria:</h6>
|
||||||
|
<input
|
||||||
|
v-model="equipo.memoria"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
<h6 class="mb-3"> Velocidad de memoria en MHz:</h6>
|
||||||
|
<input
|
||||||
|
v-model="equipo.vMemoria"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
<h6 class="mb-3"> Gráficos:</h6>
|
||||||
|
<input
|
||||||
|
v-model="equipo.graficos"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
<h6 class="mb-3"> Sistema operativo:</h6>
|
||||||
|
<b-select class="py-2 mb-5 sel-form-add mt-0"
|
||||||
|
v-model="equipo.idOS"
|
||||||
|
:options="respuesta.distros"
|
||||||
|
value-field="idOS"
|
||||||
|
text-field="osname"
|
||||||
|
>
|
||||||
|
<!-- <template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Sistema Operativo:</b-select-option>
|
||||||
|
</template> -->
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="">
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="btn btn-lg btn-primary"
|
||||||
|
@click="$router.push('./user')"
|
||||||
|
>
|
||||||
|
Regresar
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-lg btn-danger mx-3"
|
||||||
|
@click.prevent="deleteEquip(equipo.noInventario)"
|
||||||
|
>
|
||||||
|
Eliminar
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-lg btn-success mt-3 mt-sm-0"
|
||||||
|
@click.prevent="saveChanges()"
|
||||||
|
>
|
||||||
|
Guardar cambios
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style="margin-top:200px; left: 0px; position: absolute;"
|
||||||
|
class="container-fluid px-0"
|
||||||
|
>
|
||||||
|
<footer id="footer" style="left: 0px;" class="text-center">
|
||||||
|
<div class="separador"></div>
|
||||||
|
<div class="contenedor-footer p-3">
|
||||||
|
<div class="text-white mt-3" style="font-size: 11px;">
|
||||||
|
<p>
|
||||||
|
Hecho en México, todos los derechos reservados 2020.
|
||||||
|
<br />
|
||||||
|
Esta página puede ser reproducida con fines no
|
||||||
|
lucrativos, siempre y cuando no se mutile, se cite
|
||||||
|
la fuente
|
||||||
|
<br />
|
||||||
|
completa y su dirección electrónica. De otra forma,
|
||||||
|
requiere permiso previo por escrito de la
|
||||||
|
institución.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Swal from 'sweetalert2'
|
||||||
|
import axios from 'axios'
|
||||||
|
import config from '../config/config'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: true,
|
||||||
|
status: null,
|
||||||
|
equipo: {},
|
||||||
|
respuesta: {},
|
||||||
|
noInventarioAdd: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getEquipo();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getEquipo(){
|
||||||
|
const params = { noInventario: localStorage.noInventario };
|
||||||
|
this.loading = true;
|
||||||
|
axios
|
||||||
|
.get(`${config.api}/api/updateEquip`, {
|
||||||
|
params,
|
||||||
|
headers: {
|
||||||
|
token: localStorage.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then( res => {
|
||||||
|
this.equipo = res.data.equipo[0];
|
||||||
|
this.noInventarioAdd = this.equipo.noInventario;
|
||||||
|
this.getAll();
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
if(error.response.status === 500)
|
||||||
|
this.$bvModal.show('status');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getAll() {
|
||||||
|
this.loading = true;
|
||||||
|
axios
|
||||||
|
.get(`${config.api}/api/addEquip`, {
|
||||||
|
headers: {
|
||||||
|
token: localStorage.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
this.respuesta = res.data;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
saveChanges() {
|
||||||
|
Swal.fire({
|
||||||
|
title: '¿Está seguro de querer guardar los cambios?',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Sí, estoy seguro',
|
||||||
|
cancelButtonText: 'Cancelar'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.value) {
|
||||||
|
this.equipo.noInventarioAdd = this.noInventarioAdd;
|
||||||
|
axios
|
||||||
|
.put(`${ config.api }/api/updateEquip`, this.equipo, {
|
||||||
|
headers: {
|
||||||
|
token: localStorage.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
Swal.fire({
|
||||||
|
title: '¡Hecho!',
|
||||||
|
text: 'Equipo actualizado con éxito.',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
else Swal.fire({
|
||||||
|
title: '¡Error!',
|
||||||
|
text: 'No se pudo actualizar el equipo en el inventario.',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deleteEquip(noInventario) {
|
||||||
|
Swal.fire({
|
||||||
|
title: '¿Está seguro de querer eliminar este equipo?',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Sí, estoy seguro',
|
||||||
|
cancelButtonText: 'Cancelar'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.value) {
|
||||||
|
axios({
|
||||||
|
baseURL: `${ config.api }/api/updateEquip`,
|
||||||
|
method: 'delete',
|
||||||
|
headers: { token: localStorage.token },
|
||||||
|
data: { noInventario }
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
Swal.fire({
|
||||||
|
title: '¡Hecho!',
|
||||||
|
text: 'Equipo eliminado con éxito.',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
localStorage.removeItem('noInventario');
|
||||||
|
this.$router.replace('/user');
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
else Swal.fire({
|
||||||
|
title: '¡Error!',
|
||||||
|
text: 'No se pudo eliminar el equipo en el inventario.',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.p-text-sty {
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
input[type='text'] {
|
||||||
|
color: grey;
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
padding: 10px;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
-o-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
-ms-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
display: block;
|
||||||
|
margin: 30px 0;
|
||||||
|
padding: 10px 50px 10px 10px;
|
||||||
|
background: url('../img/select-triangleb.png') no-repeat 97% center !important;
|
||||||
|
/* background-color: #5c9cd8 !important; */
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #FFE4E1!important;
|
||||||
|
color: black;
|
||||||
|
border-radius: 2px;
|
||||||
|
border-color: black;
|
||||||
|
background-size: 12px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'] {
|
||||||
|
text-align: left;
|
||||||
|
width: 60%;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1.5px solid #000;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-add-user input[type='text']:focus {
|
||||||
|
outline-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sel-form-add {
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sel-form-add option {
|
||||||
|
|
||||||
|
}
|
||||||
|
/* .sel-form-add > option{
|
||||||
|
background-color: black!important;
|
||||||
|
} */
|
||||||
|
#footer {
|
||||||
|
bottom: 0px;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.separador {
|
||||||
|
width: 100%;
|
||||||
|
background: #2e5795;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contenedor-footer {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cont-text-foo {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
background: #1b3d70;
|
||||||
|
}
|
||||||
|
@media (max-width: 577px) {
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'],
|
||||||
|
.sel-form-add{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 578px) and (max-width: 980px) {
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'],
|
||||||
|
.sel-form-add{
|
||||||
|
width: 75%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,431 @@
|
|||||||
|
<template>
|
||||||
|
<div class="container mt-5">
|
||||||
|
|
||||||
|
<b-modal id="session" ref="" hide-footer hide-header>
|
||||||
|
<div class="d-block text-center">
|
||||||
|
<h3>La sesión ha caducado</h3>
|
||||||
|
</div>
|
||||||
|
<b-button class="mt-3" variant="primary" block @click="$router.replace('/login')">¡Llévame al login!</b-button>
|
||||||
|
</b-modal>
|
||||||
|
|
||||||
|
<b-modal id="status" ref="" hide-footer hide-header>
|
||||||
|
<div class="d-block text-center">
|
||||||
|
<h3>Error.</h3>
|
||||||
|
<br>
|
||||||
|
<h6>Regrese y seleccione una fila para editar los campos.</h6>
|
||||||
|
</div>
|
||||||
|
<b-button class="mt-3" variant="primary" block @click="$router.replace('/user')">Regresar al inicio.</b-button>
|
||||||
|
</b-modal>
|
||||||
|
|
||||||
|
<div v-if="loading" class="container text-center p-5">
|
||||||
|
<b-spinner variant="primary" label="Spinning" class="m-4 p-5"></b-spinner>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="d-flex flex-column">
|
||||||
|
<h1 class="text-center">Editar información la impresora</h1>
|
||||||
|
|
||||||
|
<h3 class="text-left mt-4 mb-5">Datos generales:</h3>
|
||||||
|
|
||||||
|
<form
|
||||||
|
class="mb-5 form-add-user pl-0"
|
||||||
|
enctype="multipart/form-data"
|
||||||
|
>
|
||||||
|
<h6>Número de inventario:</h6>
|
||||||
|
<input
|
||||||
|
v-model="noInventarioAdd"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h6>Número de resguardo:</h6>
|
||||||
|
<input
|
||||||
|
v-model="printer.noResguardo"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- <input
|
||||||
|
v-model="equipo."
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/> -->
|
||||||
|
|
||||||
|
<h6 class="mb-3">Unidad Responsable:</h6>
|
||||||
|
<b-select class="py-2 mb-5 sel-form-add mt-0"
|
||||||
|
v-model="printer.idUnidadResponsable"
|
||||||
|
:options="respuesta.unidades"
|
||||||
|
value-field="idUnidadResponsable"
|
||||||
|
text-field="uResponsable">
|
||||||
|
<!-- <template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Unidad Responsable:</b-select-option>
|
||||||
|
</template> -->
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<h6 class="mb-3">Ubicación:</h6>
|
||||||
|
<b-select class="py-2 mb-5 sel-form-add mt-0"
|
||||||
|
v-model="printer.idUbicacion"
|
||||||
|
:options="respuesta.ubicaciones"
|
||||||
|
value-field="idUbicacion"
|
||||||
|
text-field="ubicacion"
|
||||||
|
>
|
||||||
|
<!-- <template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Ubicación:</b-select-option>
|
||||||
|
</template> -->
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<h6 class="mb-3">Uso:</h6>
|
||||||
|
<b-select class="py-2 mb-0 sel-form-add mt-0"
|
||||||
|
v-model="printer.idUso"
|
||||||
|
:options="respuesta.usos"
|
||||||
|
value-field="idUso"
|
||||||
|
text-field="uso"
|
||||||
|
>
|
||||||
|
<!-- <template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Uso:</b-select-option>
|
||||||
|
</template> -->
|
||||||
|
</b-select>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3 class="mt-3">Impresora:</h3>
|
||||||
|
|
||||||
|
<form
|
||||||
|
class="my-5 form-add-user pl-0"
|
||||||
|
enctype="multipart/form-data"
|
||||||
|
>
|
||||||
|
<h6 class="mb-3">Tipo de impresora:</h6>
|
||||||
|
<b-select class="py-2 mb-5 sel-form-add mt-0"
|
||||||
|
v-model="printer.idTipo"
|
||||||
|
:options="respuesta.tipos"
|
||||||
|
value-field="idTipo"
|
||||||
|
text-field="tipo"
|
||||||
|
>
|
||||||
|
<!-- <template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Tipo de impresora:</b-select-option>
|
||||||
|
</template> -->
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<h6 class="mb-3">Marca:</h6>
|
||||||
|
<b-select class="py-2 mb-5 sel-form-add mt-0"
|
||||||
|
v-model="printer.idMarca"
|
||||||
|
:options="respuesta.marcas"
|
||||||
|
value-field="idMarca"
|
||||||
|
text-field="marca"
|
||||||
|
>
|
||||||
|
<!-- <template v-slot:first>
|
||||||
|
<b-select-option :value="null" disabled>Marca:</b-select-option>
|
||||||
|
</template> -->
|
||||||
|
</b-select>
|
||||||
|
|
||||||
|
<h6>Modelo:</h6>
|
||||||
|
<input
|
||||||
|
v-model="printer.modelo"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h6>Número de serie:</h6>
|
||||||
|
<input
|
||||||
|
v-model="printer.noSerie"
|
||||||
|
type="text"
|
||||||
|
class="pb-2 mb-5"
|
||||||
|
placeholder="Introduzca el campo nuevo:"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h6 class="mb-3">Descripcion adicional:</h6>
|
||||||
|
<b-textarea
|
||||||
|
v-model="printer.descripcion"
|
||||||
|
class="pb-2 mb-5 sel-form-add"
|
||||||
|
placeholder="Introduzca la descripción nueva:"
|
||||||
|
rows="3"
|
||||||
|
no-resize
|
||||||
|
></b-textarea>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="">
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="btn btn-lg btn-primary"
|
||||||
|
@click="$router.push('./user')"
|
||||||
|
>
|
||||||
|
Regresar
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-lg btn-danger mx-3"
|
||||||
|
@click.prevent="deletePrinter(printer.noInventario)"
|
||||||
|
>
|
||||||
|
Eliminar
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-lg btn-success mt-3 mt-sm-0"
|
||||||
|
@click.prevent="saveChanges()"
|
||||||
|
>
|
||||||
|
Guardar cambios
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style="margin-top:200px; left: 0px; position: absolute;"
|
||||||
|
class="container-fluid px-0"
|
||||||
|
>
|
||||||
|
<footer id="footer" style="left: 0px;" class="text-center">
|
||||||
|
<div class="separador"></div>
|
||||||
|
<div class="contenedor-footer p-3">
|
||||||
|
<div class="text-white mt-3" style="font-size: 11px;">
|
||||||
|
<p>
|
||||||
|
Hecho en México, todos los derechos reservados 2020.
|
||||||
|
<br />
|
||||||
|
Esta página puede ser reproducida con fines no
|
||||||
|
lucrativos, siempre y cuando no se mutile, se cite
|
||||||
|
la fuente
|
||||||
|
<br />
|
||||||
|
completa y su dirección electrónica. De otra forma,
|
||||||
|
requiere permiso previo por escrito de la
|
||||||
|
institución.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Swal from 'sweetalert2'
|
||||||
|
import axios from 'axios'
|
||||||
|
import config from '../config/config'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: true,
|
||||||
|
status: null,
|
||||||
|
printer: {},
|
||||||
|
respuesta: {},
|
||||||
|
noInventarioAdd: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getPrinter();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getPrinter(){
|
||||||
|
const params = { noInventario: localStorage.noInventario };
|
||||||
|
this.loading = true;
|
||||||
|
axios
|
||||||
|
.get(`${config.api}/api/updatePrinter`, {
|
||||||
|
params,
|
||||||
|
headers: {
|
||||||
|
token: localStorage.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then( res => {
|
||||||
|
this.printer = res.data.printer[0];
|
||||||
|
this.noInventarioAdd = this.printer.noInventario;
|
||||||
|
this.getAll();
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
if(error.response.status === 500)
|
||||||
|
this.$bvModal.show('status');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getAll() {
|
||||||
|
this.loading = true;
|
||||||
|
axios
|
||||||
|
.get(`${config.api}/api/addPrinter`, {
|
||||||
|
headers: {
|
||||||
|
token: localStorage.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
this.respuesta = res.data;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
saveChanges() {
|
||||||
|
Swal.fire({
|
||||||
|
title: '¿Está seguro de querer guardar los cambios?',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Sí, estoy seguro',
|
||||||
|
cancelButtonText: 'Cancelar'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.value) {
|
||||||
|
this.printer.noInventarioAdd = this.noInventarioAdd;
|
||||||
|
axios
|
||||||
|
.put(`${ config.api }/api/updatePrinter`, this.printer, {
|
||||||
|
headers: {
|
||||||
|
token: localStorage.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
Swal.fire({
|
||||||
|
title: '¡Hecho!',
|
||||||
|
text: 'Impresora actualizada con éxito.',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
else Swal.fire({
|
||||||
|
title: '¡Error!',
|
||||||
|
text: 'No se pudo actualizar la impresora en el inventario.',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deletePrinter(noInventario) {
|
||||||
|
Swal.fire({
|
||||||
|
title: '¿Está seguro de querer eliminar esta impresora?',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Sí, estoy seguro',
|
||||||
|
cancelButtonText: 'Cancelar'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.value) {
|
||||||
|
axios({
|
||||||
|
baseURL: `${ config.api }/api/updatePrinter`,
|
||||||
|
method: 'delete',
|
||||||
|
headers: { token: localStorage.token },
|
||||||
|
data: { noInventario }
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
Swal.fire({
|
||||||
|
title: '¡Hecho!',
|
||||||
|
text: 'Impresora eliminada con éxito.',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
localStorage.removeItem('noInventario');
|
||||||
|
this.$router.replace('/user');
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
this.$bvModal.show('session');
|
||||||
|
}
|
||||||
|
else Swal.fire({
|
||||||
|
title: '¡Error!',
|
||||||
|
text: 'No se pudo actualizar la impresora en el inventario.',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
input[type='text'] {
|
||||||
|
color: grey;
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
padding: 10px;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
-o-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
-ms-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
display: block;
|
||||||
|
margin: 30px 0;
|
||||||
|
padding: 10px 50px 10px 10px;
|
||||||
|
background: url('../img/select-triangleb.png') no-repeat 97% center !important;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #FFE4E1!important;
|
||||||
|
color: black;
|
||||||
|
border-radius: 2px;
|
||||||
|
border-color: black;
|
||||||
|
background-size: 12px !important;
|
||||||
|
}
|
||||||
|
select option:hover {
|
||||||
|
background-color: yellow!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'] {
|
||||||
|
text-align: left;
|
||||||
|
width: 60%;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1.5px solid #000;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-add-user input[type='text']:focus {
|
||||||
|
outline-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sel-form-add {
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
bottom: 0px;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.separador {
|
||||||
|
width: 100%;
|
||||||
|
background: #2e5795;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contenedor-footer {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cont-text-foo {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
background: #1b3d70;
|
||||||
|
}
|
||||||
|
@media (max-width: 577px) {
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'],
|
||||||
|
.sel-form-add{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 578px) and (max-width: 980px) {
|
||||||
|
.form-add-user input[type='text'],
|
||||||
|
.form-add-user input[type='email'],
|
||||||
|
.form-add-user input[type='date'],
|
||||||
|
.sel-form-add{
|
||||||
|
width: 75%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,621 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<b-modal id="session" ref="" hide-footer hide-header>
|
||||||
|
<div class="d-block text-center">
|
||||||
|
<h3>La sesión ha caducado</h3>
|
||||||
|
</div>
|
||||||
|
<b-button class="mt-3" variant="primary" block @click="$router.replace('/login')">¡Llévame al login!</b-button>
|
||||||
|
</b-modal>
|
||||||
|
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="justify-content-center d-flex">
|
||||||
|
<h1 class="justify-content-center">Sistema de censo</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button @click="changeView()" class="btn btn-info mt-4">
|
||||||
|
<span v-if="pcView">Ver impresoras</span>
|
||||||
|
<span v-else>Ver computadoras</span>
|
||||||
|
</button>
|
||||||
|
<div class="my-3">Se observan {{ datosmios.length }} registros de un total de {{ respuesta.length }}</div>
|
||||||
|
<div class="row m-0 mt-1 mb-4">
|
||||||
|
<div class="row d-flex flex-wrap">
|
||||||
|
<div class="input-group pl-3 col-12 col-md-4">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text" id="basic-addon1">
|
||||||
|
<font-awesome-icon icon="search" class="user-icon-input" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="Inventario"
|
||||||
|
v-on:keyup="extraeInventario()"
|
||||||
|
class="form-control input-login-form shadow-none"
|
||||||
|
placeholder="Número de inventario ó de serie"
|
||||||
|
/> <!-- https://www.tutorialesprogramacionya.com/vueya/detalleconcepto.php?punto=7&codigo=7&inicio=0 -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex flex-wrap my-1">
|
||||||
|
<div class="col-md-2 col-12 mt-3" v-show="pcView">
|
||||||
|
<select
|
||||||
|
name="tipo"
|
||||||
|
id="tipo"
|
||||||
|
@change="buscaValor()"
|
||||||
|
class="form-control select-login-form shadow-none">
|
||||||
|
<option value="Todos" selected>Tipo</option>
|
||||||
|
<option v-for="opcion1 in tipo" :key="opcion1.idActivoFijo" :value='opcion1.activoFijo'>{{opcion1.activoFijo}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2 col-12 mt-3" v-show="!pcView">
|
||||||
|
<select
|
||||||
|
name="tipo"
|
||||||
|
id="tipo"
|
||||||
|
@change="buscaValor()"
|
||||||
|
class="form-control select-login-form shadow-none">
|
||||||
|
<option value="Todos" selected>Tipo</option>
|
||||||
|
<option v-for="opcion in tipoPrinters" :key="opcion.tipo" :value='opcion.tipo'>{{opcion.tipo}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2 col-12 mt-3">
|
||||||
|
<select name="Ubica" id="Ubica"
|
||||||
|
@change="buscaUbica()"
|
||||||
|
class="form-control select-login-form shadow-none">
|
||||||
|
<option value="Todos" selected>Ubicación</option>
|
||||||
|
<option v-for="opcion in Ubica" :key="opcion.ubicacion" :value='opcion.ubicacion'>{{opcion.ubicacion}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2 col-12 mt-3" v-show="pcView">
|
||||||
|
<select name="Procesador" id="Procesador"
|
||||||
|
@change="buscaProcesador()"
|
||||||
|
class="form-control select-login-form shadow-none">
|
||||||
|
<option value="Todos" selected>Procesador</option>
|
||||||
|
<option v-for="opcion in procesa" :key="opcion.procesa" :value='opcion.procesa'>{{opcion.procesa}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2 col-12 mt-3" v-show="pcView">
|
||||||
|
<select name="SisOper" id="SisOper"
|
||||||
|
@change="buscaSisOper()"
|
||||||
|
class="form-control select-login-form shadow-none">
|
||||||
|
<option value="Todos" selected>Sistema Operativo</option>
|
||||||
|
<option v-for="opcion in os" :key="opcion.osname" :value='opcion.osname'>{{opcion.osname}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2 col-12 mt-3">
|
||||||
|
<select name="Uso" id="Uso"
|
||||||
|
@change="buscaUso()"
|
||||||
|
class="form-control select-login-form shadow-none">
|
||||||
|
<option value="Todos" selected>Uso</option>
|
||||||
|
<option v-for="opcion in uso" :key="opcion.uso" :value='opcion.uso'>{{opcion.uso}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="pcView" class="table-responsive table-fixed text-nowrap justify-content-md-center"
|
||||||
|
style="max-height: 350px;">
|
||||||
|
<table :class="['table', 'table-sm', 'text-center', { 'table-hover': admin(), 't-hov': admin() }]" style="font-size:14px">
|
||||||
|
<thead class="thead-light text-uppercase">
|
||||||
|
<tr>
|
||||||
|
<th v-for="pcHead in pcHeads" :key="pcHead" class="sticky-top">{{ pcHead }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<!-- <tbody class="overflow-auto thov" v-for="item in respuesta" :key="item.noInventario">
|
||||||
|
<tr @click="watchRow(item.noInventario)">
|
||||||
|
<td class="text-primary">{{ item.noInventario }}</td> -->
|
||||||
|
|
||||||
|
<!-- <tbody class="overflow-auto thov" v-for="item in respuesta" :key="item.noInventario">
|
||||||
|
<tr @click="watchRow(item.noInventario)"
|
||||||
|
v-if="(seleccionado == item.activoFijo || seleccionado == '0') -->
|
||||||
|
<tbody class="overflow-auto thov" v-for="item in datosmios" :key="item.noInventario">
|
||||||
|
<tr @click="watchRow(item.noInventario)" >
|
||||||
|
<!-- https://developer.mozilla.org/es/docs/Learn/JavaScript/First_steps/Useful_string_methods -->
|
||||||
|
<td class="text-primary">{{ item.noInventario }}</td>
|
||||||
|
<td>{{ item.activoFijo }}</td>
|
||||||
|
<td>{{ item.modelo }}</td>
|
||||||
|
<td>{{ item.marca }}</td>
|
||||||
|
<td>{{ item.noSerie }}</td>
|
||||||
|
<td>{{ item.procesador }}</td>
|
||||||
|
<td>{{ item.vProcesador }}</td>
|
||||||
|
<td>{{ item.hdd }}</td>
|
||||||
|
<td>{{ item.memoriasz }}</td>
|
||||||
|
<td>{{ item.memoria }}</td>
|
||||||
|
<td>{{ item.vMemoria }}</td>
|
||||||
|
<td>{{ item.graficos }}</td>
|
||||||
|
<td>{{ item.osname }}</td>
|
||||||
|
<td>{{ item.noResguardo }}</td>
|
||||||
|
<td>{{ item.uResponsable }}</td>
|
||||||
|
<td>{{ item.nombreResponsable }}</td>
|
||||||
|
<td>{{ item.ubicacion }}</td>
|
||||||
|
<td>{{ item.uso }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
<div class="text-center">
|
||||||
|
<b-spinner variant="primary" label="Spinning" v-if="loading"></b-spinner>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="table-responsive table-fixed text-nowrap justify-content-md-center"
|
||||||
|
id="myTableStyle">
|
||||||
|
<table :class="['table', 'table-sm', 'text-center', { 't-hov': admin(), 'table-hover': admin()}]">
|
||||||
|
<thead class="thead-light text-uppercase">
|
||||||
|
<tr>
|
||||||
|
<th v-for="printerHead in printerHeads" :key="printerHead" class="sticky-top">{{ printerHead }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<!-- <tbody v-for="item in respuesta" :key="item.noInventario">
|
||||||
|
<tr @click="watchRow(item.noInventario)"> -->
|
||||||
|
|
||||||
|
<!-- <tbody v-for="item in respuesta" :key="item.noInventario">
|
||||||
|
<tr @click="watchRow(item.noInventario)" v-if="seleccionado == item.tipo || seleccionado == '0'"> -->
|
||||||
|
|
||||||
|
<tbody v-for="item in datosmios" :key="item.noInventario">
|
||||||
|
<tr @click="watchRow(item.noInventario)"
|
||||||
|
>
|
||||||
|
<!-- https://developer.mozilla.org/es/docs/Learn/JavaScript/First_steps/Useful_string_methods -->
|
||||||
|
<td class="text-primary">{{ item.noInventario }}</td>
|
||||||
|
<td>{{ item.tipo }}</td>
|
||||||
|
<td>{{ item.modelo }}</td>
|
||||||
|
<td>{{ item.marca }}</td>
|
||||||
|
<td>{{ item.noSerie }}</td>
|
||||||
|
<td>{{ item.descripcion }}</td>
|
||||||
|
<td>{{ item.noResguardo }}</td>
|
||||||
|
<td>{{ item.uResponsable }}</td>
|
||||||
|
<td>{{ item.nombreResponsable }}</td>
|
||||||
|
<td>{{ item.ubicacion }}</td>
|
||||||
|
<td>{{ item.uso }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
<div class="text-center">
|
||||||
|
<b-spinner variant="primary" label="Spinning" v-if="loading"></b-spinner>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
v-on:click="onDescarga(respuesta)"
|
||||||
|
class="btn btn-lg btn-success mt-3">Descargar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style="margin-top:200px; left: 0px; position: absolute;"
|
||||||
|
class="container-fluid px-0"
|
||||||
|
>
|
||||||
|
<footer id="footer" style="left: 0px;" class="text-center">
|
||||||
|
<div class="separador"></div>
|
||||||
|
<div class="contenedor-footer p-3">
|
||||||
|
<div class="text-white mt-3" style="font-size: 11px;">
|
||||||
|
<p>
|
||||||
|
Hecho en México, todos los derechos reservados 2020.
|
||||||
|
<br />
|
||||||
|
Esta página puede ser reproducida con fines no
|
||||||
|
lucrativos, siempre y cuando no se mutile, se cite
|
||||||
|
la fuente
|
||||||
|
<br />
|
||||||
|
completa y su dirección electrónica. De otra forma,
|
||||||
|
requiere permiso previo por escrito de la
|
||||||
|
institución.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import axios from 'axios';
|
||||||
|
import config from '../config/config';
|
||||||
|
// import Swal from 'sweetalert2'
|
||||||
|
/*import strinify from "csv-stringify";
|
||||||
|
import fs from "file-system";
|
||||||
|
*/
|
||||||
|
import MiXLSX from 'xlsx';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: null,
|
||||||
|
pcView: true,
|
||||||
|
alternativeView: 'Ver impresoras',
|
||||||
|
pcHeads: [
|
||||||
|
"Inventario",
|
||||||
|
"Tipo",
|
||||||
|
"Modelo",
|
||||||
|
"Marca",
|
||||||
|
"Serie",
|
||||||
|
"Procesador",
|
||||||
|
"Velocidad de procesador (MHz)",
|
||||||
|
"ROM (GB)",
|
||||||
|
"RAM (MB)",
|
||||||
|
"Tipo de memoria",
|
||||||
|
"Velocidad de memoria (MHz)",
|
||||||
|
"Gráficos",
|
||||||
|
"Sistema operativo",
|
||||||
|
"Resguardo",
|
||||||
|
"Unidad responsable",
|
||||||
|
"Responsable",
|
||||||
|
"Ubicación",
|
||||||
|
"Uso"
|
||||||
|
],
|
||||||
|
printerHeads: [
|
||||||
|
"Inventario",
|
||||||
|
"Tipo",
|
||||||
|
"Modelo",
|
||||||
|
"Marca",
|
||||||
|
"Serie",
|
||||||
|
"Descripción adicional",
|
||||||
|
"Resguardo",
|
||||||
|
"Unidad Responsable",
|
||||||
|
"Responsable",
|
||||||
|
"Ubicacion",
|
||||||
|
"Uso",
|
||||||
|
],
|
||||||
|
respuesta: [],
|
||||||
|
datosmios: [],
|
||||||
|
tipo: [],
|
||||||
|
Ubica: [],
|
||||||
|
uso: [],
|
||||||
|
procesa: [],
|
||||||
|
os: [],
|
||||||
|
tipoPrinters: [],
|
||||||
|
seleccionado: String,
|
||||||
|
seleccionadoUbica: String,
|
||||||
|
seleccionadoUso: String,
|
||||||
|
seleccionadoProcesador: String,
|
||||||
|
seleccionadoOS: String,
|
||||||
|
miNoInventario: String,
|
||||||
|
file: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.getComputers();
|
||||||
|
this.traetipo();
|
||||||
|
this.traeUbica();
|
||||||
|
this.traeUso();
|
||||||
|
this.traeProcesador();
|
||||||
|
this.traeOS();
|
||||||
|
this.seleccionado = "Todos";
|
||||||
|
this.seleccionadoUbica = "Todos";
|
||||||
|
this.seleccionadoUso = "Todos";
|
||||||
|
this.seleccionadoProcesador = "Todos";
|
||||||
|
this.seleccionadoOS = "Todos";
|
||||||
|
this.miNoInventario = "";
|
||||||
|
this.contador = 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
async getComputers() {
|
||||||
|
this.loading = true;
|
||||||
|
this.respuesta = [];
|
||||||
|
this.datosmios = [];
|
||||||
|
const localToken = window.localStorage.token;
|
||||||
|
axios.get(`${ config.api }/api/computers`, {
|
||||||
|
headers: {
|
||||||
|
token: localToken
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
this.respuesta = res.data.equipo;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
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: {
|
||||||
|
token: localToken
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
this.respuesta = res.data.printers;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log(error.response);
|
||||||
|
if(error.response.status === 409) {
|
||||||
|
localStorage.clear();
|
||||||
|
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);
|
||||||
|
if(this.pcView)
|
||||||
|
this.$router.push('./updateEquip');
|
||||||
|
else
|
||||||
|
this.$router.push('./updatePrinter');
|
||||||
|
},
|
||||||
|
async traetipo(){
|
||||||
|
const localToken = window.localStorage.token;
|
||||||
|
axios.get(`${ config.api }/api/tipo`, {
|
||||||
|
headers: {
|
||||||
|
token: localToken
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => this.tipo = res.data.tipo)
|
||||||
|
.catch(err => console.log(err));
|
||||||
|
},
|
||||||
|
async traeUbica(){
|
||||||
|
const localToken = window.localStorage.token;
|
||||||
|
axios.get(`${ config.api }/api/ubica`, {
|
||||||
|
headers: {
|
||||||
|
token: localToken
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => this.Ubica = res.data.ubica)
|
||||||
|
.catch(err => console.log(err));
|
||||||
|
},
|
||||||
|
async traeUso(){
|
||||||
|
const localToken = window.localStorage.token;
|
||||||
|
axios.get(`${ config.api }/api/uso`, {
|
||||||
|
headers: {
|
||||||
|
token: localToken
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => this.uso = res.data.uso)
|
||||||
|
.catch(err => console.log(err));
|
||||||
|
},
|
||||||
|
async traeOS(){
|
||||||
|
const localToken = window.localStorage.token;
|
||||||
|
axios.get(`${ config.api }/api/sisoper`, {
|
||||||
|
headers: {
|
||||||
|
token: localToken
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => this.os = res.data.sisoper)
|
||||||
|
.catch(err => console.log(err));
|
||||||
|
},
|
||||||
|
async traeProcesador(){
|
||||||
|
const localToken = window.localStorage.token;
|
||||||
|
axios.get(`${ config.api }/api/procesador`, {
|
||||||
|
headers: {
|
||||||
|
token: localToken
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => this.procesa = res.data.procesador)
|
||||||
|
.catch(err => console.log(err));
|
||||||
|
},
|
||||||
|
async traetipoImpresora(){
|
||||||
|
const localToken = window.localStorage.token;
|
||||||
|
axios.get(`${ config.api }/api/tipoPrinters`, {
|
||||||
|
headers: {
|
||||||
|
token: localToken
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => this.tipoPrinters = res.data.tipoPrinters)
|
||||||
|
.catch(err => console.log(err));
|
||||||
|
},
|
||||||
|
// watchRow() {
|
||||||
|
// if(JSON.parse(window.localStorage.isAdmin))
|
||||||
|
// this.$router.push('./updateEquip')
|
||||||
|
// },
|
||||||
|
changeView() {
|
||||||
|
this.loading = true;
|
||||||
|
this.contador = 0;
|
||||||
|
this.seleccionado = "Todos";
|
||||||
|
this.seleccionadoUbica = "Todos";
|
||||||
|
this.seleccionadoUso = "Todos";
|
||||||
|
this.seleccionadoProcesador = "Todos";
|
||||||
|
this.seleccionadoOS = "Todos";
|
||||||
|
this.miNoInventario = "";
|
||||||
|
this.tipo=[];
|
||||||
|
this.tipoPrinters=[];
|
||||||
|
this.Ubica=[];
|
||||||
|
this.uso=[];
|
||||||
|
this.procesa=[];
|
||||||
|
this.os=[];
|
||||||
|
if (this.pcView) {
|
||||||
|
this.pcView = !this.pcView;
|
||||||
|
this.getPrinters();
|
||||||
|
this.traetipoImpresora();
|
||||||
|
this.traeUso();
|
||||||
|
this.traeUbica();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.pcView = !this.pcView;
|
||||||
|
this.getComputers();
|
||||||
|
this.traetipo();
|
||||||
|
this.traeUbica();
|
||||||
|
this.traeUso();
|
||||||
|
this.traeProcesador();
|
||||||
|
this.traeOS();
|
||||||
|
}
|
||||||
|
this.generaMisDatos();
|
||||||
|
},
|
||||||
|
admin() {
|
||||||
|
return JSON.parse(window.localStorage.isAdmin);
|
||||||
|
},
|
||||||
|
generaMisDatos(){
|
||||||
|
this.datosmios = [];
|
||||||
|
if(this.pcView){
|
||||||
|
for (let i = 0, j = 0; i < this.respuesta.length; i++){
|
||||||
|
if ((this.seleccionado == "Todos" || this.seleccionado == this.respuesta[i].activoFijo)
|
||||||
|
&& (this.seleccionadoUbica == this.respuesta[i].ubicacion || this.seleccionadoUbica == 'Todos')
|
||||||
|
&& (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].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)
|
||||||
|
&& (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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onDescarga(datos){
|
||||||
|
var miDato;
|
||||||
|
const fecha = new Date();
|
||||||
|
const anyo = fecha.getFullYear();
|
||||||
|
const mes = fecha.getMonth() + 1;
|
||||||
|
const dia = fecha.getDate();
|
||||||
|
const hora = fecha.getHours();
|
||||||
|
const min = fecha.getMinutes();
|
||||||
|
const seg = fecha.getSeconds();
|
||||||
|
var nomArch = this.seleccionado;
|
||||||
|
if (dia > 0 && dia < 10){
|
||||||
|
nomArch += "0";
|
||||||
|
}
|
||||||
|
nomArch += dia;
|
||||||
|
if (mes > 0 && mes < 10){
|
||||||
|
nomArch += "0";
|
||||||
|
}
|
||||||
|
nomArch += mes;
|
||||||
|
nomArch += anyo;
|
||||||
|
if (hora >= 0 && hora < 10){
|
||||||
|
nomArch += "0";
|
||||||
|
}
|
||||||
|
nomArch += hora;
|
||||||
|
if (min >= 0 && min < 10){
|
||||||
|
nomArch += "0";
|
||||||
|
}
|
||||||
|
nomArch += min;
|
||||||
|
if (seg >= 0 && seg < 10){
|
||||||
|
nomArch += "0";
|
||||||
|
}
|
||||||
|
nomArch += seg;
|
||||||
|
if (this.pcView){
|
||||||
|
nomArch = "Computadoras" + nomArch;
|
||||||
|
miDato = MiXLSX.utils.json_to_sheet([],{ header : this.pcHeads});
|
||||||
|
} else {
|
||||||
|
miDato = MiXLSX.utils.json_to_sheet([],{header : this.printerHeads}); // https://docs.sheetjs.com
|
||||||
|
nomArch = "Impresoras" + nomArch;
|
||||||
|
}
|
||||||
|
MiXLSX.utils.sheet_add_json(miDato,this.datosmios,{
|
||||||
|
skipHeader:true, origin : "A2"});
|
||||||
|
const LibroTrabajo = MiXLSX.utils.book_new();
|
||||||
|
MiXLSX.utils.book_append_sheet(LibroTrabajo, miDato, this.seleccionado);
|
||||||
|
nomArch += ".xlsx";
|
||||||
|
MiXLSX.writeFile(LibroTrabajo, nomArch);
|
||||||
|
return JSON.parse(localStorage.isAdmin);
|
||||||
|
},
|
||||||
|
buscaValor(){
|
||||||
|
this.seleccionado = document.getElementById("tipo").value;
|
||||||
|
this.generaMisDatos();
|
||||||
|
},
|
||||||
|
buscaUbica(){
|
||||||
|
this.seleccionadoUbica = document.getElementById("Ubica").value;
|
||||||
|
this.generaMisDatos();
|
||||||
|
},
|
||||||
|
extraeInventario(){
|
||||||
|
this.miNoInventario = document.getElementById("Inventario").value;
|
||||||
|
this.generaMisDatos();
|
||||||
|
},
|
||||||
|
buscaUso(){
|
||||||
|
this.seleccionadoUso = document.getElementById("Uso").value;
|
||||||
|
this.generaMisDatos();
|
||||||
|
},
|
||||||
|
buscaProcesador(){
|
||||||
|
this.seleccionadoProcesador = document.getElementById("Procesador").value;
|
||||||
|
this.generaMisDatos();
|
||||||
|
},
|
||||||
|
buscaSisOper(){
|
||||||
|
this.seleccionadoOS = document.getElementById("SisOper").value;
|
||||||
|
this.generaMisDatos();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.header-f {
|
||||||
|
background-color: #bb8800;
|
||||||
|
}
|
||||||
|
.t-hov:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
#footer {
|
||||||
|
bottom: 0px;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.separador {
|
||||||
|
width: 100%;
|
||||||
|
background: #2e5795;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contenedor-footer {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cont-text-foo {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
background: #1b3d70;
|
||||||
|
}
|
||||||
|
|
||||||
|
#myTableStyle {
|
||||||
|
max-height: 350px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.black {
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
publicPath: "./"
|
||||||
|
}
|
||||||