This commit is contained in:
2020-09-01 15:43:05 +00:00
parent d646306958
commit 1effb6ccb2
4 changed files with 64 additions and 9 deletions

View File

@@ -456,6 +456,20 @@ export default {
refresh() { refresh() {
this.getDataFromApi(); this.getDataFromApi();
}, },
getRowIds() {
//get selected row id's if there are selections else get all row id's
//called into from parent for things like reporting or bulk ops
if (this.selected.length > 0) {
//return row id's of selected items only
}
if (this.records.length > 0) {
//return row id's of all items
}
//no data, just return an empty array
return [];
// console.log("records:", this.records);
// console.log("selected:", this.selected);
},
handleSelectChange() { handleSelectChange() {
//due to making own template for items need to handle singleselect which only affects if select all checkbox at top is visible when making own item template //due to making own template for items need to handle singleselect which only affects if select all checkbox at top is visible when making own item template
if (this.singleSelect) { if (this.singleSelect) {

View File

@@ -135,6 +135,9 @@ decision: how to handle opening report templates in the UI - should every report
working widget template working widget template
Immediately render last report code needs proper implementation for both widget and widgets
currently it's nonsense
print / preview coded to work with saved report and renders print / preview coded to work with saved report and renders
build release for joyce to play with and give feedback build release for joyce to play with and give feedback

View File

@@ -630,7 +630,7 @@ async function clickHandler(menuItem) {
break; break;
case "report": case "report":
if (m.id != null) { if (m.id != null) {
//last report selected //last report selected is in m.id
m.vm.$router.push({ m.vm.$router.push({
name: "ay-report", name: "ay-report",
params: { recordid: m.id, ayatype: window.$gz.type.Widget } params: { recordid: m.id, ayatype: window.$gz.type.Widget }
@@ -704,7 +704,7 @@ function generateMenu(vm) {
}); });
} }
//STUB REPORTS //REPORTS
//Report not Print, print is a further option //Report not Print, print is a further option
menuOptions.menuItems.push({ menuOptions.menuItems.push({
title: "Report", title: "Report",

View File

@@ -1,5 +1,6 @@
<template> <template>
<div> <div>
<gz-report-selector ref="reportSelector"></gz-report-selector>
<gz-extensions <gz-extensions
:ayaType="ayType" :ayaType="ayType"
:selectedItems="selectedItems" :selectedItems="selectedItems"
@@ -7,6 +8,7 @@
> >
</gz-extensions> </gz-extensions>
<gz-data-table <gz-data-table
ref="gzdatatable"
formKey="widget-list" formKey="widget-list"
:dataListKey="dataListKey" :dataListKey="dataListKey"
:dataListFilter="dataListFilter" :dataListFilter="dataListFilter"
@@ -66,6 +68,38 @@ async function clickHandler(menuItem) {
case "extensions": case "extensions":
let res = await m.vm.$refs.extensions.open(); let res = await m.vm.$refs.extensions.open();
break; break;
case "report":
if (m.id != null) {
//last report selected is in m.id
m.vm.$router.push({
name: "ay-report",
params: { recordid: m.id, ayatype: window.$gz.type.Widget }
});
} else {
//general report selector chosen
m.vm.$refs.gzdatatable.getRowIds();
return;
let res = await m.vm.$refs.reportSelector.open(
window.$gz.type.Widget,
[m.vm.getSelection()]
);
//if null for no selection
//just bail out
if (res == null) {
return;
}
//persist last report selected
window.$gz.form.setLastReport(FORM_KEY, res);
//Now open the report viewer...
m.vm.$router.push({
name: "ay-report",
params: { recordid: res.id, ayatype: window.$gz.type.Widget }
});
}
break;
default: default:
window.$gz.eventBus.$emit( window.$gz.eventBus.$emit(
@@ -101,7 +135,7 @@ function generateMenu(vm) {
}); });
} }
//STUB REPORTS //REPORTS
//Report not Print, print is a further option //Report not Print, print is a further option
menuOptions.menuItems.push({ menuOptions.menuItems.push({
title: "Report", title: "Report",
@@ -110,12 +144,16 @@ function generateMenu(vm) {
vm: vm vm: vm
}); });
menuOptions.menuItems.push({ //get last report selected
title: "stub: Last report used", let lastReport = window.$gz.form.getLastReport(FORM_KEY);
icon: "fa-file-alt", if (lastReport != null) {
key: FORM_KEY + ":report:STUBlastusedreportid", menuOptions.menuItems.push({
vm: vm title: lastReport.name,
}); icon: "fa-file-alt",
key: FORM_KEY + ":report:" + lastReport.id,
vm: vm
});
}
menuOptions.menuItems.push({ menuOptions.menuItems.push({
title: "Extensions", title: "Extensions",