From a7341c744097dfd173b16ff4c0117e7d55790eaa Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 5 May 2026 17:12:56 +0700 Subject: [PATCH 01/47] refactor(placement): DialogSelectOrg LoadPosition --- .../components/PersonalList/CardPosition.vue | 22 ++++++++----- .../PersonalList/DialogSelectOrg.vue | 32 ++++++++++++------- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/modules/05_placement/components/PersonalList/CardPosition.vue b/src/modules/05_placement/components/PersonalList/CardPosition.vue index 4c9b0a277..70b0b117d 100644 --- a/src/modules/05_placement/components/PersonalList/CardPosition.vue +++ b/src/modules/05_placement/components/PersonalList/CardPosition.vue @@ -2,7 +2,7 @@ import { ref, onMounted, watch } from "vue"; /** importType*/ -import type { QTableProps } from "quasar"; +import { type QTableProps } from "quasar"; import type { Positions, FormPosType, @@ -23,13 +23,13 @@ const store = useSelectOrgStore(); const selected = defineModel("selectedPos", { required: true }); //ตำแหน่งที่เลือก const positionId = defineModel("positionId", { required: true }); //id ตำแหน่งที่เลือก const seletcId = defineModel("seletcId", { required: true }); // ตำแหน่งที่เลือก -const date = defineModel("datePos", { required: true }); //วันยที่รายงานคัว +const date = defineModel("datePos", { required: true }); //วันยที่รายงานคัว const positionData = defineModel("position", { required: true }); //ข้อมูลรายการเลขที่ตำแหน่ง const isAll = defineModel("isAll", { required: true }); //แสดงตำแหน่งทั้งหมด const isBlank = defineModel("isBlank", { required: true }); //แสดงเฉพาะตำแหน่งว่าง const isPosition = defineModel("isPosition", { required: true }); // const isPositionOld = defineModel("isPositionOld", { required: true }); //แสดงตำแหน่งที่ตรงกับประเภทและระดับเดิม -const posType = defineModel("posType", { required: true }); //ตำแหน่งประเภท +const posType = defineModel("posType", { required: true }); //ตำแหน่งประเภท const posLevel = defineModel("posLevel", { required: true }); //ระดับตำแหน่ง const optionPosType = defineModel("optionPosType", { required: true, @@ -47,6 +47,7 @@ const props = defineProps({ onPosType: Function, nodeId: String, nodeLevel: Number, + isLoadPosition: Boolean, }); //Table @@ -248,15 +249,20 @@ watch(positionData, (newVal, oldVal) => { } }); +watch( + () => props.isLoadPosition, + (newVal) => { + if (newVal && positionId.value) { + onClickSelectPos(positionId.value); + } + } +); + /** * ทำงานเมื่อ Components ถูกเรียกใช้งาน */ onMounted(async () => { - if (positionId.value) { - setTimeout(async () => { - await onClickSelectPos(positionId.value); - }, 1000); - } else { + if (!positionId.value) { positionRows.value = positionData.value; positionRowsData.value = positionData.value; } diff --git a/src/modules/05_placement/components/PersonalList/DialogSelectOrg.vue b/src/modules/05_placement/components/PersonalList/DialogSelectOrg.vue index 9d06a7da3..2eb316763 100644 --- a/src/modules/05_placement/components/PersonalList/DialogSelectOrg.vue +++ b/src/modules/05_placement/components/PersonalList/DialogSelectOrg.vue @@ -1,5 +1,5 @@ @@ -291,25 +287,31 @@ onMounted(async () => {
-
+
- - + + From 8dc473eec0f99d6bbfe5ae7a104e6362124a07a7 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 11 May 2026 15:54:10 +0700 Subject: [PATCH 13/47] refactor(leave): validate isAct commander --- .../components/05_Leave/DetailLeavePage.vue | 33 +++++++++++++++---- .../05_Leave/Dialog/DialogAddCommander.vue | 11 +++++-- .../09_leave/interface/response/leave.ts | 2 ++ 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/modules/09_leave/components/05_Leave/DetailLeavePage.vue b/src/modules/09_leave/components/05_Leave/DetailLeavePage.vue index 4f4b2ee46..b74df44e6 100644 --- a/src/modules/09_leave/components/05_Leave/DetailLeavePage.vue +++ b/src/modules/09_leave/components/05_Leave/DetailLeavePage.vue @@ -150,21 +150,41 @@ const rows = ref(); // เช็คสิทธิ์การอนุมัติ const idCheck = computed(() => { if (typeAdd.value == "COMMANDER") { - return rows.value?.commanders.map((items: SeqTypeRow) => items.profileId); + return rows.value?.commanders.map((items: SeqTypeRow) => items.keyId); } else if (typeAdd.value == "APPROVER") { - return rows.value?.approvers.map((items: SeqTypeRow) => items.profileId); + return rows.value?.approvers.map((items: SeqTypeRow) => items.keyId); } }); // เช็คสิทธิ์การเลือกผู้มีอำนาจ const commanderList = computed(() => { - if (typeAdd.value == "COMMANDER") { - return rows.value?.approvers.map((items: SeqTypeRow) => items.profileId); - } else if (typeAdd.value == "APPROVER") { - return rows.value?.commanders.map((items: SeqTypeRow) => items.profileId); + if (typeAdd.value === "COMMANDER") { + return rows.value?.approvers.map((items: SeqTypeRow) => ({ + profileId: items.profileId, + isAct: items.isAct, + })); + } else if (typeAdd.value === "APPROVER") { + return rows.value?.commanders.map((items: SeqTypeRow) => ({ + profileId: items.profileId, + isAct: items.isAct, + })); } + return []; }); +// +const isAct = computed(() => { + if (typeAdd.value === "COMMANDER") { + return rows.value?.commanders && rows.value.commanders.length > 0 + ? rows.value.commanders[0].isAct + : false; + } else if (typeAdd.value === "APPROVER") { + return rows.value?.approvers && rows.value.approvers.length > 0 + ? rows.value.approvers[0].isAct + : false; + } + return false; +}); // เช็คว่าผู้ใช้มีสิทธิ์อนุมัติหรือไม่ const approveCheck = computed(() => { const commanders = rows.value?.commanders; @@ -1272,5 +1292,6 @@ onMounted(async () => { :id-check="idCheck" :keycloak-user-id="keycloakUserId" :commanders-list="commanderList" + :commanders-is-act="isAct" /> diff --git a/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue b/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue index c3eac2353..f3c2e682f 100644 --- a/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue +++ b/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue @@ -30,6 +30,7 @@ const props = defineProps({ fetchDetailLeave: Function, idCheck: Array, commandersList: Array, + commandersIsAct: Boolean, }); const pageId = ref(route.params.id as string); @@ -117,7 +118,7 @@ async function getData() { total.value = data.total; rows.value = data.data; selected.value = data.data.filter((items: any) => { - return props.idCheck?.some((i: any) => i === items.id); + return props.idCheck?.some((i: any) => i === items.key); }); }) .catch((err) => { @@ -153,10 +154,14 @@ function onSubmit() { ] .filter(Boolean) .join(" "), + isAct: isAct.value, + keyId: items.key, })); const hasCommander = selected.value.some((e) => - props.commandersList?.some((i: any) => i === e.id) + props.commandersList?.some( + (i: any) => i.profileId === e.id && i.isAct === isAct.value + ) ); if (hasCommander) { @@ -205,6 +210,7 @@ watch( () => modal.value, () => { if (modal.value) { + isAct.value = props.commandersIsAct ?? false; getSearch(); } } @@ -233,6 +239,7 @@ watch( label="ค้นหา" v-model="keyword" style="width: 300px" + @keydown.enter.prevent="onSearchData()" >