2022-06-07 18:50:55 +00:00
|
|
|
<template>
|
|
|
|
<section>
|
|
|
|
<h3 class="is-size-4 mb-3">Buscar Operador</h3>
|
|
|
|
|
|
|
|
<div class="columns mb-5 is-align-items-flex-end">
|
|
|
|
<b-field class="column is-3 mb-0 pb-0" label="Operador">
|
|
|
|
<b-input
|
|
|
|
type="text"
|
|
|
|
placeholder="Operador"
|
|
|
|
icon="account"
|
|
|
|
@keyup.enter.native="obtenerOperadores()"
|
|
|
|
v-model="search.operador"
|
|
|
|
rounded
|
|
|
|
/>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<b-button
|
|
|
|
type="is-success"
|
|
|
|
class="column is-3"
|
|
|
|
@click="obtenerOperadores()"
|
|
|
|
expanded
|
|
|
|
rounded
|
|
|
|
>
|
|
|
|
Buscar
|
|
|
|
</b-button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<b-table
|
|
|
|
:data="data"
|
|
|
|
:total="total"
|
|
|
|
:current-page="page"
|
|
|
|
:per-page="25"
|
|
|
|
:loading="isLoadingTable"
|
|
|
|
@page-change="onPageChange"
|
|
|
|
class="mb-6"
|
|
|
|
hoverable
|
|
|
|
striped
|
|
|
|
paginated
|
|
|
|
backend-pagination
|
|
|
|
>
|
|
|
|
<b-table-column field="operador" label="Operador" v-slot="props" centered>
|
|
|
|
<span>{{ props.row.operador }}</span>
|
|
|
|
</b-table-column>
|
|
|
|
|
|
|
|
<b-table-column field="activo" label="Status" v-slot="props" centered>
|
|
|
|
<ActivarDesactivar
|
|
|
|
:admin="admin"
|
|
|
|
:operador="props.row"
|
|
|
|
:updateActualizarTabla="updateActualizarTabla"
|
|
|
|
:updateIsLoading="updateIsLoading"
|
|
|
|
/>
|
|
|
|
</b-table-column>
|
|
|
|
|
|
|
|
<b-table-column
|
|
|
|
field="password"
|
|
|
|
label="Cambiar Contraseña"
|
|
|
|
v-slot="props"
|
|
|
|
centered
|
|
|
|
>
|
|
|
|
<UpdatePassword
|
|
|
|
:admin="admin"
|
|
|
|
:operador="props.row"
|
|
|
|
:updateIsLoading="updateIsLoading"
|
|
|
|
v-if="props.row.activo"
|
|
|
|
/>
|
|
|
|
</b-table-column>
|
|
|
|
</b-table>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
|
|
|
import ActivarDesactivar from '@/components/admin/ActivarDesactivar'
|
|
|
|
import UpdatePassword from '@/components/admin/UpdatePassword'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: { UpdatePassword, ActivarDesactivar },
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
data: [],
|
|
|
|
page: 1,
|
|
|
|
total: 0,
|
|
|
|
search: {},
|
|
|
|
lastSearch: {},
|
|
|
|
isLoadingTable: false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
admin: { type: Object, required: true },
|
|
|
|
actualizarTabla: { type: Boolean, required: true },
|
|
|
|
updateActualizarTabla: { type: Function, required: true },
|
|
|
|
updateIsLoading: { type: Function, required: true },
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onPageChange(page) {
|
|
|
|
this.page = page
|
|
|
|
this.obtenerOperadores()
|
|
|
|
},
|
|
|
|
obtenerOperadores() {
|
|
|
|
let data = ''
|
|
|
|
|
|
|
|
this.isLoadingTable = true
|
|
|
|
if (this.search.operador != this.lastSearch.operador) {
|
|
|
|
this.page = 1
|
|
|
|
this.lastSearch.operador = this.search.operador
|
|
|
|
}
|
2022-06-18 04:03:18 +00:00
|
|
|
if (this.search.operador)
|
2022-07-08 12:48:02 +00:00
|
|
|
data = `&operador=${this.search.operador}&id_institucion=${this.admin.institucion.id_institucion}`
|
2022-06-07 18:50:55 +00:00
|
|
|
axios
|
|
|
|
.get(
|
2022-07-08 12:48:02 +00:00
|
|
|
`${process.env.api}/operador/operadores?pagina=${this.page}&id_tipo_usuario=4${data}`
|
2022-06-07 18:50:55 +00:00
|
|
|
)
|
|
|
|
.then((res) => {
|
2022-06-18 04:03:18 +00:00
|
|
|
this.data = res.data[0]
|
|
|
|
this.total = res.data[1]
|
2022-06-07 18:50:55 +00:00
|
|
|
this.isLoadingTable = false
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.isLoadingTable = false
|
2022-07-11 14:15:10 +00:00
|
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
2022-06-07 18:50:55 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
actualizarTabla() {
|
|
|
|
if (this.actualizarTabla) {
|
|
|
|
this.obtenerOperadores()
|
|
|
|
this.updateActualizarTabla(false)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
2022-06-18 04:03:18 +00:00
|
|
|
if (this.admin.tipoUsuario.id_tipo_usuario === 3) {
|
|
|
|
this.obtenerOperadores()
|
|
|
|
}
|
2022-06-07 18:50:55 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style></style>
|