This commit is contained in:
2021-05-17 22:40:28 +00:00
parent c892a622d7
commit e5e15b9f54

View File

@@ -658,22 +658,27 @@ async function saveHeader(vm) {
//}
} else {
//this sets 'o' to all values in assigned *except* the ones itemized with removedKey which is a fake key and just used for this trick to work
//as undefined won't
console.log("Header save, return data is: ", res.data);
//copy return data into a variable called 'o' but exclude states and items keys
const { states: removedKey1, items: removedKey2, ...o } = res.data;
//update any server changed fields
vm.obj.concurrency = res.data.concurrency;
vm.obj.isDirty = false;
console.log("Header save, o is: ", o);
// //this sets 'o' to all values in assigned *except* the ones itemized with removedKey which is a fake key and just used for this trick to work
// //as undefined won't
// console.log("Header save, return data is: ", res.data);
// //copy return data into a variable called 'o' but exclude states and items keys
// const { states: removedKey1, items: removedKey2, ...o } = res.data;
//now we can set the header to o safely without wiping the child collections
//this will only copy the existing properties in o to vm.obj
Object.assign(vm.obj, o);
// console.log("Header save, o is: ", o);
console.log("Header save, vm.obj is: ", vm.obj);
// //now we can set the header to o safely without wiping the child collections
// //this will only copy the existing properties in o to vm.obj
// Object.assign(vm.obj, o);
// console.log("Header save, vm.obj is: ", vm.obj);
//vm.obj.items[woItemIndex].labors.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
if (isPost) {
vm.obj.id = res.data.id;
vm.obj.serial = res.data.serial;
//walk all unsaved direct children and set the workorder id so they can save
vm.obj.states.forEach(z => (z.workOrderId = vm.obj.id));
vm.obj.items.forEach(z => (z.workOrderId = vm.obj.id));