diff --git a/src/modules/06_retirement/components/01_retirement/AddList.vue b/src/modules/06_retirement/components/01_retirement/AddList.vue index 67fce1b76..e29704804 100644 --- a/src/modules/06_retirement/components/01_retirement/AddList.vue +++ b/src/modules/06_retirement/components/01_retirement/AddList.vue @@ -85,6 +85,7 @@ const totalList = ref(0); // fecth profile async function fecthProfile() { + rows.value = []; showLoader(); if (props?.dataProfile?.type === "OFFICER") { formPagePersonList.keyword = @@ -122,6 +123,7 @@ async function fecthProfile() { page: formPagePersonList.page, pageSize: formPagePersonList.pageSize, keyword: formPagePersonList.keyword, + type: "EMPLOYEE", }) .then((res) => { maxPage.value = Math.ceil( @@ -295,7 +297,7 @@ watch(modal, () => { - + diff --git a/src/modules/14_KPI/components/Tab/Dialog/DialogEvalute.vue b/src/modules/14_KPI/components/Tab/Dialog/DialogEvalute.vue index 375db4b3c..da3371f77 100644 --- a/src/modules/14_KPI/components/Tab/Dialog/DialogEvalute.vue +++ b/src/modules/14_KPI/components/Tab/Dialog/DialogEvalute.vue @@ -67,6 +67,12 @@ const formRound = reactive({ posExecutiveName: "", }); +const FILTER_TYPES = { + EVALUATOR: "evaluatorIdOp", + COMMANDER: "commanderIdOp", + COMMANDER_HIGH: "commanderHighOp", +} as const; + const evaluatorIdOp = ref([]); const commanderIdOp = ref([]); const commanderHighOp = ref([]); @@ -199,31 +205,38 @@ function fetchRoundOption() { * @param refData เเยกประเภท */ function filterOption(val: string, update: Function, refData: string) { - switch (refData) { - case "evaluatorIdOp": - update(() => { - evaluatorIdOp.value = evaluatorIdMainOp.value.filter( - (v: DataOption) => v.name.indexOf(val) > -1 - ); - }); - break; - case "commanderIdOp": - update(() => { - commanderIdOp.value = commanderIdMainOp.value.filter( - (v: DataOption) => v.name.indexOf(val) > -1 - ); - }); - break; - case "commanderHighOp": - update(() => { - commanderHighOp.value = commanderHighMainOp.value.filter( - (v: DataOption) => v.name.indexOf(val) > -1 - ); - }); - break; - default: - break; - } + const filterConfig = { + [FILTER_TYPES.EVALUATOR]: { + sourceData: evaluatorIdMainOp.value, + targetRef: evaluatorIdOp, + excludeIds: [formRound.commanderId, formRound.commanderHighId], + }, + [FILTER_TYPES.COMMANDER]: { + sourceData: commanderIdMainOp.value, + targetRef: commanderIdOp, + excludeIds: [formRound.evaluatorId, formRound.commanderHighId], + }, + [FILTER_TYPES.COMMANDER_HIGH]: { + sourceData: commanderHighMainOp.value, + targetRef: commanderHighOp, + excludeIds: [formRound.evaluatorId, formRound.commanderId], + }, + }; + + const config = filterConfig[refData as keyof typeof filterConfig]; + + if (!config) return; + + // กรองข้อมูลโดยเอา excludeIds ออก + const filteredData = config.sourceData.filter( + (item: DataOption) => !config.excludeIds.includes(item.id) + ); + + update(() => { + config.targetRef.value = filteredData.filter((item: DataOption) => + item.name.toLowerCase().includes(val.toLowerCase()) + ); + }); } /** เช็ครอบการประเมินที่ปิดรอบ */ diff --git a/src/modules/14_KPI/views/detailView.vue b/src/modules/14_KPI/views/detailView.vue index 58430ec81..1eb680516 100644 --- a/src/modules/14_KPI/views/detailView.vue +++ b/src/modules/14_KPI/views/detailView.vue @@ -178,7 +178,7 @@ function onSubmit() { } async function getOrgOp() { - showLoader() + showLoader(); await http .get(config.API.Kpiorg + `/${store.dataProfile.profileId}`) .then((res) => { @@ -214,7 +214,7 @@ async function getOrgOp() { name: `${i.prefix}${i.firstName} ${i.lastName}`, })) .find((i: any) => i.id == store.dataEvaluation.commanderHighId); - hideLoader() + hideLoader(); }) .catch((e) => { messageError($q, e); @@ -351,7 +351,7 @@ function openStatus() { router.push(`/probation-detail/${store.dataEvaluation.id}`); } -function sendToEvauator() { +function sendToEvaluator() { dialogConfirm($q, () => { showLoader(); http @@ -672,6 +672,7 @@ onUnmounted(() => { >*น้ำหนัก(ร้อยละ) ผลสัมฤทธิ์ของงานไม่ถูกต้อง
+ { color="grey-2" text-color="blue-6" size="md" - @click="sendToEvauator" + @click="sendToEvaluator" > ทำการประเมิน