This commit is contained in:
2019-11-26 20:10:06 +00:00
parent dee340b9fa
commit 71d9a25687
2 changed files with 31 additions and 42 deletions

View File

@@ -93,7 +93,7 @@
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* eslint-disable */
/* xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* v-if="item.hide == false"
@@ -173,7 +173,10 @@ export default {
return window.$gz.form;
},
onChange(ref) {
if (!this.parentVM.formState.loading && !this.parentVM.formState.readOnly) {
if (
!this.parentVM.formState.loading &&
!this.parentVM.formState.readOnly
) {
window.$gz.form.onChange(this.parentVM, ref);
}
},
@@ -191,37 +194,29 @@ export default {
//coerce it to that type and return it
//TODO: Method here
return cData[dataKey];
},
SetValueForField: function(dataKey, newValue) {
//https://stackoverflow.com/questions/39868963/vue-2-mutating-props-vue-warn
debugger;
//debugger;
//Ok, could end up here with no value set yet at all for the entire custom fields control as it's a new record or something so...
//what are valid values for custom fields on a new record, completely empty?
// if(this.value=== null || this.value===undefined){
// this.value="{\"" + dataKey+"\":null}";
// }
if(this.value=== null || this.value===undefined){
this.value="{}";//empty json fragment
}
//Is this a new or empty custom fields object?
if (this.value === null || this.value === undefined) {
this.value = "{}"; //empty json fragment, field will be added later below
}
//Get the data out of the json string value
//
var cData = JSON.parse(this.value);
if (!window.$gz._.has(cData, dataKey)) {
cData[dataKey]=null;
}
if (!window.$gz._.has(cData, dataKey)) {
cData[dataKey] = null;
}
//handle null or undefined
if (newValue === null || newValue === undefined) {
cData[dataKey] = null;
} else {
} else {
//then set item in the cData
//TODO: This will likely need also to be converted because dates and stuff
@@ -234,7 +229,7 @@ if (!window.$gz._.has(cData, dataKey)) {
this.$emit("update:value", ret);
//this triggers the onchange routine in the parent form
//mainly for custom fields purposes so that the dirty checking works
this.$emit("change",ret);
this.$emit("change", ret);
}
},
beforeCreate() {