Merge pull request 'fix: refs #7524 dynamic fetch' (!734) from 7524-hotfix-tooManyRecords into master
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #734
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Jorge Penadés 2024-09-20 09:00:07 +00:00
commit 26f34619c0
1 changed files with 8 additions and 23 deletions

View File

@ -28,18 +28,8 @@ const route = useRoute();
const router = useRouter();
const state = useState();
const { notify } = useNotify();
const thermographFilter = {
fields: ['thermographFk'],
where: {
travelFk: null,
},
order: 'thermographFk ASC',
};
const fetchTravelThermographsRef = ref(null);
const allowedContentTypes = ref('');
const user = state.getUser();
const thermographsOptions = ref([]);
const dmsTypesOptions = ref([]);
const companiesOptions = ref([]);
const warehousesOptions = ref([]);
@ -168,24 +158,15 @@ const updateThermograph = async () => {
};
const onThermographCreated = async (data) => {
await fetchTravelThermographsRef.value.fetch();
thermographForm.thermographId = data.thermographId;
thermographForm.thermographId = data.id;
};
</script>
<template>
<FetchData
url="DmsContainers/allowedContentTypes"
@on-fetch="(data) => (allowedContentTypes = data.join(', '))"
auto-load
/>
<FetchData
ref="fetchTravelThermographsRef"
url="TravelThermographs"
@on-fetch="(data) => (thermographsOptions = data)"
:filter="thermographFilter"
auto-load
/>
<FetchData
url="DmsTypes"
:filter="{ order: 'name' }"
@ -239,15 +220,20 @@ const onThermographCreated = async (data) => {
<VnSelectDialog
:label="t('travel.thermographs.thermograph')"
v-model="thermographForm.thermographId"
:options="thermographsOptions"
url="TravelThermographs"
option-value="thermographFk"
option-label="thermographFk"
:fields="['thermographFk']"
:where="{ travelFk: null }"
sort-by="thermographFk ASC"
:disable="viewAction === 'edit'"
:tooltip="t('New thermograph')"
>
<template #form>
<CreateThermographForm
@on-data-saved="onThermographCreated($event, data)"
@on-data-saved="
(data) => (thermographForm.thermographId = data.id)
"
/>
</template>
</VnSelectDialog>
@ -323,7 +309,6 @@ const onThermographCreated = async (data) => {
</QForm>
</QPage>
</template>
<i18n>
es:
Select files: Selecciona ficheros