forked from verdnatura/salix-front
Update Form Model component
This commit is contained in:
parent
cf53245bcf
commit
babaf47653
|
@ -35,6 +35,10 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
autoLoad: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['onFetch']);
|
||||
|
@ -43,7 +47,11 @@ defineExpose({
|
|||
save,
|
||||
});
|
||||
|
||||
onMounted(async () => await fetch());
|
||||
onMounted(async () => {
|
||||
if ($props.autoLoad) {
|
||||
await fetch();
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
state.unset($props.model);
|
||||
|
@ -96,6 +104,7 @@ function reset() {
|
|||
emit('onFetch', state.get($props.model));
|
||||
hasChanges.value = false;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line vue/no-dupe-keys
|
||||
function filter(value, update, filterOptions) {
|
||||
update(
|
||||
|
@ -176,6 +185,7 @@ watch(formUrl, async () => {
|
|||
max-width: 800px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.q-card {
|
||||
padding: 32px;
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ const statesFilter = {
|
|||
:url-update="`Claims/updateClaim/${route.params.id}`"
|
||||
:filter="claimFilter"
|
||||
model="claim"
|
||||
auto-load
|
||||
>
|
||||
<template #form="{ data, validate, filter }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
|
|
|
@ -60,7 +60,7 @@ const filterOptions = {
|
|||
auto-load
|
||||
/>
|
||||
|
||||
<FormModel :url="`Clients/${route.params.id}`" model="customer">
|
||||
<FormModel :url="`Clients/${route.params.id}`" model="customer" auto-load>
|
||||
<template #form="{ data, validate, filter }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
|
|
|
@ -29,6 +29,7 @@ const shelvingFilter = {
|
|||
:url-update="`Shelvings/${shelvingId}`"
|
||||
:filter="shelvingFilter"
|
||||
model="shelving"
|
||||
auto-load
|
||||
>
|
||||
<template #form="{ data, validate, filter }">
|
||||
<ShelvingForm :data="data" :validate="validate" :filter="filter" />
|
||||
|
|
Loading…
Reference in New Issue