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-text style="height: 500px;">
<v-list>
<v-list-item
v-for="item in reportList"
:key="item.id"
@click="renderReport(item.id)"
>
<v-list-item-title>{{ item.name }}</v-list-item-title>
<v-list-item-action>
<v-btn icon @click.stop="editReport(item.id)">
@@ -32,7 +30,7 @@
</v-list>
</v-card-text>
<v-divider></v-divider>
<v-divider></v-divider>
<v-card-actions>
<v-btn
@@ -73,10 +71,18 @@ export default {
}),
methods: {
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) {
console.log("RENDER REPORT", reportid);
alert(`RENDER REPORT ${reportid}`);
},
async open(reportDataOptions) {
let vm = this;
@@ -111,9 +117,11 @@ export default {
} else {
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;
return new Promise((resolve, reject) => {
@@ -121,10 +129,10 @@ export default {
this.reject = reject;
});
},
ok() {
this.isVisible = false;
this.resolve(this.selectedReport);
},
// ok() {
// this.isVisible = false;
// this.resolve(this.selectedReport);
// },
cancel() {
this.isVisible = false;
this.resolve(null);

View File

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