This commit is contained in:
2020-07-14 22:31:39 +00:00
parent f511ef1c7c
commit 39e4844ec5
3 changed files with 43 additions and 15 deletions

View File

@@ -688,10 +688,11 @@ export default {
return; return;
} }
console.log("gzform::fieldValueChanged, values:", { // console.log("gzform::fieldValueChanged, values:", {
ref: ref, // ref: ref,
formstate: vm.formState // objValue: vm[ref],
}); // refValue: vm.$refs[ref].value
// });
//If ref appears in the formState.serverErrors details collection, remove each one //If ref appears in the formState.serverErrors details collection, remove each one
let m = window.$gz._.remove(vm.formState.serverError.details, function( let m = window.$gz._.remove(vm.formState.serverError.details, function(

View File

@@ -3,7 +3,7 @@
<v-text-field <v-text-field
ref="textField" ref="textField"
:value="currencyValue" :value="currencyValue"
@input="updateValue" @change="updateValue"
v-currency="{ v-currency="{
currency: currencyName, currency: currencyName,
locale: languageName locale: languageName

View File

@@ -1,7 +1,7 @@
<template> <template>
<v-container fluid> <v-container fluid>
<gz-report-selector ref="reportSelector"></gz-report-selector> <gz-report-selector ref="reportSelector"></gz-report-selector>
{{ formState }} <!-- {{ formState }} -->
<v-row v-if="formState.ready"> <v-row v-if="formState.ready">
<v-col> <v-col>
<v-form ref="form"> <v-form ref="form">
@@ -281,12 +281,18 @@ export default {
if (this.$route.params.obj) { if (this.$route.params.obj) {
//yes, no need to fetch it //yes, no need to fetch it
this.obj = this.$route.params.obj; this.obj = this.$route.params.obj;
vm.formState.loading = false; //here we handle it immediately window.$gz.form.setFormState({
vm: vm,
loading: false
});
} else { } else {
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
} }
} else { } else {
vm.formState.loading = false; //here we handle it immediately window.$gz.form.setFormState({
vm: vm,
loading: false
});
} }
window.$gz.form.setFormState({ window.$gz.form.setFormState({
vm: vm, vm: vm,
@@ -412,7 +418,10 @@ export default {
}, },
async getDataFromApi(recordId) { async getDataFromApi(recordId) {
let vm = this; let vm = this;
vm.formState.loading = true; window.$gz.form.setFormState({
vm: vm,
loading: true
});
if (!recordId) { if (!recordId) {
throw FORM_KEY + "::getDataFromApi -> Missing recordID!"; throw FORM_KEY + "::getDataFromApi -> Missing recordID!";
} }
@@ -449,7 +458,10 @@ export default {
} catch (error) { } catch (error) {
window.$gz.errorHandler.handleFormError(error, vm); window.$gz.errorHandler.handleFormError(error, vm);
} finally { } finally {
vm.formState.loading = false; window.$gz.form.setFormState({
vm: vm,
loading: false
});
} }
}, },
async submit() { async submit() {
@@ -459,7 +471,10 @@ export default {
} }
try { try {
vm.formState.loading = true; window.$gz.form.setFormState({
vm: vm,
loading: true
});
let url = API_BASE_URL; // + vm.$route.params.recordid; let url = API_BASE_URL; // + vm.$route.params.recordid;
//clear any errors vm might be around from previous submit //clear any errors vm might be around from previous submit
window.$gz.form.deleteAllErrorBoxErrors(vm); window.$gz.form.deleteAllErrorBoxErrors(vm);
@@ -499,7 +514,10 @@ export default {
} catch (ex) { } catch (ex) {
window.$gz.errorHandler.handleFormError(ex, vm); window.$gz.errorHandler.handleFormError(ex, vm);
} finally { } finally {
vm.formState.loading = false; window.$gz.form.setFormState({
vm: vm,
loading: false
});
} }
}, },
async remove() { async remove() {
@@ -511,7 +529,10 @@ export default {
} }
//do the delete //do the delete
vm.formState.loading = true; window.$gz.form.setFormState({
vm: vm,
loading: true
});
//No need to delete a new record, just abandon it... //No need to delete a new record, just abandon it...
if (vm.$route.params.recordid == 0) { if (vm.$route.params.recordid == 0) {
//this should not get offered for delete but to be safe and clear just in case: //this should not get offered for delete but to be safe and clear just in case:
@@ -548,7 +569,10 @@ export default {
if (!vm.canDuplicate || vm.$route.params.recordid == 0) { if (!vm.canDuplicate || vm.$route.params.recordid == 0) {
return; return;
} }
vm.formState.loading = true; window.$gz.form.setFormState({
vm: vm,
loading: true
});
let url = API_BASE_URL + "duplicate/" + vm.$route.params.recordid; let url = API_BASE_URL + "duplicate/" + vm.$route.params.recordid;
try { try {
@@ -570,7 +594,10 @@ export default {
} catch (ex) { } catch (ex) {
window.$gz.errorHandler.handleFormError(ex, vm); window.$gz.errorHandler.handleFormError(ex, vm);
} finally { } finally {
vm.formState.loading = false; window.$gz.form.setFormState({
vm: vm,
loading: false
});
} }
} }
} }