forked from verdnatura/salix-front
fix: itemBotanical
This commit is contained in:
parent
12a5d6cec0
commit
bae0b4de35
|
@ -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 () => {
|
||||
// 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>
|
||||
<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