This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
<v-card elevation="24">
|
<v-card elevation="24">
|
||||||
<v-card-title class="headline lighten-2" primary-title>
|
<v-card-title class="headline lighten-2" primary-title>
|
||||||
<span> {{ $ay.t("Report") }} </span>
|
<span> {{ $ay.t("Report") }} </span>
|
||||||
TYPE: {{ ayaType }}, idList:{{ idList }}
|
TYPE: {{ ayaType }}, idList:{{ idList }} rights: {{ rights }}
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
|
|
||||||
<v-card-text style="height: 500px;">
|
<v-card-text style="height: 500px;">
|
||||||
@@ -31,6 +31,14 @@
|
|||||||
<!-- <v-divider></v-divider> v-bind:class="options.type" -->
|
<!-- <v-divider></v-divider> v-bind:class="options.type" -->
|
||||||
|
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
|
<v-btn
|
||||||
|
v-if="rights.change"
|
||||||
|
color="primary darken-1"
|
||||||
|
text
|
||||||
|
@click.native="newReport"
|
||||||
|
:data-cy="!!$ay.dev ? 'reportselector:ok' : false"
|
||||||
|
>{{ $ay.t("New") }}</v-btn
|
||||||
|
>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<v-btn
|
<v-btn
|
||||||
color="primary darken-1"
|
color="primary darken-1"
|
||||||
@@ -54,6 +62,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data: () => ({
|
data: () => ({
|
||||||
|
rights: window.$gz.role.getRights(window.$gz.type.Report),
|
||||||
ayaType: null,
|
ayaType: null,
|
||||||
idList: [],
|
idList: [],
|
||||||
isVisible: false,
|
isVisible: false,
|
||||||
@@ -74,10 +83,13 @@ export default {
|
|||||||
}
|
}
|
||||||
this.ayaType = ayaType;
|
this.ayaType = ayaType;
|
||||||
this.idList = idList;
|
this.idList = idList;
|
||||||
|
|
||||||
|
//rights
|
||||||
|
|
||||||
//get report list from server
|
//get report list from server
|
||||||
|
|
||||||
let res = await window.$gz.api.get(`report/list/${ayaType}`);
|
let res = await window.$gz.api.get(`report/list/${ayaType}`);
|
||||||
console.log("report-selectr report list from server is: ", res);
|
//console.log("report-selectr report list from server is: ", res);
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
throw res.error;
|
throw res.error;
|
||||||
} else {
|
} else {
|
||||||
@@ -97,6 +109,14 @@ export default {
|
|||||||
cancel() {
|
cancel() {
|
||||||
this.isVisible = false;
|
this.isVisible = false;
|
||||||
this.resolve(null);
|
this.resolve(null);
|
||||||
|
},
|
||||||
|
newReport() {
|
||||||
|
this.isVisible = false;
|
||||||
|
this.resolve(null);
|
||||||
|
this.$router.push({
|
||||||
|
name: "ay-report-edit",
|
||||||
|
params: { recordid: 0, ayaType: this.ayaType, idList: this.idList }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -123,12 +123,18 @@ export default {
|
|||||||
vm.formState.readOnly = !vm.rights.change;
|
vm.formState.readOnly = !vm.rights.change;
|
||||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
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
|
//id 0 means create a new record don't load one
|
||||||
if (vm.$route.params.recordid != 0) {
|
if (vm.$route.params.recordid != 0) {
|
||||||
//is there already an obj from a prior operation?
|
//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
|
//yes, no need to fetch it
|
||||||
this.obj = this.$route.params.obj;
|
vm.obj = vm.$route.params.obj;
|
||||||
window.$gz.form.setFormState({
|
window.$gz.form.setFormState({
|
||||||
vm: vm,
|
vm: vm,
|
||||||
loading: false
|
loading: false
|
||||||
@@ -137,6 +143,8 @@ export default {
|
|||||||
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
|
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
//New record so there *MUST* be an ayType on the route params
|
||||||
|
|
||||||
window.$gz.form.setFormState({
|
window.$gz.form.setFormState({
|
||||||
vm: vm,
|
vm: vm,
|
||||||
loading: false
|
loading: false
|
||||||
@@ -188,7 +196,7 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
//editor: null,
|
reportData: [],
|
||||||
editAreaHeight: 300,
|
editAreaHeight: 300,
|
||||||
activeTab: "properties",
|
activeTab: "properties",
|
||||||
lastTab: "properties",
|
lastTab: "properties",
|
||||||
@@ -677,7 +685,7 @@ function generateMenu(vm) {
|
|||||||
//
|
//
|
||||||
async function initForm(vm) {
|
async function initForm(vm) {
|
||||||
await fetchTranslatedText(vm);
|
await fetchTranslatedText(vm);
|
||||||
// await populateSelectionLists(vm);
|
await fetchReportData(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
@@ -693,4 +701,32 @@ async function fetchTranslatedText(vm) {
|
|||||||
"ReportTemplate"
|
"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>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user