diff --git a/src/modules/08_KPI/views/form.vue b/src/modules/08_KPI/views/form.vue index 8b80236..0c7630a 100644 --- a/src/modules/08_KPI/views/form.vue +++ b/src/modules/08_KPI/views/form.vue @@ -31,9 +31,9 @@ const evaluatorIdMainOp = ref([]); const commanderIdMainOp = ref([]); const commanderHighMainOp = ref([]); -const evaluatorId = ref(); -const commanderId = ref(); -const commanderHighId = ref(); +const evaluatorId = ref(null); +const commanderId = ref(null); +const commanderHighId = ref(null); const formProfile = reactive({ fullName: "", @@ -127,12 +127,13 @@ async function clearDialog() { function onSubmit() { dialogConfirm($q, () => { - showLoader(); + if(id.value){ + showLoader(); http .put(config.API.kpiEvaluationCheck + `/${id.value}`, { - evaluatorId: evaluatorId.value.id, - commanderId: commanderId.value.id, - commanderHighId: commanderHighId.value.id, + evaluatorId: evaluatorId.value ? evaluatorId.value.id:null, + commanderId: commanderId.value ? commanderId.value.id:null, + commanderHighId: commanderHighId.value ? commanderHighId.value.id:null, }) .then((res) => { success($q, "บันทึกสำเร็จ"); @@ -144,6 +145,8 @@ function onSubmit() { .finally(() => { hideLoader(); }); + } + }); }