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