This commit is contained in:
2021-04-16 20:17:44 +00:00
parent ea4fc8edae
commit 911588f3ac
3 changed files with 28 additions and 9 deletions

View File

@@ -141,7 +141,8 @@ export default {
stopDate: null,
serviceRateId: null,
isDirty: true,
workOrderItemId: this.value.items[this.activeWoItemIndex].id
workOrderItemId: this.value.items[this.activeWoItemIndex].id,
uid: Date.now() //used for error tracking / display
});
this.$emit("change");
this.selectedRow = [{ index: newIndex }];

View File

@@ -191,7 +191,7 @@ export default {
travels: [],
units: [],
outsideServices: [],
uid: Date.now() //guaranteed unique and higher than any prior
uid: Date.now() //used for error tracking / display
});
this.$emit("change");
this.selectedRow = [{ index: newIndex }];

View File

@@ -358,7 +358,21 @@ export default {
} else {
vm.obj = res.data;
vm.obj.items.forEach((z, index) => (z.uid = index));
//assign opening UID's
vm.obj.items.forEach((z, index) => {
z.uid = index;
z.expenses.forEach((x, index) => (x.uid = index));
z.labors.forEach((x, index) => (x.uid = index));
z.loans.forEach((x, index) => (x.uid = index));
z.parts.forEach((x, index) => (x.uid = index));
z.partRequests.forEach((x, index) => (x.uid = index));
z.scheduledUsers.forEach((x, index) => (x.uid = index));
z.tasks.forEach((x, index) => (x.uid = index));
z.travels.forEach((x, index) => (x.uid = index));
z.units.forEach((x, index) => (x.uid = index));
z.outsideServices.forEach((x, index) => (x.uid = index));
});
console.log("getdata items indexed:", vm.obj.items);
//modify the menu as necessary
generateMenu(vm);
@@ -487,9 +501,6 @@ export default {
vm.formState.serverError = formErrorFromSaveResult();
window.$gz.form.setErrorBoxErrors(vm);
//TODO: If it's a fatal error set accordingly and bail out here
// if (err.fatal) {
// //save failed fataly so just set the state and bail out
@@ -848,6 +859,15 @@ async function saveScheduledUsers(vm, woItemIndex, err) {
function handleSaveError(e) {
//TODO: decide if fatal here and set accordingly
/**
* {
error: res.error,
itemUid: item.uid, //uid of item
childKey: "scheduledUsers",
childId: i //uid of child item will be located later as index
}
*
*/
if (this.errors == null) {
this.errors = [];
}
@@ -856,7 +876,6 @@ function handleSaveError(e) {
function formErrorFromSaveResult() {
//digest saveresult and compile into standard form error and return
/*
@@ -971,8 +990,7 @@ function formErrorFromSaveResult() {
//TODO: compile is back on the menu
//iterate saveresult errors and hydrate into a displayable error as expected
//(deal with translate uid's to woitem indexes that still exist)
*/
////set Target properly as requried and push error into the error collection
////set Target properly as requried and push error into the error collection
// this.saveResult.errors;
}