forked from verdnatura/salix-front
feat: refs #5919 WIP workerlocker
This commit is contained in:
parent
dec9b924eb
commit
a1f785ccbe
|
@ -156,9 +156,12 @@ const startFormWatcher = () => {
|
|||
|
||||
async function fetch() {
|
||||
try {
|
||||
const { data } = await axios.get($props.url, {
|
||||
let { data } = await axios.get($props.url, {
|
||||
params: { filter: JSON.stringify($props.filter) },
|
||||
});
|
||||
|
||||
if (Array.isArray(data)) data = data[0];
|
||||
|
||||
state.set($props.model, data);
|
||||
originalData.value = data && JSON.parse(JSON.stringify(data));
|
||||
|
||||
|
|
|
@ -826,6 +826,7 @@ worker:
|
|||
log: Log
|
||||
calendar: Calendar
|
||||
timeControl: Time control
|
||||
locker: Locker
|
||||
list:
|
||||
name: Name
|
||||
email: Email
|
||||
|
|
|
@ -824,6 +824,7 @@ worker:
|
|||
log: Historial
|
||||
calendar: Calendario
|
||||
timeControl: Control de horario
|
||||
locker: Taquilla
|
||||
list:
|
||||
name: Nombre
|
||||
email: Email
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const fetchData = ref();
|
||||
const lockers = ref([]);
|
||||
const filter = ref({ where: {} });
|
||||
|
||||
const getLockers = async (workerLocker) => {
|
||||
console.log(workerLocker);
|
||||
filter.value.where.gender = workerLocker.sex;
|
||||
await fetchData.value.fetch();
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
ref="fetchData"
|
||||
url="Lockers/codes"
|
||||
:filter="filter"
|
||||
@on-fetch="(data) => (lockers = data)"
|
||||
/>
|
||||
<FormModel
|
||||
:url="`Workers/locker`"
|
||||
model="Worker"
|
||||
:filter="{ where: { id: route.params.id } }"
|
||||
@on-fetch="getLockers"
|
||||
auto-load
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnSelect
|
||||
:label="t('Locker')"
|
||||
v-model="data.locker"
|
||||
:options="lockers"
|
||||
option-label="code"
|
||||
option-value="id"
|
||||
hide-selected
|
||||
/>
|
||||
</template>
|
||||
</FormModel>
|
||||
</template>
|
|
@ -1,2 +1,3 @@
|
|||
Search worker: Buscar trabajador
|
||||
You can search by worker id or name: Puedes buscar por id o nombre del trabajador
|
||||
Locker: Taquilla
|
||||
|
|
|
@ -22,6 +22,7 @@ export default {
|
|||
'WorkerCalendar',
|
||||
'WorkerDms',
|
||||
'WorkerTimeControl',
|
||||
'WorkerLocker',
|
||||
],
|
||||
departmentCard: ['BasicData'],
|
||||
},
|
||||
|
@ -167,6 +168,15 @@ export default {
|
|||
component: () =>
|
||||
import('src/pages/Worker/Card/WorkerTimeControl.vue'),
|
||||
},
|
||||
{
|
||||
name: 'WorkerLocker',
|
||||
path: 'locker',
|
||||
meta: {
|
||||
title: 'locker',
|
||||
icon: 'lock',
|
||||
},
|
||||
component: () => import('src/pages/Worker/Card/WorkerLocker.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue