This commit is contained in:
2019-07-18 21:53:53 +00:00
parent dc674e6836
commit a5c77af06c
2 changed files with 15 additions and 11 deletions

View File

@@ -113,16 +113,17 @@ export default {
}, },
props: { props: {
value: String, value: String,
customfielddata: String,
formKey: String, //used to grab template from store formKey: String, //used to grab template from store
readOnly: Boolean readOnly: Boolean
}, },
watch: { watch: {
value(val) { // value(val) {
//this ensures the parent form gets the onchange event // //this ensures the parent form gets the onchange event
//not actually sure why there are two here but it worked with the datetime picker so I replicated it here // //not actually sure why there are two here but it worked with the datetime picker so I replicated it here
this.$emit("input", val); // this.$emit("input", val);
this.$emit("change", val); // this.$emit("change", val);
} // }
}, },
computed: { computed: {
c2: { c2: {
@@ -139,12 +140,12 @@ export default {
return this.$gzlocale.get(ltkey); return this.$gzlocale.get(ltkey);
}, },
GetValueForField: function(dataKey) { GetValueForField: function(dataKey) {
if (!this.value) { if (!this.customfielddata) {
return null; return null;
} }
// debugger; // debugger;
//get the data out of the JSON string value //get the data out of the JSON string value
var cData = JSON.parse(this.value); var cData = JSON.parse(this.customfielddata);
//get the type it *should* be //get the type it *should* be
//TODO: method here //TODO: method here
@@ -160,7 +161,7 @@ export default {
//Get the data out of the json string value //Get the data out of the json string value
// //
var cData = JSON.parse(this.value); var cData = JSON.parse(this.customfielddata);
//then set item in the cData //then set item in the cData
//initial naive attempt: (tostring is suspect) //initial naive attempt: (tostring is suspect)
@@ -177,7 +178,8 @@ Avoid mutating a prop directly since the value will be overwritten whenever the
//MAYBE I need to modify the value object, not simply replace it (somehow?) //MAYBE I need to modify the value object, not simply replace it (somehow?)
*/ */
this.value=JSON.stringify(cData) //this.value=JSON.stringify(cData)
this.$emit('update:customfielddata', JSON.stringify(cData));
} }
}, },
beforeCreate() { beforeCreate() {

View File

@@ -165,12 +165,14 @@
<v-flex xs12 px-2> <v-flex xs12 px-2>
<gz-custom-fields <gz-custom-fields
:formKey="formCustomTemplateKey" :formKey="formCustomTemplateKey"
v-model="obj.customFields" v-bind:customfielddata.sync="obj.customFields"
:readOnly="this.formState.readOnly" :readOnly="this.formState.readOnly"
ref="customFields" ref="customFields"
:error-messages="this.$gzform.serverErrors(this, 'customFields')" :error-messages="this.$gzform.serverErrors(this, 'customFields')"
@change="onChange('customFields')" @change="onChange('customFields')"
></gz-custom-fields> ></gz-custom-fields>
<!-- v-model="obj.customFields" -->
</v-flex> </v-flex>
</v-layout> </v-layout>
<!-- <v-layout align-left justify-center row wrap mt-5> <!-- <v-layout align-left justify-center row wrap mt-5>