This commit is contained in:
@@ -288,8 +288,8 @@ export default {
|
||||
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
//id 0 means create a new record don't load one
|
||||
if (this.$route.params.id != 0) {
|
||||
this.getDataFromApi(this.$route.params.id);
|
||||
if (this.$route.params.recordid != 0) {
|
||||
this.getDataFromApi(this.$route.params.recordid);
|
||||
} else {
|
||||
//setup for new record
|
||||
var readOnly = !this.rights.change;
|
||||
@@ -313,8 +313,8 @@ export default {
|
||||
},
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
//fetch the data for the record as if it's a new record
|
||||
if (to.params.id != 0) {
|
||||
this.getDataFromApi(to.params.id);
|
||||
if (to.params.recordid != 0) {
|
||||
this.getDataFromApi(to.params.recordid);
|
||||
}
|
||||
next();
|
||||
// react to route changes...
|
||||
@@ -485,7 +485,7 @@ export default {
|
||||
if (this.canSave) {
|
||||
this.formState.loading = true;
|
||||
var vm = this;
|
||||
var url = API_BASE_URL + this.$route.params.id;
|
||||
var url = API_BASE_URL + this.$route.params.recordid;
|
||||
|
||||
//clear any errors vm might be around from previous submit
|
||||
window.$gz.form.deleteAllErrorBoxErrors(this);
|
||||
@@ -531,13 +531,13 @@ export default {
|
||||
//do the delete
|
||||
vm.formState.loading = true;
|
||||
//No need to delete a new record, just abandon it...
|
||||
if (this.$route.params.id == 0) {
|
||||
if (this.$route.params.recordid == 0) {
|
||||
//this should not get offered for delete but to be safe and clear just in case:
|
||||
JUST_DELETED = true;
|
||||
// navigate backwards
|
||||
vm.$router.go(-1);
|
||||
} else {
|
||||
var url = API_BASE_URL + vm.$route.params.id;
|
||||
var url = API_BASE_URL + vm.$route.params.recordid;
|
||||
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
window.$gz.api
|
||||
@@ -567,10 +567,10 @@ export default {
|
||||
});
|
||||
},
|
||||
duplicate() {
|
||||
if (this.canDuplicate && this.$route.params.id != 0) {
|
||||
if (this.canDuplicate && this.$route.params.recordid != 0) {
|
||||
this.formState.loading = true;
|
||||
var vm = this;
|
||||
var url = API_BASE_URL + "duplicate/" + this.$route.params.id;
|
||||
var url = API_BASE_URL + "duplicate/" + this.$route.params.recordid;
|
||||
|
||||
//clear any errors vm might be around from previous submit
|
||||
window.$gz.form.deleteAllErrorBoxErrors(this);
|
||||
@@ -659,7 +659,7 @@ function generateMenu(vm) {
|
||||
formData: {
|
||||
formKey: FORM_KEY,
|
||||
ayaType: window.$gz.type.Widget,
|
||||
recordId: vm.$route.params.id,
|
||||
recordId: vm.$route.params.recordid,
|
||||
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY
|
||||
},
|
||||
menuItems: []
|
||||
|
||||
@@ -18,17 +18,10 @@ export default {
|
||||
components: {
|
||||
GzDataTable
|
||||
},
|
||||
beforeCreate() {
|
||||
window.$gz.eventBus.$emit("menu-change", {
|
||||
isMain: true,
|
||||
icon: "vial",
|
||||
title: window.$gz.locale.get("WidgetList"),
|
||||
helpUrl: "form-ay-data-list-view",
|
||||
menuItems: []
|
||||
});
|
||||
},
|
||||
created() {
|
||||
this.rights = window.$gz.role.getRights(window.$gz.type.Widget);
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
generateMenu(this);
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
||||
@@ -38,7 +31,8 @@ export default {
|
||||
currentListViewId: 1,
|
||||
dataListKey: "TestWidgetDataList",
|
||||
dataListFilter: "",
|
||||
dataListSort: ""
|
||||
dataListSort: "",
|
||||
rights: window.$gz.role.defaultRightsObject()
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -58,6 +52,12 @@ function clickHandler(menuItem) {
|
||||
var m = window.$gz.menu.parseMenuItem(menuItem);
|
||||
if (m.owner == FORM_KEY && !m.disabled) {
|
||||
switch (m.key) {
|
||||
case "new":
|
||||
m.vm.$router.push({
|
||||
name: "inventory-widget-edit",
|
||||
params: { recordid: 0 }
|
||||
});
|
||||
break;
|
||||
default:
|
||||
window.$gz.eventBus.$emit(
|
||||
"notify-warning",
|
||||
@@ -66,4 +66,45 @@ function clickHandler(menuItem) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
//
|
||||
//
|
||||
function generateMenu(vm) {
|
||||
var menuOptions = {
|
||||
isMain: true,
|
||||
icon: "vial",
|
||||
title: window.$gz.locale.get("WidgetList"),
|
||||
helpUrl: "form-ay-data-list-view",
|
||||
menuItems: []
|
||||
};
|
||||
|
||||
if (vm.rights.change) {
|
||||
menuOptions.menuItems.push({
|
||||
title: window.$gz.locale.get("New"),
|
||||
icon: "plus",
|
||||
surface: true,
|
||||
key: FORM_KEY + ":new",
|
||||
vm: vm
|
||||
});
|
||||
}
|
||||
|
||||
//STUB REPORTS
|
||||
//Report not Print, print is a further option
|
||||
menuOptions.menuItems.push({
|
||||
title: window.$gz.locale.get("Report"),
|
||||
icon: "file-alt",
|
||||
key: FORM_KEY + ":report",
|
||||
vm: vm
|
||||
});
|
||||
|
||||
menuOptions.menuItems.push({
|
||||
title: "stub: Last report used",
|
||||
icon: "file-alt",
|
||||
key: FORM_KEY + ":report:STUBlastusedreportid",
|
||||
vm: vm
|
||||
});
|
||||
|
||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user