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

@@ -1,4 +1,4 @@
/* eslint-disable */ /* Xeslint-disable */
/////////////////////////////// ///////////////////////////////
// gzform // gzform
// //
@@ -52,7 +52,6 @@ function getControl(vm, ref) {
var customFields = vm.$refs["customFields"]; var customFields = vm.$refs["customFields"];
if (customFields !== undefined) { if (customFields !== undefined) {
ctrl = customFields.$refs[ref]; ctrl = customFields.$refs[ref];
} }
} }
@@ -87,13 +86,11 @@ function getControlValue(ctrl) {
// Get field name from control // Get field name from control
// //
function getControlLabel(ctrl) { function getControlLabel(ctrl) {
if (ctrl.label == undefined) { if (ctrl.label == undefined) {
return "UNKNOWN CONTROL"; return "UNKNOWN CONTROL";
} else { } else {
return ctrl.label; return ctrl.label;
} }
} }
///////////////////////////////////////// /////////////////////////////////////////
@@ -151,7 +148,6 @@ function getErrorBoxErrors(vm, errs) {
} }
export default { export default {
/////////////////////////////// ///////////////////////////////
// REQUIRED // REQUIRED
// //
@@ -350,7 +346,6 @@ export default {
// For now the only rule is that they can be required or not // For now the only rule is that they can be required or not
// //
customFieldsCheck(vm, templateItem, subvm, fieldName) { customFieldsCheck(vm, templateItem, subvm, fieldName) {
//templateItem sample //templateItem sample
// dataKey: "c2" // dataKey: "c2"
// fld: "WidgetCustom2" // fld: "WidgetCustom2"
@@ -362,7 +357,6 @@ export default {
return false; return false;
} }
if (!templateItem.required) { if (!templateItem.required) {
return false; return false;
} }

View File

@@ -93,7 +93,7 @@
</template> </template>
<script> <script>
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* eslint-disable */ /* xeslint-disable */
//////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** /**
* v-if="item.hide == false" * v-if="item.hide == false"
@@ -173,7 +173,10 @@ export default {
return window.$gz.form; return window.$gz.form;
}, },
onChange(ref) { 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); window.$gz.form.onChange(this.parentVM, ref);
} }
}, },
@@ -191,24 +194,16 @@ export default {
//coerce it to that type and return it //coerce it to that type and return it
//TODO: Method here //TODO: Method here
return cData[dataKey]; return cData[dataKey];
}, },
SetValueForField: function(dataKey, newValue) { SetValueForField: function(dataKey, newValue) {
//https://stackoverflow.com/questions/39868963/vue-2-mutating-props-vue-warn //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}";
// }
//Is this a new or empty custom fields object?
if (this.value === null || this.value === undefined) { if (this.value === null || this.value === undefined) {
this.value="{}";//empty json fragment this.value = "{}"; //empty json fragment, field will be added later below
} }
//Get the data out of the json string value //Get the data out of the json string value