This commit is contained in:
@@ -1,8 +1,26 @@
|
||||
/* XXeslint-disable */
|
||||
/*eslint-disable */
|
||||
import store from "../store";
|
||||
import gzapi from "./gzapi";
|
||||
import _ from "../libs/lodash.min.js";
|
||||
|
||||
|
||||
function addDataKeyNames(obj) {
|
||||
//debugger;
|
||||
//iterate the array of objects
|
||||
//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++) {
|
||||
if(obj[i].type){
|
||||
obj[i]["dataKey"]="c"+parseInt(obj[i].fld.replace( /^\D+/g, ''))
|
||||
}
|
||||
}
|
||||
|
||||
//return the whole thing again now translated
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
get(formKey) {
|
||||
return new Promise(function getFormTemplate(resolve) {
|
||||
@@ -15,7 +33,7 @@ export default {
|
||||
|
||||
store.commit("addFormCustomTemplateItem", {
|
||||
formKey: formKey,
|
||||
value: JSON.parse(res.data.template)
|
||||
value: addDataKeyNames(JSON.parse(res.data.template))
|
||||
});
|
||||
resolve();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user