This commit is contained in:
2019-07-19 18:57:06 +00:00
parent 702e632dde
commit 1bc7084d3b
18 changed files with 54 additions and 46 deletions

View File

@@ -38,7 +38,7 @@
v-if="item.surface" v-if="item.surface"
:key="item.key" :key="item.key"
:disabled="item.disabled" :disabled="item.disabled"
@click="$gzevent.$emit('menu-click', item)" @click="window.$gz.eventbus.$emit('menu-click', item)"
> >
<v-icon :color="item.color ? item.color : ''"> <v-icon :color="item.color ? item.color : ''">
{{ "fa-" + item.icon }} {{ "fa-" + item.icon }}
@@ -66,7 +66,7 @@
v-else v-else
:key="item.key" :key="item.key"
:disabled="item.disabled" :disabled="item.disabled"
@click="$gzevent.$emit('menu-click', item)" @click="window.$gz.eventbus.$emit('menu-click', item)"
v-bind:class="{ 'hidden-sm-and-up': item.surface }" v-bind:class="{ 'hidden-sm-and-up': item.surface }"
> >
<v-list-tile-action> <v-list-tile-action>
@@ -136,12 +136,12 @@ export default {
// ON GZEVENTBUS // ON GZEVENTBUS
// //
// //
this.$gzmenu.wireUpEventHandlers(this); window.$gz.menu.wireUpEventHandlers(this);
this.$gzdialog.wireUpEventHandlers(this); this.$gzdialog.wireUpEventHandlers(this);
}, },
beforeDestroy() { beforeDestroy() {
//UNWIRE ALL EVENT HANDLERS FROM GZEVENTBUS //UNWIRE ALL EVENT HANDLERS FROM GZEVENTBUS
this.$gzevent.$off(); this.window.$gz.eventbus.$off();
}, },
mounted() { mounted() {
//redirect to login if not authenticated //redirect to login if not authenticated

View File

@@ -17,7 +17,7 @@ export default {
/////////// ///////////
//ERROR //ERROR
vm.$gzevent.$on("notify-error", function handleNotifyWarn(msg) { window.$gz.eventbus.$on("notify-error", function handleNotifyWarn(msg) {
vm.$dialog.notify.info(msg, { vm.$dialog.notify.info(msg, {
position: "bottom-right", position: "bottom-right",
icon: "fa-exclamation-triangle", icon: "fa-exclamation-triangle",
@@ -27,7 +27,7 @@ export default {
/////////// ///////////
//WARNING //WARNING
vm.$gzevent.$on("notify-warning", function handleNotifyWarn(msg) { window.$gz.eventbus.$on("notify-warning", function handleNotifyWarn(msg) {
vm.$dialog.notify.warning(msg, { vm.$dialog.notify.warning(msg, {
position: "bottom-right", position: "bottom-right",
icon: "fa-exclamation", icon: "fa-exclamation",
@@ -37,7 +37,7 @@ export default {
/////////// ///////////
//INFO //INFO
vm.$gzevent.$on("notify-info", function handleNotifyWarn(msg) { window.$gz.eventbus.$on("notify-info", function handleNotifyWarn(msg) {
vm.$dialog.notify.info(msg, { vm.$dialog.notify.info(msg, {
position: "bottom-right", position: "bottom-right",
icon: "fa-info-circle", icon: "fa-info-circle",
@@ -47,7 +47,7 @@ export default {
/////////// ///////////
//SUCCESS //SUCCESS
vm.$gzevent.$on("notify-success", function handleNotifyWarn(msg) { window.$gz.eventbus.$on("notify-success", function handleNotifyWarn(msg) {
vm.$dialog.notify.success(msg, { vm.$dialog.notify.success(msg, {
position: "bottom-right", position: "bottom-right",
icon: "fa-check-circle ", icon: "fa-check-circle ",

View File

@@ -155,7 +155,7 @@ export default {
vm.$router.push({ name: item.data }); vm.$router.push({ name: item.data });
break; break;
default: default:
vm.$gzevent.$emit( window.$gz.eventbus.$emit(
"notify-warning", "notify-warning",
"gzmenu:handleAppClick - unrecognized command [" + "gzmenu:handleAppClick - unrecognized command [" +
menuItem.key + menuItem.key +
@@ -189,25 +189,29 @@ export default {
// //
wireUpEventHandlers(vm) { wireUpEventHandlers(vm) {
var self = this; var self = this;
vm.$gzevent.$on("menu-change", function handleMenuChange(ctx) { window.$gz.eventbus.$on("menu-change", function handleMenuChange(ctx) {
self.handleMenuChange(vm, ctx); self.handleMenuChange(vm, ctx);
}); });
vm.$gzevent.$on("menu-replace-item", function handleReplaceMenuItem( window.$gz.eventbus.$on("menu-replace-item", function handleReplaceMenuItem(
newItem newItem
) { ) {
self.handleReplaceMenuItem(vm, newItem); self.handleReplaceMenuItem(vm, newItem);
}); });
vm.$gzevent.$on("menu-disable-item", function handleDisableMenuItem(key) { window.$gz.eventbus.$on("menu-disable-item", function handleDisableMenuItem(
key
) {
self.handleDisableMenuItem(vm, key, true); self.handleDisableMenuItem(vm, key, true);
}); });
vm.$gzevent.$on("menu-enable-item", function handleDisableMenuItem(key) { window.$gz.eventbus.$on("menu-enable-item", function handleDisableMenuItem(
key
) {
self.handleDisableMenuItem(vm, key, false); self.handleDisableMenuItem(vm, key, false);
}); });
vm.$gzevent.$on("menu-click", function handleMenuClick(menuitem) { window.$gz.eventbus.$on("menu-click", function handleMenuClick(menuitem) {
self.handleAppClick(vm, menuitem); self.handleAppClick(vm, menuitem);
}); });
} }

View File

@@ -201,7 +201,7 @@ export default {
}); });
}, },
filterMe() { filterMe() {
this.$gzevent.$emit( window.$gz.eventbus.$emit(
"notify-info", "notify-info",
"inventoryWidgetList::filterMe -> STUB (selected items count=" + "inventoryWidgetList::filterMe -> STUB (selected items count=" +
this.selected.length + this.selected.length +

View File

@@ -61,9 +61,9 @@ window.$gz = {
}; };
window.$gzlocale = locale; window.$gzlocale = locale;
window.$gzformcustomtemplate = gzformcustomtemplate; window.$gzformcustomtemplate = gzformcustomtemplate;
Object.defineProperty(Vue.prototype, "$gztype", { value: gztype }); //Object.defineProperty(Vue.prototype, "$gztype", { value: gztype });
Object.defineProperty(Vue.prototype, "$gzrole", { value: roles }); //Object.defineProperty(Vue.prototype, "$gzrole", { value: roles });
Object.defineProperty(Vue.prototype, "$gzevent", { value: gzeventbus }); //Object.defineProperty(Vue.prototype, "$gzevent", { value: gzeventbus });
Object.defineProperty(Vue.prototype, "$gzmenu", { value: gzmenu }); Object.defineProperty(Vue.prototype, "$gzmenu", { value: gzmenu });
Object.defineProperty(Vue.prototype, "$gzdialog", { value: gzdialog }); Object.defineProperty(Vue.prototype, "$gzdialog", { value: gzdialog });
Object.defineProperty(Vue.prototype, "$gzutil", { value: gzutil }); Object.defineProperty(Vue.prototype, "$gzutil", { value: gzutil });

View File

@@ -178,7 +178,7 @@ function clickHandler(menuItem) {
if (!menuItem) { if (!menuItem) {
return; return;
} }
var m = this.$gzmenu.parseMenuItem(menuItem); var m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == "about" && !m.disabled) { if (m.owner == "about" && !m.disabled) {
switch (m.key) { switch (m.key) {
case "copysupportinfo": case "copysupportinfo":
@@ -195,7 +195,7 @@ function clickHandler(menuItem) {
this.$gzutil.copyToClipboard(text + "\nCLIENT LOG\n" + logText); this.$gzutil.copyToClipboard(text + "\nCLIENT LOG\n" + logText);
break; break;
default: default:
m.vm.$gzevent.$emit( window.$gz.eventbus.$emit(
"notify-warning", "notify-warning",
"About.vue::context click: [" + m.key + "]" "About.vue::context click: [" + m.key + "]"
); );
@@ -236,7 +236,7 @@ export default {
.then(function() { .then(function() {
vm.formState.ready = true; vm.formState.ready = true;
vm.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: false, isMain: false,
icon: "fa-info-circle", icon: "fa-info-circle",
title: vm.$gzlocale.get("HelpAboutAyaNova"), title: vm.$gzlocale.get("HelpAboutAyaNova"),
@@ -257,7 +257,7 @@ export default {
} }
] ]
}); });
vm.$gzevent.$on("menu-click", clickHandler); window.$gz.eventbus.$on("menu-click", clickHandler);
}) })
.catch(err => { .catch(err => {
vm.formState.ready = true; vm.formState.ready = true;
@@ -274,9 +274,7 @@ export default {
throw error; throw error;
}); });
}, },
beforeDestroy() { beforeDestroy() {},
// this.$gzevent.$off("menu-click", clickHandler);
},
mounted() { mounted() {
this.clientInfo = {}; this.clientInfo = {};
this.clientInfo = aboutInfo; this.clientInfo = aboutInfo;

View File

@@ -10,7 +10,7 @@ export default {
HelloWorld HelloWorld
}, },
beforeCreate() { beforeCreate() {
this.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: true, isMain: true,
icon: "fa-home", icon: "fa-home",
title: this.$gzlocale.get("Home") title: this.$gzlocale.get("Home")

View File

@@ -10,7 +10,7 @@ export default {
UnderConstruction UnderConstruction
}, },
beforeCreate() { beforeCreate() {
this.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: true, isMain: true,
icon: "fa-file-invoice-dollar", icon: "fa-file-invoice-dollar",
title: this.$gzlocale.get("Accounting") title: this.$gzlocale.get("Accounting")

View File

@@ -10,7 +10,7 @@ export default {
UnderConstruction UnderConstruction
}, },
beforeCreate() { beforeCreate() {
this.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: true, isMain: true,
icon: "fa-user-tie", icon: "fa-user-tie",
title: this.$gzlocale.get("Administration") title: this.$gzlocale.get("Administration")

View File

@@ -10,7 +10,7 @@ export default {
UnderConstruction UnderConstruction
}, },
beforeCreate() { beforeCreate() {
this.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: true, isMain: true,
icon: "sliders-h", icon: "sliders-h",
title: this.$gzlocale.get("Customize") title: this.$gzlocale.get("Customize")

View File

@@ -10,7 +10,7 @@ export default {
UnderConstruction UnderConstruction
}, },
beforeCreate() { beforeCreate() {
this.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: true, isMain: true,
icon: "fa-shipping-fast", icon: "fa-shipping-fast",
title: this.$gzlocale.get("Dispatch") title: this.$gzlocale.get("Dispatch")

View File

@@ -262,7 +262,7 @@ export default {
created() { created() {
this.rights = window.$gz.role.getRights(this, window.$gz.type.Widget); this.rights = window.$gz.role.getRights(this, window.$gz.type.Widget);
this.$gzevent.$on("menu-click", clickHandler); window.$gz.eventbus.$on("menu-click", clickHandler);
//id 0 means create a new record don't load one //id 0 means create a new record don't load one
if (this.$route.params.id != 0) { if (this.$route.params.id != 0) {
this.getDataFromApi(this.$route.params.id); this.getDataFromApi(this.$route.params.id);
@@ -309,7 +309,7 @@ export default {
} }
}, },
beforeDestroy() { beforeDestroy() {
this.$gzevent.$off("menu-click", clickHandler); window.$gz.eventbus.$off("menu-click", clickHandler);
}, },
components: {}, components: {},
data() { data() {
@@ -358,17 +358,23 @@ export default {
//enable / disable save button //enable / disable save button
var canSave = val.dirty && val.valid && !val.readOnly; var canSave = val.dirty && val.valid && !val.readOnly;
if (canSave) { if (canSave) {
this.$gzevent.$emit("menu-enable-item", FORM_KEY + ":save"); window.$gz.eventbus.$emit("menu-enable-item", FORM_KEY + ":save");
} else { } else {
this.$gzevent.$emit("menu-disable-item", FORM_KEY + ":save"); window.$gz.eventbus.$emit("menu-disable-item", FORM_KEY + ":save");
} }
//enable / disable duplicate button //enable / disable duplicate button
var canDuplicate = !val.dirty && val.valid && !val.readOnly; var canDuplicate = !val.dirty && val.valid && !val.readOnly;
if (canDuplicate) { if (canDuplicate) {
this.$gzevent.$emit("menu-enable-item", FORM_KEY + ":duplicate"); window.$gz.eventbus.$emit(
"menu-enable-item",
FORM_KEY + ":duplicate"
);
} else { } else {
this.$gzevent.$emit("menu-disable-item", FORM_KEY + ":duplicate"); window.$gz.eventbus.$emit(
"menu-disable-item",
FORM_KEY + ":duplicate"
);
} }
}, },
deep: true deep: true
@@ -563,7 +569,7 @@ function clickHandler(menuItem) {
if (!menuItem) { if (!menuItem) {
return; return;
} }
var m = this.$gzmenu.parseMenuItem(menuItem); var m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) { if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) { switch (m.key) {
case "save": case "save":
@@ -582,7 +588,7 @@ function clickHandler(menuItem) {
.getReportChoice(m.vm, reportList, selectedItem) .getReportChoice(m.vm, reportList, selectedItem)
.then(res => { .then(res => {
if (res) { if (res) {
m.vm.$gzevent.$emit( window.$gz.eventbus.$emit(
"notify-success", "notify-success",
FORM_KEY + "::report click, selected is: [" + res + "]" FORM_KEY + "::report click, selected is: [" + res + "]"
); );
@@ -591,7 +597,7 @@ function clickHandler(menuItem) {
break; break;
default: default:
m.vm.$gzevent.$emit( window.$gz.eventbus.$emit(
"notify-warning", "notify-warning",
FORM_KEY + "::context click: [" + m.key + "]" FORM_KEY + "::context click: [" + m.key + "]"
); );
@@ -650,7 +656,7 @@ function generateMenu(vm) {
vm: vm vm: vm
}); });
vm.$gzevent.$emit("menu-change", menuOptions); window.$gz.eventbus.$emit("menu-change", menuOptions);
} }
var JUST_DELETED = false; var JUST_DELETED = false;

View File

@@ -60,7 +60,7 @@ export default {
}); });
}, },
created() { created() {
this.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: true, isMain: true,
icon: "fa-dolly", icon: "fa-dolly",
title: this.$gzlocale.get("Inventory") title: this.$gzlocale.get("Inventory")

View File

@@ -23,7 +23,7 @@
/* Xeslint-disable */ /* Xeslint-disable */
export default { export default {
created() { created() {
this.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: false, isMain: false,
icon: "fa-info-circle", icon: "fa-info-circle",
title: this.$gzlocale.get("Log"), title: this.$gzlocale.get("Log"),

View File

@@ -73,7 +73,7 @@ export default {
}; };
}, },
created() { created() {
this.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: true, isMain: true,
icon: "", icon: "",
title: "" title: ""

View File

@@ -16,7 +16,7 @@
<script> <script>
export default { export default {
beforeCreate() { beforeCreate() {
this.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: true, isMain: true,
icon: "fa-dragon", icon: "fa-dragon",
title: "404 - " + this.$gzlocale.get("ErrorAPI2010") title: "404 - " + this.$gzlocale.get("ErrorAPI2010")

View File

@@ -10,7 +10,7 @@ export default {
UnderConstruction UnderConstruction
}, },
beforeCreate() { beforeCreate() {
this.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: true, isMain: true,
icon: "fa-cogs", icon: "fa-cogs",
title: this.$gzlocale.get("Operations") title: this.$gzlocale.get("Operations")

View File

@@ -10,7 +10,7 @@ export default {
UnderConstruction UnderConstruction
}, },
beforeCreate() { beforeCreate() {
this.$gzevent.$emit("menu-change", { window.$gz.eventbus.$emit("menu-change", {
isMain: true, isMain: true,
icon: "fa-toolbox", icon: "fa-toolbox",
title: this.$gzlocale.get("Service") title: this.$gzlocale.get("Service")