diff --git a/src/modules/08_KPI/views/main.vue b/src/modules/08_KPI/views/main.vue index 0bfd07f..7618c4c 100644 --- a/src/modules/08_KPI/views/main.vue +++ b/src/modules/08_KPI/views/main.vue @@ -77,7 +77,7 @@ const roundDialgOp = ref([]); const modalDialog = ref(false); const yearDialog = ref(null); const formRound = reactive({ - kpiPeriodId: "", + kpiPeriodId: { id: "", name: "", isClosed: false }, profileId: "", prefix: "", firstName: "", @@ -90,6 +90,7 @@ const formQuery = reactive({ pageSize: 10, }); const totalList = ref(1); +const isRoundClose = ref(false); function fetchRoundOption(type: string) { const y = type === "main" ? year.value : yearDialog.value; @@ -108,6 +109,7 @@ function fetchRoundOption(type: string) { : e.durationKPI === "APR" ? "รอบเมษายน" : "", + isClosed: !e.isActive, })); if (type === "main") { roundMainOp.value = list; @@ -115,7 +117,7 @@ function fetchRoundOption(type: string) { fetchList(); } else { roundDialgOp.value = list; - formRound.kpiPeriodId = ""; + formRound.kpiPeriodId = { id: "", name: "", isClosed: false }; } }) .catch((err) => { @@ -162,7 +164,7 @@ function onClickAddList() { function onCloseDialog() { modalDialog.value = false; - formRound.kpiPeriodId = ""; + formRound.kpiPeriodId = { id: "", name: "", isClosed: false }; yearDialog.value = null; } @@ -170,7 +172,13 @@ function onSubmit() { dialogConfirm($q, () => { showLoader(); http - .post(config.API.kpiEvaluation, formRound) + .post(config.API.kpiEvaluation, { + kpiPeriodId: formRound.kpiPeriodId.id, + profileId: formRound.profileId, + prefix: formRound.prefix, + firstName: formRound.firstName, + lastName: formRound.lastName, + }) .then((res) => { console.log(res); const id = res.data.result; @@ -205,6 +213,10 @@ function getProfile() { }); } +function checkClosed() { + isRoundClose.value = formRound.kpiPeriodId.isClosed; +} + const pagination = ref({ sortBy: "desc", descending: false, @@ -399,7 +411,7 @@ onMounted(() => { - + @@ -448,6 +460,7 @@ onMounted(() => {
{ option-label="name" option-value="id" :options="roundDialgOp" - emit-value - map-options hide-bottom-space lazy-rules - :rules="[ - (val:string) => - !!val || `${'กรุณาเลือกรอบการประเมิน'}`, - ]" + :rules="[(val) => !!val.id || `${'กรุณาเลือกรอบการประเมิน'}`]" + @update:model-value="checkClosed" />
- + รอบการประเมินนี้ปิดแล้ว + + + + บันทึกข้อมูล