This commit is contained in:
2021-02-27 01:49:13 +00:00
parent 3250ccfe09
commit 9d4fbb70d7
8 changed files with 251 additions and 30 deletions

View File

@@ -451,6 +451,10 @@ export default {
type: Boolean,
default: false
},
selectReturnColumns: {
type: Array,
default: null
},
reload: {
type: Boolean,
default: false
@@ -655,16 +659,66 @@ export default {
};
},
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
if (this.singleSelect) {
this.selected.splice(0, this.selected.length - 1);
}
//emit event to parent form of selected rows
if (
this.selectReturnColumns != null &&
this.selectReturnColumns.length > 0
) {
//todo: here need to check if calling form has asked for a template of certain fields instead of row id's
//and emit that as objects instead
//i.e. restock list provides selectReturnTemplate array of field key names:
// ['PartPartNumber','PartWarehouseName','PartWholesalerID','PartAlternativeWholesalerID','PartManufacturerID','PartByWarehouseInventoryReorderQuantity']
//select then saves exactly those columns into the selection instead of id's
//returns the id and name values or basically anything in that column ready for ease of use by extensions like partrestock extension which needs display and id values both
//maybe need to rename selectedRowIds if it can fit within that system too.
this.$emit(
"selection-change",
this.selected.map(z => z.id)
);
console.log("handleselectchange templated", {
selected: this.selected,
headers: this.headers
});
//build a map of column numbers that correspond with template fk names
/*
arrays of objects like this, fk corresponds to field template, value columns.cx equals actual column we need, text may be useful too save a translation to send it maybe?
align: "start"
fk: "PartPartNumber"
flt: true
text: "Part Number"
value: "columns.c0"
*/
//iterate the selected items which are like below, i is id number of record, t is type maybe useful, v is display value, key is only useless thing, maybe just strip the key and send the rest?
/*
c0: {…}
i: 3
key: "0-0"
t: 4
v: "017368"
*/
//return array like this:
/*
todo: work this out, array of arrays I guess??
[
{
fk:"PartPartNumber",
text:"Part number",
i: 3,
t: 4,
v: "01768"
}
*/
} else {
//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
if (this.singleSelect) {
this.selected.splice(0, this.selected.length - 1);
}
//emit event to parent form of selected rows
this.$emit(
"selection-change",
this.selected.map(z => z.id)
);
}
},
editColumnView() {
this.$router.push({