This commit is contained in:
2020-09-01 17:22:43 +00:00
parent a592fec7bc
commit 4b3bd3aa07
5 changed files with 44 additions and 34 deletions

View File

@@ -456,27 +456,26 @@ export default {
refresh() {
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
//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
if (this.selected.length > 0) {
if (vm.selected.length > 0) {
//return row id's of selected items only
return this.selected.map(z => {
selectedRowIds = vm.selected.map(z => {
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
if (this.records.length > 0) {
//return row id's of all items
return this.records.map(z => {
return z.id;
});
}
//no data, just return an empty array
return [];
// console.log("records:", this.records);
// console.log("selected:", this.selected);
return {
selectedRowIds: selectedRowIds,
dataListKey: vm.dataListKey,
listView: untokenizeListView(vm.listView)
};
},
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

View File

@@ -11,7 +11,6 @@
<v-card elevation="24">
<v-card-title class="headline lighten-2" primary-title>
<span> {{ $ay.t("Report") }} </span>
TYPE: {{ ayaType }}, idList:{{ idList }} rights: {{ rights }}
</v-card-title>
<v-card-text style="height: 500px;">
@@ -64,7 +63,7 @@ export default {
data: () => ({
rights: window.$gz.role.getRights(window.$gz.type.Report),
ayaType: null,
idList: [],
sourceData: {},
isVisible: false,
resolve: null,
reject: null,
@@ -76,13 +75,22 @@ export default {
selectedReport: null
}),
methods: {
async open(ayaType, idList) {
async open(ayaType, sourceData) {
let vm = this;
if (ayaType == null || idList == null || idList.length == 0) {
throw "report-selector:Open missing type and or idList";
if (ayaType == null || sourceData == null) {
throw "report-selector:Open missing type and or sourceData";
}
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
@@ -115,7 +123,11 @@ export default {
this.resolve(null);
this.$router.push({
name: "ay-report-edit",
params: { recordid: 0, ayaType: this.ayaType, idList: this.idList }
params: {
recordid: 0,
ayaType: this.ayaType,
sourceData: this.sourceData
}
});
}
}