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