|
@ -13,7 +13,6 @@ import CreateSpecieForm from './CreateSpecieForm.vue';
|
|||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const itemBotanicalsRef = ref(null);
|
||||
const itemGenusOptions = ref([]);
|
||||
const itemSpeciesOptions = ref([]);
|
||||
const itemBotanicals = ref([]);
|
||||
|
@ -31,22 +30,19 @@ const onSpecieCreated = (response, formData) => {
|
|||
const entityId = computed(() => {
|
||||
return route.params.id;
|
||||
});
|
||||
onMounted(async () => {
|
||||
itemBotanicalsForm.itemFk = entityId.value;
|
||||
itemBotanicals.value = await itemBotanicalsRef.value.fetch();
|
||||
if (itemBotanicals.value.length > 0)
|
||||
Object.assign(itemBotanicalsForm, itemBotanicals.value[0]);
|
||||
});
|
||||
// onMounted(async () => {
|
||||
jsegarra marked this conversation as resolved
Outdated
|
||||
// itemBotanicalsForm.itemFk = entityId.value;
|
||||
// // itemBotanicals.value = await itemBotanicalsRef.value.fetch();
|
||||
// if (itemBotanicals.value.length > 0)
|
||||
// Object.assign(itemBotanicalsForm, itemBotanicals.value[0]);
|
||||
// });
|
||||
async function handleItemBotanical(data) {
|
||||
itemBotanicalsForm = data;
|
||||
// if (data.length > 0) Object.assign(itemBotanicalsForm, itemBotanicals.value[0]);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
carlossa marked this conversation as resolved
Outdated
alexm
commented
(data) => itemBotanicalsForm = data (data) => itemBotanicalsForm = data
|
||||
<FetchData
|
||||
ref="itemBotanicalsRef"
|
||||
url="ItemBotanicals"
|
||||
:filter="{
|
||||
where: { itemFk: entityId },
|
||||
}"
|
||||
@on-fetch="(data) => (itemBotanicals = data)"
|
||||
/>
|
||||
<!-- <FetchData ref="itemBotanicalsRef" @on-fetch="(data) => (itemBotanicals = data)" /> -->
|
||||
<FetchData
|
||||
url="Genera"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||
|
@ -60,11 +56,14 @@ onMounted(async () => {
|
|||
auto-load
|
||||
/>
|
||||
<FormModel
|
||||
url="ItemBotanicals"
|
||||
url-update="ItemBotanicals"
|
||||
model="entry"
|
||||
model="item"
|
||||
auto-load
|
||||
:form-initial-data="itemBotanicalsForm"
|
||||
:clear-store-on-unmount="false"
|
||||
:filter="{
|
||||
where: { itemFk: entityId },
|
||||
}"
|
||||
@on-fetch="handleItemBotanical"
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
|
|
Loading…
Reference in New Issue
Comentarios?