diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index fb3ac10c3..de4724e55 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -124,11 +124,16 @@ async function onSubmit() { }); } isLoading.value = true; - await saveChanges(); + await saveChanges($props.saveFn ? formData.value : null); } async function saveChanges(data) { - if ($props.saveFn) return $props.saveFn(data, getChanges); + if ($props.saveFn) { + $props.saveFn(data, getChanges); + isLoading.value = false; + hasChanges.value = false; + return; + } const changes = data || getChanges(); try { await axios.post($props.saveUrl || $props.url + '/crud', changes); diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index 2053eceb1..fe0866292 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -15,6 +15,10 @@ const props = defineProps({ type: Boolean, default: false, }, + emitDateFormat: { + type: Boolean, + default: false, + }, }); const hover = ref(false); @@ -37,7 +41,10 @@ const value = computed({ return props.modelValue; }, set(value) { - emit('update:modelValue', joinDateAndTime(value, time.value)); + emit( + 'update:modelValue', + props.emitDateFormat ? new Date(value) : joinDateAndTime(value, time.value) + ); }, }); diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index 480d36e4f..05c74f00a 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -169,6 +169,7 @@ watch(modelValue, (newValue) => { ref="vnSelectRef" :class="{ required: $attrs.required }" :rules="$attrs.required ? [requiredFieldRule] : null" + virtual-scroll-slice-size="options.length" >