This commit is contained in:
@@ -417,7 +417,7 @@ export default {
|
||||
//then save all items downwards from top of graph
|
||||
//mostly via workorderitem
|
||||
//########################################################
|
||||
let fail = false;
|
||||
let noProblem = true;
|
||||
let isNew = this.obj.concurrency == 0;
|
||||
|
||||
//### STATE first if unlocking only
|
||||
@@ -425,43 +425,43 @@ export default {
|
||||
//and user can unlock first to finish updating
|
||||
let stateSaved = false;
|
||||
if (this.obj.isLockedAtServer) {
|
||||
fail = await saveState(vm);
|
||||
noProblem = await saveState(vm);
|
||||
stateSaved = true;
|
||||
}
|
||||
|
||||
//############# DELETE GRAPH ###############
|
||||
//SCHEDULED USERS
|
||||
if (!fail) {
|
||||
fail = await deleteScheduledUsers(vm);
|
||||
if (noProblem) {
|
||||
noProblem = await deleteScheduledUsers(vm);
|
||||
}
|
||||
|
||||
//todo: other children
|
||||
|
||||
//WOITEMS
|
||||
if (!fail) {
|
||||
fail = await deleteItems(vm);
|
||||
if (noProblem) {
|
||||
noProblem = await deleteItems(vm);
|
||||
}
|
||||
|
||||
//############ SAVE GRAPH ###############
|
||||
//HEADER
|
||||
if (!fail) {
|
||||
fail = await saveHeader(vm);
|
||||
if (noProblem) {
|
||||
noProblem = await saveHeader(vm);
|
||||
}
|
||||
|
||||
//WOITEMS
|
||||
if (!fail) {
|
||||
if (noProblem) {
|
||||
//This saves all bottom level collections as well
|
||||
fail = await saveItems(vm);
|
||||
noProblem = await saveItems(vm);
|
||||
}
|
||||
|
||||
//### STATE last normally
|
||||
//in case it locks or is completed
|
||||
if (!stateSaved && !fail) {
|
||||
fail = await saveState(vm);
|
||||
if (!stateSaved && noProblem) {
|
||||
noProblem = await saveState(vm);
|
||||
}
|
||||
|
||||
//## ALL PARTIAL UPDATES SUCCEEDED
|
||||
if (fail) {
|
||||
if (!noProblem) {
|
||||
//this assumes error is already displayed from save op
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
@@ -639,6 +639,7 @@ async function deleteItems(vm) {
|
||||
vm.deletedGraphItems.items.splice(0, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async function saveItems(vm) {
|
||||
let totalItems = vm.obj.items.length;
|
||||
@@ -697,6 +698,7 @@ async function deleteScheduledUsers(vm) {
|
||||
vm.deletedGraphItems.scheduledUsers.splice(0, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async function saveScheduledUsers(vm, woitemindex) {
|
||||
@@ -727,7 +729,6 @@ async function saveScheduledUsers(vm, woitemindex) {
|
||||
o.workOrderItemId = res.data.workOrderItemId;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
return true; //made it
|
||||
@@ -757,6 +758,7 @@ async function saveState(vm) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user