This commit is contained in:
2021-04-08 18:44:18 +00:00
parent faabe501f6
commit 5a2b19022d
2 changed files with 41 additions and 14 deletions

View File

@@ -39,7 +39,7 @@
<v-data-table
:headers="headerList"
:items="itemList"
item-key="id"
item-key="index"
v-model="selectedRow"
class="elevation-1"
disable-pagination
@@ -122,7 +122,7 @@ export default {
methods: {
newItem() {
this.pvm.selectedItemIndex =
this.pvm.selectItem(
this.value.items.push({
id: 0,
concurrency: 0,
@@ -147,18 +147,21 @@ export default {
travels: [],
units: [],
outsideServices: []
}) - 1;
}) - 1
);
},
async deleteItem() {
if ((await window.$gz.dialog.confirmDelete()) != true) {
return;
}
this.value.items.splice(this.pvm.selectedItemIndex, 1);
if (this.value.items.length > 0) {
this.pvm.selectedItemIndex = this.value.items.length - 1;
} else {
this.pvm.selectedItemIndex = null;
}
this.pvm.selectIndex(null); //select nothing in essence resetting a child selects and this one too clearing form
// if (this.value.items.length > 0) {
// this.pvm.selectedItemIndex = this.value.items.length - 1;
// } else {
// this.pvm.selectedItemIndex = null;
// }
},
selectItem: function(item) {
this.selectedRow = [item];