feat: refs #5919 WIP workerlocker
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-05-08 11:02:40 +02:00
parent dec9b924eb
commit a1f785ccbe
6 changed files with 63 additions and 1 deletions

View File

@ -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));

View File

@ -826,6 +826,7 @@ worker:
log: Log
calendar: Calendar
timeControl: Time control
locker: Locker
list:
name: Name
email: Email

View File

@ -824,6 +824,7 @@ worker:
log: Historial
calendar: Calendario
timeControl: Control de horario
locker: Taquilla
list:
name: Nombre
email: Email

View File

@ -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>

View File

@ -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

View File

@ -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'),
},
],
},
],