From 56441eab957ad6c44a713252d35027ca4c401faf Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 9 Apr 2021 00:01:07 +0000 Subject: [PATCH] --- ayanova/src/views/svc-workorder.vue | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index 8038b670..d3cfa8fa 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -655,16 +655,19 @@ async function saveHeader(vm) { if (!vm.obj.isDirty) { return true; } + let isPost = o.id == 0; let res = await window.$gz.api.upsert(`${API_BASE_URL}`, o); if (res.error) { displayResError(vm, res); return false; } else { //update any server changed fields - vm.obj.concurrency = res.concurrency; - vm.obj.id = res.id; - vm.obj.serial = res.serial; + vm.obj.concurrency = res.data.concurrency; vm.obj.isDirty = false; + if (isPost) { + vm.obj.id = res.data.id; + vm.obj.serial = res.data.serial; + } return true; } } @@ -705,13 +708,13 @@ async function saveItems(vm) { } else { //update any server changed fields //put fields - o.concurrency = res.concurrency; + o.concurrency = res.data.concurrency; o.isDirty = false; //fields to update if post if (isPost) { - o.id = res.id; - o.workorderId = res.workorderId; + o.id = res.data.id; + o.workorderId = res.data.workorderId; } } } else { @@ -755,13 +758,13 @@ async function saveScheduledUsers(vm, woitemindex) { } else { //update any server changed fields //always updated: - o.concurrency = res.concurrency; + o.concurrency = res.data.concurrency; o.isDirty = false; //new records only... if (isPost) { - o.id = res.id; - o.workOrderItemId = res.workOrderItemId; + o.id = res.data.id; + o.workOrderItemId = res.data.workOrderItemId; } } } else {