This commit is contained in:
2021-06-16 23:47:58 +00:00
parent 6526fd1271
commit 026f53baf4
8 changed files with 56 additions and 16 deletions

View File

@@ -454,8 +454,13 @@ export default {
}, },
gotoIndex(val, oldVal) { gotoIndex(val, oldVal) {
if (val != oldVal) { if (val != oldVal) {
this.selectedRow = [{ index: val }]; let gotoIndex = val;
this.activeItemIndex = val; if (val < 0) {
//it's a create request
gotoIndex = this.newItem();
}
this.selectedRow = [{ index: gotoIndex }];
this.activeItemIndex = gotoIndex;
this.$nextTick(() => { this.$nextTick(() => {
const el = this.$refs.labortopform; const el = this.$refs.labortopform;
if (el) { if (el) {
@@ -504,6 +509,7 @@ export default {
this.$emit("change"); this.$emit("change");
this.selectedRow = [{ index: newIndex }]; this.selectedRow = [{ index: newIndex }];
this.activeItemIndex = newIndex; this.activeItemIndex = newIndex;
return newIndex; //for create new on goto
}, },
unDeleteItem() { unDeleteItem() {
this.value.items[this.activeWoItemIndex].labors[ this.value.items[this.activeWoItemIndex].labors[

View File

@@ -473,8 +473,13 @@ export default {
}, },
gotoIndex(val, oldVal) { gotoIndex(val, oldVal) {
if (val != oldVal) { if (val != oldVal) {
this.selectedRow = [{ index: val }]; let gotoIndex = val;
this.activeItemIndex = val; if (val < 0) {
//it's a create request
gotoIndex = this.newItem();
}
this.selectedRow = [{ index: gotoIndex }];
this.activeItemIndex = gotoIndex;
this.$nextTick(() => { this.$nextTick(() => {
const el = this.$refs.loantopform; const el = this.$refs.loantopform;
if (el) { if (el) {
@@ -534,6 +539,7 @@ export default {
`Items[${this.activeWoItemIndex}].loans[${this.activeItemIndex}].loanUnitId` `Items[${this.activeWoItemIndex}].loans[${this.activeItemIndex}].loanUnitId`
); );
}); });
return newIndex; //for create new on goto
}, },
unDeleteItem() { unDeleteItem() {
this.value.items[this.activeWoItemIndex].loans[ this.value.items[this.activeWoItemIndex].loans[

View File

@@ -623,8 +623,13 @@ export default {
}, },
gotoIndex(val, oldVal) { gotoIndex(val, oldVal) {
if (val != oldVal) { if (val != oldVal) {
this.selectedRow = [{ index: val }]; let gotoIndex = val;
this.activeItemIndex = val; if (val < 0) {
//it's a create request
gotoIndex = this.newItem();
}
this.selectedRow = [{ index: gotoIndex }];
this.activeItemIndex = gotoIndex;
this.$nextTick(() => { this.$nextTick(() => {
const el = this.$refs.outsideservicetopform; const el = this.$refs.outsideservicetopform;
if (el) { if (el) {
@@ -692,6 +697,7 @@ export default {
`Items[${this.activeWoItemIndex}].outsideServices[${this.activeItemIndex}].unitId` `Items[${this.activeWoItemIndex}].outsideServices[${this.activeItemIndex}].unitId`
); );
}); });
return newIndex; //for create new on goto
}, },
unDeleteItem() { unDeleteItem() {
this.value.items[this.activeWoItemIndex].outsideServices[ this.value.items[this.activeWoItemIndex].outsideServices[

View File

@@ -385,8 +385,13 @@ export default {
}, },
gotoIndex(val, oldVal) { gotoIndex(val, oldVal) {
if (val != oldVal) { if (val != oldVal) {
this.selectedRow = [{ index: val }]; let gotoIndex = val;
this.activeItemIndex = val; if (val < 0) {
//it's a create request
gotoIndex = this.newItem();
}
this.selectedRow = [{ index: gotoIndex }];
this.activeItemIndex = gotoIndex;
this.$nextTick(() => { this.$nextTick(() => {
const el = this.$refs.parttopform; const el = this.$refs.parttopform;
if (el) { if (el) {
@@ -506,6 +511,7 @@ export default {
`Items[${this.activeWoItemIndex}].parts[${this.activeItemIndex}].partId` `Items[${this.activeWoItemIndex}].parts[${this.activeItemIndex}].partId`
); );
}); });
return newIndex; //for create new on goto
}, },
unDeleteItem() { unDeleteItem() {
this.value.items[this.activeWoItemIndex].parts[ this.value.items[this.activeWoItemIndex].parts[

View File

@@ -307,8 +307,13 @@ export default {
}, },
gotoIndex(val, oldVal) { gotoIndex(val, oldVal) {
if (val != oldVal) { if (val != oldVal) {
this.selectedRow = [{ index: val }]; let gotoIndex = val;
this.activeItemIndex = val; if (val < 0) {
//it's a create request
gotoIndex = this.newItem();
}
this.selectedRow = [{ index: gotoIndex }];
this.activeItemIndex = gotoIndex;
this.$nextTick(() => { this.$nextTick(() => {
const el = this.$refs.scheduledusertopform; const el = this.$refs.scheduledusertopform;
if (el) { if (el) {
@@ -348,6 +353,7 @@ export default {
this.$emit("change"); this.$emit("change");
this.selectedRow = [{ index: newIndex }]; this.selectedRow = [{ index: newIndex }];
this.activeItemIndex = newIndex; this.activeItemIndex = newIndex;
return newIndex; //for create new on goto
}, },
unDeleteItem() { unDeleteItem() {
this.value.items[this.activeWoItemIndex].scheduledUsers[ this.value.items[this.activeWoItemIndex].scheduledUsers[

View File

@@ -344,8 +344,13 @@ export default {
}, },
gotoIndex(val, oldVal) { gotoIndex(val, oldVal) {
if (val != oldVal) { if (val != oldVal) {
this.selectedRow = [{ index: val }]; let gotoIndex = val;
this.activeItemIndex = val; if (val < 0) {
//it's a create request
gotoIndex = this.newItem();
}
this.selectedRow = [{ index: gotoIndex }];
this.activeItemIndex = gotoIndex;
this.$nextTick(() => { this.$nextTick(() => {
const el = this.$refs.tasktopform; const el = this.$refs.tasktopform;
if (el) { if (el) {
@@ -438,6 +443,7 @@ export default {
`Items[${this.activeWoItemIndex}].tasks[${this.activeItemIndex}].task` `Items[${this.activeWoItemIndex}].tasks[${this.activeItemIndex}].task`
); );
}); });
return newIndex; //for create new on goto
}, },
unDeleteItem() { unDeleteItem() {
this.value.items[this.activeWoItemIndex].tasks[ this.value.items[this.activeWoItemIndex].tasks[

View File

@@ -454,8 +454,13 @@ export default {
}, },
gotoIndex(val, oldVal) { gotoIndex(val, oldVal) {
if (val != oldVal) { if (val != oldVal) {
this.selectedRow = [{ index: val }]; let gotoIndex = val;
this.activeItemIndex = val; if (val < 0) {
//it's a create request
gotoIndex = this.newItem();
}
this.selectedRow = [{ index: gotoIndex }];
this.activeItemIndex = gotoIndex;
this.$nextTick(() => { this.$nextTick(() => {
const el = this.$refs.traveltopform; const el = this.$refs.traveltopform;
if (el) { if (el) {
@@ -504,6 +509,7 @@ export default {
this.$emit("change"); this.$emit("change");
this.selectedRow = [{ index: newIndex }]; this.selectedRow = [{ index: newIndex }];
this.activeItemIndex = newIndex; this.activeItemIndex = newIndex;
return newIndex; //for create new on goto
}, },
unDeleteItem() { unDeleteItem() {
this.value.items[this.activeWoItemIndex].travels[ this.value.items[this.activeWoItemIndex].travels[

View File

@@ -845,7 +845,6 @@ export default {
}); });
}, },
newSubItem(atype) { newSubItem(atype) {
console.log("Newsubitem type: ", atype);
//new Id value to use (by convention goto negative will trigger create and then goto instead of simple goto) //new Id value to use (by convention goto negative will trigger create and then goto instead of simple goto)
let newId = -Math.abs(Date.now()); let newId = -Math.abs(Date.now());
switch (atype) { switch (atype) {
@@ -874,7 +873,6 @@ export default {
this.gotoTravelIndex = newId; this.gotoTravelIndex = newId;
break; break;
case window.$gz.type.WorkOrderItemUnit: case window.$gz.type.WorkOrderItemUnit:
console.log("new unit id", newId);
this.gotoUnitIndex = newId; this.gotoUnitIndex = newId;
break; break;
} }