#7136 - Enable paginate event in VnSelectFilter #255
|
@ -36,10 +36,10 @@ const $props = defineProps({
|
|||
|
||||
const emit = defineEmits(['onFetch']);
|
||||
defineExpose({ fetch });
|
||||
const fetchData = useFetchData({ ...$props });
|
||||
// const fetchData = useFetchData({ ...$props });
|
||||
onMounted(async () => {
|
||||
|
||||
if ($props.autoLoad) {
|
||||
await fetchData.fetch();
|
||||
await fetch();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -7,11 +7,10 @@ import { useRole } from 'src/composables/useRole';
|
|||
import FormModel from 'components/FormModel.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import { useAxios } from 'src/composables/useAxios';
|
||||
|
||||
const { hasAny } = useRole();
|
||||
const { t } = useI18n();
|
||||
const fetchData = ref();
|
||||
const originaLockerId = ref();
|
||||
const lockers = ref([]);
|
||||
const { store } = useArrayData('Worker');
|
||||
|
@ -27,21 +26,14 @@ const save = async (data) => {
|
|||
const lockerId = data.id ?? originaLockerId.value;
|
||||
const workerFk = lockerId == originaLockerId.value ? null : entityId.value;
|
||||
|
||||
return axios.patch(`Lockers/${lockerId}`, { workerFk });
|
||||
return useAxios(`Lockers/${lockerId}`).push('PATCH', { workerFk });
|
||||
};
|
||||
|
||||
const init = async (data) => {
|
||||
await fetchData.value.fetch();
|
||||
originaLockerId.value = data.id;
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
ref="fetchData"
|
||||
url="Lockers/codes"
|
||||
:filter="filter"
|
||||
@on-fetch="(data) => (lockers = data)"
|
||||
/>
|
||||
<FormModel
|
||||
:url="`Workers/${entityId}/locker`"
|
||||
model="worker"
|
||||
|
@ -51,6 +43,8 @@ const init = async (data) => {
|
|||
>
|
||||
<template #form="{ data }">
|
||||
<VnSelect
|
||||
url="Lockers/codes"
|
||||
:filter="filter"
|
||||
:label="t('Locker')"
|
||||
v-model="data.id"
|
||||
:options="lockers"
|
||||
|
|
Loading…
Reference in New Issue
No estoy segur de si deberiamos poner la funcionalidad de usar arrayData//paginar en FechData si luego quien lo usa es VnSelectFilter, en vez de ponerla directamente en VnSelectFilter. @juan