This commit is contained in:
2020-09-02 15:10:20 +00:00
parent 994015a504
commit fefee9fa73
2 changed files with 38 additions and 50 deletions

View File

@@ -14,14 +14,12 @@
</v-card-title> </v-card-title>
<v-card-text style="height: 500px;"> <v-card-text style="height: 500px;">
<v-list> <v-list>
<v-list-item <v-list-item
v-for="item in reportList" v-for="item in reportList"
:key="item.id" :key="item.id"
@click="renderReport(item.id)" @click="renderReport(item.id)"
> >
<v-list-item-title>{{ item.name }}</v-list-item-title> <v-list-item-title>{{ item.name }}</v-list-item-title>
<v-list-item-action> <v-list-item-action>
<v-btn icon @click.stop="editReport(item.id)"> <v-btn icon @click.stop="editReport(item.id)">
@@ -32,7 +30,7 @@
</v-list> </v-list>
</v-card-text> </v-card-text>
<v-divider></v-divider> <v-divider></v-divider>
<v-card-actions> <v-card-actions>
<v-btn <v-btn
@@ -73,10 +71,18 @@ export default {
}), }),
methods: { methods: {
editReport(reportid) { editReport(reportid) {
console.log("EDIT", reportid); this.isVisible = false;
this.resolve(null);
this.$router.push({
name: "ay-report-edit",
params: {
recordid: reportid,
reportDataOptions: this.reportDataOptions
}
});
}, },
renderReport(reportid) { renderReport(reportid) {
console.log("RENDER REPORT", reportid); alert(`RENDER REPORT ${reportid}`);
}, },
async open(reportDataOptions) { async open(reportDataOptions) {
let vm = this; let vm = this;
@@ -111,9 +117,11 @@ export default {
} else { } else {
this.reportList = res.data; this.reportList = res.data;
} }
for (let x = 20; x < 60; x++) {
this.reportList.push({ name: "REPORT NAME HERE", id: x }); //TESTING generate extra items
} // for (let x = 20; x < 60; x++) {
// this.reportList.push({ name: "REPORT NAME HERE", id: x });
// }
this.isVisible = true; this.isVisible = true;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@@ -121,10 +129,10 @@ export default {
this.reject = reject; this.reject = reject;
}); });
}, },
ok() { // ok() {
this.isVisible = false; // this.isVisible = false;
this.resolve(this.selectedReport); // this.resolve(this.selectedReport);
}, // },
cancel() { cancel() {
this.isVisible = false; this.isVisible = false;
this.resolve(null); this.resolve(null);

View File

@@ -1,6 +1,6 @@
<template> <template>
<div v-resize="onResize"> <div v-resize="onResize">
{{ formState }} <!-- {{ formState }} -->
<v-row> <v-row>
<v-col cols="12" sm="6" class="py-2"> <v-col cols="12" sm="6" class="py-2">
<v-btn-toggle <v-btn-toggle
@@ -31,8 +31,8 @@
Helpers Helpers
</v-btn> </v-btn>
<v-btn value="rawData"> <v-btn value="rawData" v-if="reportData != null">
Data {{ $ay.t("ReportEditorData") }}
</v-btn> </v-btn>
</v-btn-toggle> </v-btn-toggle>
</v-col> </v-col>
@@ -175,9 +175,9 @@ export default {
window.$gz.eventBus.$on("menu-click", clickHandler); window.$gz.eventBus.$on("menu-click", clickHandler);
//route params MUST have source data //route params MUST have source data
if (!vm.$route.params.reportDataOptions) { // if (!vm.$route.params.reportDataOptions) {
throw "ay-report-edit::created - missing reportDataOptions route parameter"; // throw "ay-report-edit::created - missing reportDataOptions route parameter";
} // }
//id 0 means create a new record don't load one //id 0 means create a new record don't load one
if (vm.$route.params.recordid != 0) { if (vm.$route.params.recordid != 0) {
@@ -216,10 +216,12 @@ export default {
"javascript" "javascript"
); );
vm.editData.rawData.model = monaco.editor.createModel( if (vm.reportData != null) {
JSON.stringify(vm.reportData, null, "\t"), vm.editData.rawData.model = monaco.editor.createModel(
"json" JSON.stringify(vm.reportData, null, "\t"),
); "json"
);
}
vm.editData.jsHelpers.model = monaco.editor.createModel( vm.editData.jsHelpers.model = monaco.editor.createModel(
vm.obj.jsHelpers, vm.obj.jsHelpers,
@@ -324,8 +326,8 @@ export default {
name: "report", name: "report",
active: true, active: true,
notes: "", notes: "",
roles: null, roles: 124927, //all except customers
objectType: 124927, //all except customers objectType: 0,
template: `console.log('hello world');`, template: `console.log('hello world');`,
style: `.example { style: `.example {
color: blue; color: blue;
@@ -717,32 +719,7 @@ async function clickHandler(menuItem) {
case "duplicate": case "duplicate":
m.vm.duplicate(); m.vm.duplicate();
break; break;
case "report":
if (m.id != null) {
//last report selected
m.vm.$router.push({
name: "ay-report",
params: { recordid: m.id, ayatype: window.$gz.type.Widget }
});
} else {
//general report selector chosen
let res = await m.vm.$refs.reportSelector.open();
//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(
"notify-warning", "notify-warning",
@@ -845,6 +822,7 @@ async function fetchTranslatedText(vm) {
"ReportDesignReport", "ReportDesignReport",
"ReportName", "ReportName",
"ReportEditorProperties", "ReportEditorProperties",
"ReportEditorData",
"ReportNotes", "ReportNotes",
"ReportTemplate", "ReportTemplate",
"AuthorizationRoles" "AuthorizationRoles"
@@ -862,7 +840,9 @@ async function fetchReportData(vm) {
let reportDataOptions = vm.$route.params.reportDataOptions; let reportDataOptions = vm.$route.params.reportDataOptions;
if (!reportDataOptions) { if (!reportDataOptions) {
throw "ay-report-edit:fetchReportData - route parameter reportDataOptions is missing or empty, unable to init report designer"; vm.reportData = null;
return;
// throw "ay-report-edit:fetchReportData - route parameter reportDataOptions is missing or empty, unable to init report designer";
} }
if (reportDataOptions.ObjectType == null) { if (reportDataOptions.ObjectType == null) {
throw "ay-report-edit:fetchReportData - route parameter ObjectType is missing or empty, unable to init report designer"; throw "ay-report-edit:fetchReportData - route parameter ObjectType is missing or empty, unable to init report designer";