This commit is contained in:
2020-08-31 21:57:08 +00:00
parent ddac23546f
commit d8dfaaa5f3
2 changed files with 62 additions and 6 deletions

View File

@@ -123,12 +123,18 @@ export default {
vm.formState.readOnly = !vm.rights.change;
window.$gz.eventBus.$on("menu-click", clickHandler);
//route params MUST have ID LIST
if (!vm.$route.params.idList) {
}
vm.idList = vm.$route.params.idList;
//id 0 means create a new record don't load one
if (vm.$route.params.recordid != 0) {
//is there already an obj from a prior operation?
if (this.$route.params.obj) {
if (vm.$route.params.obj) {
//yes, no need to fetch it
this.obj = this.$route.params.obj;
vm.obj = vm.$route.params.obj;
window.$gz.form.setFormState({
vm: vm,
loading: false
@@ -137,6 +143,8 @@ export default {
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
}
} else {
//New record so there *MUST* be an ayType on the route params
window.$gz.form.setFormState({
vm: vm,
loading: false
@@ -188,7 +196,7 @@ export default {
data() {
return {
//editor: null,
reportData: [],
editAreaHeight: 300,
activeTab: "properties",
lastTab: "properties",
@@ -677,7 +685,7 @@ function generateMenu(vm) {
//
async function initForm(vm) {
await fetchTranslatedText(vm);
// await populateSelectionLists(vm);
await fetchReportData(vm);
}
//////////////////////////////////////////////////////////
@@ -693,4 +701,32 @@ async function fetchTranslatedText(vm) {
"ReportTemplate"
]);
}
////////////////////
//
async function fetchReportData(vm) {
let idList = vm.$route.params.idList;
vm.obj.objectType = vm.$route.params.ayaType;
if (!idList || idList.length == 0) {
throw "ay-report-edit:fetchReportData - route parameter idList is missing or empty, unable to init report designer";
}
if (vm.obj.objectType == null) {
throw "ay-report-edit:fetchReportData - route parameter ayaType is missing or empty, unable to init report designer";
}
/* public class ObjectReportDataParameter
{
public AyaType ObjectType { get; set; }
public long[] ObjectIdArray { get; set; }
} */
let res = await window.$gz.api.upsert("report/object-report-data", {
ObjectType: vm.obj.objectType,
ObjectIdArray: idList
});
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
throw res;
} else {
vm.reportData = res.data;
}
}
</script>