This commit is contained in:
@@ -456,27 +456,26 @@ export default {
|
|||||||
refresh() {
|
refresh() {
|
||||||
this.getDataFromApi();
|
this.getDataFromApi();
|
||||||
},
|
},
|
||||||
getRowIds() {
|
getDataTableSourceOptions() {
|
||||||
|
let vm = this;
|
||||||
|
//called when parent form needs the selected id's or the list view options needed to rehydrate the entire list of id's in the same order and filter
|
||||||
|
//i.e. for reporting, bulk operations etc
|
||||||
|
|
||||||
|
let selectedRowIds = [];
|
||||||
//get selected row id's if there are selections else get all row id's
|
//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
|
//called into from parent for things like reporting or bulk ops
|
||||||
//selected or records both are arrays with an id property that contains the row id conveniently for this method
|
//selected or records both are arrays with an id property that contains the row id conveniently for this method
|
||||||
if (this.selected.length > 0) {
|
if (vm.selected.length > 0) {
|
||||||
//return row id's of selected items only
|
//return row id's of selected items only
|
||||||
return this.selected.map(z => {
|
selectedRowIds = vm.selected.map(z => {
|
||||||
return z.id;
|
return z.id;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//whups, records is only the visible paged amount, not all, back to the drawing board for this one but the above is fine
|
return {
|
||||||
if (this.records.length > 0) {
|
selectedRowIds: selectedRowIds,
|
||||||
//return row id's of all items
|
dataListKey: vm.dataListKey,
|
||||||
return this.records.map(z => {
|
listView: untokenizeListView(vm.listView)
|
||||||
return z.id;
|
};
|
||||||
});
|
|
||||||
}
|
|
||||||
//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
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
<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 }} rights: {{ rights }}
|
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
|
|
||||||
<v-card-text style="height: 500px;">
|
<v-card-text style="height: 500px;">
|
||||||
@@ -64,7 +63,7 @@ export default {
|
|||||||
data: () => ({
|
data: () => ({
|
||||||
rights: window.$gz.role.getRights(window.$gz.type.Report),
|
rights: window.$gz.role.getRights(window.$gz.type.Report),
|
||||||
ayaType: null,
|
ayaType: null,
|
||||||
idList: [],
|
sourceData: {},
|
||||||
isVisible: false,
|
isVisible: false,
|
||||||
resolve: null,
|
resolve: null,
|
||||||
reject: null,
|
reject: null,
|
||||||
@@ -76,13 +75,22 @@ export default {
|
|||||||
selectedReport: null
|
selectedReport: null
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
async open(ayaType, idList) {
|
async open(ayaType, sourceData) {
|
||||||
let vm = this;
|
let vm = this;
|
||||||
if (ayaType == null || idList == null || idList.length == 0) {
|
if (ayaType == null || sourceData == null) {
|
||||||
throw "report-selector:Open missing type and or idList";
|
throw "report-selector:Open missing type and or sourceData";
|
||||||
}
|
}
|
||||||
this.ayaType = ayaType;
|
this.ayaType = ayaType;
|
||||||
this.idList = idList;
|
|
||||||
|
//source data object
|
||||||
|
//either need to rehydrate or send as is if not selectedRowIds
|
||||||
|
// {
|
||||||
|
// selectedRowIds: selectedRowIds,
|
||||||
|
// dataListKey: vm.dataListKey,
|
||||||
|
// listView: untokenizeListView(vm.listView)
|
||||||
|
// }
|
||||||
|
|
||||||
|
this.sourceData = sourceData;
|
||||||
|
|
||||||
//rights
|
//rights
|
||||||
|
|
||||||
@@ -115,7 +123,11 @@ export default {
|
|||||||
this.resolve(null);
|
this.resolve(null);
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: "ay-report-edit",
|
name: "ay-report-edit",
|
||||||
params: { recordid: 0, ayaType: this.ayaType, idList: this.idList }
|
params: {
|
||||||
|
recordid: 0,
|
||||||
|
ayaType: this.ayaType,
|
||||||
|
sourceData: this.sourceData
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,12 +156,11 @@ 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
|
//route params MUST have source data
|
||||||
if (!vm.$route.params.idList) {
|
if (!vm.$route.params.sourceData) {
|
||||||
|
throw "ay-report-edit::created - missing sourceData route parameter";
|
||||||
}
|
}
|
||||||
|
|
||||||
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?
|
||||||
@@ -767,10 +766,10 @@ async function fetchTranslatedText(vm) {
|
|||||||
////////////////////
|
////////////////////
|
||||||
//
|
//
|
||||||
async function fetchReportData(vm) {
|
async function fetchReportData(vm) {
|
||||||
let idList = vm.$route.params.idList;
|
let sourceData = vm.$route.params.sourceData;
|
||||||
vm.obj.objectType = vm.$route.params.ayaType;
|
vm.obj.objectType = vm.$route.params.ayaType;
|
||||||
if (!idList || idList.length == 0) {
|
if (!sourceData) {
|
||||||
throw "ay-report-edit:fetchReportData - route parameter idList is missing or empty, unable to init report designer";
|
throw "ay-report-edit:fetchReportData - route parameter sourceData is missing or empty, unable to init report designer";
|
||||||
}
|
}
|
||||||
if (vm.obj.objectType == null) {
|
if (vm.obj.objectType == null) {
|
||||||
throw "ay-report-edit:fetchReportData - route parameter ayaType is missing or empty, unable to init report designer";
|
throw "ay-report-edit:fetchReportData - route parameter ayaType is missing or empty, unable to init report designer";
|
||||||
@@ -782,7 +781,7 @@ async function fetchReportData(vm) {
|
|||||||
} */
|
} */
|
||||||
let res = await window.$gz.api.upsert("report/object-report-data", {
|
let res = await window.$gz.api.upsert("report/object-report-data", {
|
||||||
ObjectType: vm.obj.objectType,
|
ObjectType: vm.obj.objectType,
|
||||||
ObjectIdArray: idList
|
ObjectIdArray: sourceData
|
||||||
});
|
});
|
||||||
//We never expect there to be no data here
|
//We never expect there to be no data here
|
||||||
if (!res.hasOwnProperty("data")) {
|
if (!res.hasOwnProperty("data")) {
|
||||||
|
|||||||
@@ -640,7 +640,9 @@ async function clickHandler(menuItem) {
|
|||||||
|
|
||||||
let res = await m.vm.$refs.reportSelector.open(
|
let res = await m.vm.$refs.reportSelector.open(
|
||||||
window.$gz.type.Widget,
|
window.$gz.type.Widget,
|
||||||
[m.vm.obj.id]
|
{
|
||||||
|
selectedRowIds: [m.vm.obj.id]
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
//if null for no selection
|
//if null for no selection
|
||||||
|
|||||||
@@ -76,13 +76,11 @@ async function clickHandler(menuItem) {
|
|||||||
params: { recordid: m.id, ayatype: window.$gz.type.Widget }
|
params: { recordid: m.id, ayatype: window.$gz.type.Widget }
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//general report selector chosen
|
//general report selector chosen
|
||||||
console.log(m.vm.$refs.gzdatatable.getRowIds());
|
|
||||||
return;
|
|
||||||
|
|
||||||
let res = await m.vm.$refs.reportSelector.open(
|
let res = await m.vm.$refs.reportSelector.open(
|
||||||
window.$gz.type.Widget,
|
window.$gz.type.Widget,
|
||||||
[m.vm.getSelection()]
|
m.vm.$refs.gzdatatable.getDataTableSourceOptions()
|
||||||
);
|
);
|
||||||
|
|
||||||
//if null for no selection
|
//if null for no selection
|
||||||
|
|||||||
Reference in New Issue
Block a user