This commit is contained in:
@@ -106,15 +106,6 @@ export default {
|
||||
//set route values in data object so init form can handle
|
||||
vm.dataListKey = this.$route.params.dataListKey;
|
||||
vm.listViewId = this.$route.params.listViewId;
|
||||
// //rehydrate last form settings
|
||||
// var formSettings = window.$gz.form.getFormSettings(this.formKey);
|
||||
|
||||
// window.$gz.form.setFormSettings(that.formKey, {
|
||||
// temp: { page: that.dataTablePagingOptions.page },
|
||||
// saved: {
|
||||
// itemsPerPage: that.dataTablePagingOptions.itemsPerPage
|
||||
// }
|
||||
// });
|
||||
|
||||
initForm(vm)
|
||||
.then(() => {
|
||||
@@ -132,19 +123,10 @@ export default {
|
||||
vm.formState.ready = true;
|
||||
window.$gz.errorHandler.handleFormError(err);
|
||||
});
|
||||
|
||||
// vm.dataListKey = this.$route.params.dataListKey;
|
||||
// vm.recordid = this.$route.params.recordid;
|
||||
// window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
// //NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here
|
||||
// //modify the menu as necessary
|
||||
// generateMenu(this, false); //default is never read only and passing in this vm
|
||||
// //init disable save button so it can be enabled only on edit to show dirty form
|
||||
// window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
obj: [],
|
||||
obj: [], //working copy driving UI
|
||||
listViewId: null,
|
||||
dataListKey: null,
|
||||
fieldDefinitions: [],
|
||||
@@ -177,21 +159,6 @@ export default {
|
||||
this.formState.dirty = true;
|
||||
enableSaveButton();
|
||||
},
|
||||
requiredChanged: function(item) {
|
||||
//Note: stock items can't be changed so no need to take that into account
|
||||
if (item.required && item.visible == false) {
|
||||
item.visible = true;
|
||||
}
|
||||
this.formState.dirty = true;
|
||||
enableSaveButton();
|
||||
},
|
||||
filterChanged: function() {
|
||||
console.log(this.selectedDataListView);
|
||||
alert("STUB:FILTER SELECTED");
|
||||
// //nothing to scan here just set form dirty
|
||||
// this.formState.dirty = true;
|
||||
// enableSaveButton();
|
||||
},
|
||||
submit() {
|
||||
var vm = this;
|
||||
var url = API_BASE_URL + this.formCustomTemplateKey;
|
||||
@@ -336,8 +303,9 @@ function generateMenu(vm) {
|
||||
//
|
||||
//
|
||||
function initForm(vm) {
|
||||
return Promise.resolve();
|
||||
//return populatePickLists(vm);
|
||||
//fieldDefinitions
|
||||
//return Promise.resolve();
|
||||
return populateFieldDefinitions(vm);
|
||||
//If need to call more then...:
|
||||
// .then(() => {
|
||||
// //Must use return here
|
||||
@@ -345,22 +313,41 @@ function initForm(vm) {
|
||||
// });
|
||||
}
|
||||
|
||||
// ////////////////////
|
||||
// //
|
||||
// function populatePickLists(vm) {
|
||||
// //http://localhost:7575/api/v8/DataListView/PickList?ListKey=TestWidgetDataList
|
||||
// return window.$gz.api
|
||||
// .get("DataListView/PickList?ListKey=" + vm.$route.params.dataListKey)
|
||||
// .then(res => {
|
||||
// if (res.error != undefined) {
|
||||
// window.$gz.errorHandler.handleFormError(res.error, vm);
|
||||
// } else {
|
||||
// vm.pickLists.availableDataListViews = res.data;
|
||||
// window.$gz.form.addNoSelectionItem(vm.pickLists.availableDataListViews);
|
||||
// //vm.pickLists.availableDataListViews.unshift({ name: "-", id: 0 });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
////////////////////
|
||||
//
|
||||
function populateFieldDefinitions(vm) {
|
||||
//http://localhost:7575/api/v8/DataList/ListFields?DataListKey=TestWidgetDataList
|
||||
return window.$gz.api
|
||||
.get("DataList/ListFields?DataListKey=" + vm.dataListKey)
|
||||
.then(res => {
|
||||
if (res.error != undefined) {
|
||||
window.$gz.errorHandler.handleFormError(res.error, vm);
|
||||
} else {
|
||||
vm.fieldDefinitions = res.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// Ensures column names are present in locale table
|
||||
//
|
||||
function fetchLocalizedFieldNames(vm) {
|
||||
var columnKeys = [];
|
||||
for (var i = 1; i < vm.fieldDefinitions.length; i++) {
|
||||
var cm = vm.fieldDefinitions[i];
|
||||
columnKeys.push(cm.ltKey);
|
||||
}
|
||||
//Now fetch all the keys and await the response before returning
|
||||
return window.$gz.locale
|
||||
.fetch(columnKeys)
|
||||
.then(() => {
|
||||
return;
|
||||
})
|
||||
.catch(err => {
|
||||
window.$gz.errorHandler.handleFormError(err);
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////
|
||||
//
|
||||
@@ -418,6 +405,290 @@ function initDataObject(vm) {
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"fieldKey": "df",
|
||||
"ltKey": null,
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 2
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetname",
|
||||
"ltKey": "WidgetName",
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 4,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 2
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetserial",
|
||||
"ltKey": "WidgetSerial",
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 5,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetdollaramount",
|
||||
"ltKey": "WidgetDollarAmount",
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 8,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcount",
|
||||
"ltKey": "WidgetCount",
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 5,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetusertype",
|
||||
"ltKey": "WidgetUserType",
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 10,
|
||||
"enumType": "UserType",
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetstartdate",
|
||||
"ltKey": "WidgetStartDate",
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 1,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetenddate",
|
||||
"ltKey": "WidgetEndDate",
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 1,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetnotes",
|
||||
"ltKey": "WidgetNotes",
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 4,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "username",
|
||||
"ltKey": "User",
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 4,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 3
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetactive",
|
||||
"ltKey": "Active",
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 6,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgettags",
|
||||
"ltKey": "Tags",
|
||||
"isCustomField": false,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 9,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom1",
|
||||
"ltKey": "WidgetCustom1",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom2",
|
||||
"ltKey": "WidgetCustom2",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom3",
|
||||
"ltKey": "WidgetCustom3",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom4",
|
||||
"ltKey": "WidgetCustom4",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom5",
|
||||
"ltKey": "WidgetCustom5",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom6",
|
||||
"ltKey": "WidgetCustom6",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom7",
|
||||
"ltKey": "WidgetCustom7",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom8",
|
||||
"ltKey": "WidgetCustom8",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom9",
|
||||
"ltKey": "WidgetCustom9",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom10",
|
||||
"ltKey": "WidgetCustom10",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom11",
|
||||
"ltKey": "WidgetCustom11",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom12",
|
||||
"ltKey": "WidgetCustom12",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom13",
|
||||
"ltKey": "WidgetCustom13",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom14",
|
||||
"ltKey": "WidgetCustom14",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom15",
|
||||
"ltKey": "WidgetCustom15",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
},
|
||||
{
|
||||
"fieldKey": "widgetcustom16",
|
||||
"ltKey": "WidgetCustom16",
|
||||
"isCustomField": true,
|
||||
"isFilterable": true,
|
||||
"isSortable": true,
|
||||
"uiFieldDataType": 0,
|
||||
"enumType": null,
|
||||
"ayaObjectType": 0
|
||||
}
|
||||
],
|
||||
"readOnly": true
|
||||
}
|
||||
*/
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user