From e5e15b9f54b675fa63276aab8162c5e0aadd85a7 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 17 May 2021 22:40:28 +0000 Subject: [PATCH] --- ayanova/src/views/svc-workorder.vue | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index 566dd0c0..691bcf8d 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -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));