This commit is contained in:
2020-01-30 21:30:59 +00:00
parent 1b0a98095c
commit e028b609ac
3 changed files with 98 additions and 9 deletions

View File

@@ -218,7 +218,7 @@
import ayaNovaVersion from "./api/ayanova-version";
import gzconfirm from "./components/gzconfirm";
import gznotify from "./components/gznotify";
//import gztest from "./components/gztest";
import openObjectHandler from "./api/open-object-handler";
export default {
components: {
@@ -241,12 +241,12 @@ export default {
created() {
//////////////////////////////////
// WIRE UP
// MENU and DIALOG EVENT HANDLERS
// ON GZEVENTBUS
// EVENT HANDLERS ON GZEVENTBUS
//
//
window.$gz.menu.wireUpEventHandlers(this);
window.$gz.dialog.wireUpEventHandlers(this);
openObjectHandler.wireUpEventHandlers(this);
},
beforeDestroy() {
//UNWIRE ALL EVENT HANDLERS FROM GZEVENTBUS

View File

@@ -0,0 +1,90 @@
/* xxxeslint-disable */
export default {
///////////////////////////////
// APP (GLOBAL) openobject CLICK HANDLER
//
// Deal with a request to open an object (from main datatables mainly)
// called from App.vue
handleOpenObjectClick(vm, menuItem) {
//Key will start with the string "app:" if it's a global application command that should be handled here,
//otherwise it's a local command for a local form only
//If there is any extended information required for the command it will be in the data property of the menu item
//split a key into component parts, part one is the responsible party, part two is the command, part three only exists to make it unique if necessary
//each part is separated by a colon
//Handle different items
var item = this.parseMenuItem(menuItem);
if (!item.disabled && item.owner == "app") {
switch (item.key) {
case "help":
var helpurl = vm.$store.state.helpUrl + item.data;
window.open(helpurl, "_blank");
break;
case "search":
vm.$router.push({
name: "home-search",
params: { ayatype: item.data }
});
break;
case "attachments":
vm.$router.push({
name: "ay-attachments",
params: { ayatype: item.data.ayaType, recordid: item.data.recordId }
});
break;
case "wiki":
vm.$router.push({
name: "ay-wiki",
params: { ayatype: item.data.ayaType, recordid: item.data.recordId }
});
break;
case "review":
vm.$router.push({
name: "ay-review",
params: { ayatype: item.data.ayaType, recordid: item.data.recordId }
});
break;
case "history":
vm.$router.push({
name: "ay-history",
params: { ayatype: item.data.ayaType, recordid: item.data.recordId }
});
break;
case "logout":
vm.$router.push("/login");
break;
case "customize":
vm.$router.push({
name: "ay-customize",
params: { formCustomTemplateKey: item.data }
});
break;
case "nav":
vm.$router.push({ name: item.data });
break;
default:
window.$gz.eventBus.$emit(
"notify-warning",
"gzmenu:handleAppClick - unrecognized command [" +
menuItem.key +
"]"
);
}
}
},
///////////////////////////////////
// WIRE UP MENU EVENTS
//
// called once from app.vue only
//
wireUpEventHandlers(vm) {
var self = this;
window.$gz.eventBus.$on("openobject", function handleOpenObjectClick(data) {
self.handleAppClick(vm, data);
});
}
//new functions above here
};

View File

@@ -64,10 +64,10 @@
</tbody>
</template>
</v-data-table>
<hr />
<!-- <hr />
<div>Headers: {{ headers }}</div>
<div>Records: {{ records }}</div>
<!-- <div>TotalRecords: {{ totalRecords }}</div>
<div>TotalRecords: {{ totalRecords }}</div>
<div>caption: {{ caption }}</div>
<div>apiBaseUrl: {{ apiBaseUrl }}</div>
<div>formKey: {{ formKey }}</div>
@@ -82,9 +82,6 @@
/* Xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
created() {
//console.log("gz-data-table viewport is XS = " + this.mini());
},
data() {
return {
loading: true,
@@ -134,7 +131,9 @@ export default {
var typeToOpen = this.serverColumns[key.split("-")[1]].ay;
//i is the actual AyaNova index of that record so we have all we need to open that object
alert("STUB: Open object type " + typeToOpen + " with record id of " + i);
window.$gz.eventBus.$emit("openobject", { type: typeToOpen, id: i });
// this.$emit("OPENOBJECT", { type: typeToOpen, id: i });
// alert("STUB: Open object type " + typeToOpen + " with record id of " + i);
},
lt(ltKey) {
return window.$gz.locale.get(ltKey);