This commit is contained in:
2019-07-18 18:54:20 +00:00
parent 7fdeb9bc65
commit 68558301ac
2 changed files with 22 additions and 12 deletions

View File

@@ -1,26 +1,23 @@
/*eslint-disable */ /*e slint-disable */
import store from "../store"; import store from "../store";
import gzapi from "./gzapi"; import gzapi from "./gzapi";
import _ from "../libs/lodash.min.js"; import _ from "../libs/lodash.min.js";
///Add data key names which make the custom fields control work more easily
///Since the names can be inferred from the data that comes from the server it saves bandwidth to do it here at the client
function addDataKeyNames(obj) { function addDataKeyNames(obj) {
//debugger;
//iterate the array of objects //iterate the array of objects
//if it has a "type" property then it's a custom field so add its data key name //if it has a "type" property then it's a custom field so add its data key name
for (var i = 0; i < obj.length; i++) { for (var i = 0; i < obj.length; i++) {
if(obj[i].type){ if (obj[i].type) {
obj[i]["dataKey"]="c"+parseInt(obj[i].fld.replace( /^\D+/g, '')) obj[i]["dataKey"] = "c" + parseInt(obj[i].fld.replace(/^\D+/g, ""));
} }
} }
//return the whole thing again now translated //return the whole thing again now translated
return obj; return obj;
} }
export default { export default {
get(formKey) { get(formKey) {
return new Promise(function getFormTemplate(resolve) { return new Promise(function getFormTemplate(resolve) {

View File

@@ -12,7 +12,7 @@
</span> </span>
</div> </div>
<hr /> <hr />
{{ obj.c2 }}
<div> <div>
<v-layout align-center justify-left row wrap> <v-layout align-center justify-left row wrap>
<template v-for="item in this.$store.state.formCustomTemplate[formKey]"> <template v-for="item in this.$store.state.formCustomTemplate[formKey]">
@@ -31,7 +31,7 @@
</div> </div>
<div v-else-if="item.type === 'text'"> <div v-else-if="item.type === 'text'">
<v-textarea <v-textarea
v-model="$data[item.fld]" v-model="$data[item.dataKey]"
:readonly="readOnly" :readonly="readOnly"
:label="lt(item.fld)" :label="lt(item.fld)"
auto-grow auto-grow
@@ -94,8 +94,21 @@ CUSTOM FIELD DATA:
export default { export default {
data() { data() {
return { return {
obj: { me: 1, c2: "This is my c2 data!", WidgetCustom2: "Here is my OBJ.WidgetCustom2 Data!" }, c1:null,
WidgetCustom2: "Here is my WidgetCustom2 Data!" c2: "Here is my WidgetCustom2 Data!",
c3: null,
c4: null,
c5: null,
c6: null,
c7: null,
c8: null,
c9: null,
c10: null,
c12: null,
c13: null,
c14: null,
c15: null,
c16: null
}; };
}, },
props: { props: {