diff --git a/src/modules/06_retirement/components/02_resign/ResignReject.vue b/src/modules/06_retirement/components/02_resign/ResignReject.vue index 0d75f5924..fba220479 100644 --- a/src/modules/06_retirement/components/02_resign/ResignReject.vue +++ b/src/modules/06_retirement/components/02_resign/ResignReject.vue @@ -19,7 +19,6 @@ import type { import DialogHeader from "@/components/DialogHeader.vue"; import CardProfile from "@/components/CardProfile.vue"; -import WorkFlow from "@/components/Workflow/Main.vue"; import DialogAddCommander from "@/modules/06_retirement/components/DialogAddCommander.vue"; /** Use */ @@ -43,7 +42,8 @@ const { /** ตัวแปร */ const roleUser = ref(""); const dataProfile = ref(); - +const group = ref(""); +const approveStep = ref(""); const approveCheck = computed(() => { return ( rowsApprover.value?.commanders?.every( @@ -191,7 +191,6 @@ const dataDetail = ref({ statusMain: "", }); -const workflowRef = ref(null); const organizationPositionOld = ref(""); const positionTypeOld = ref(""); const positionLevelOld = ref(""); @@ -208,32 +207,21 @@ const actionPass = ref(false); const reasonReign = ref(""); const dateBreak = ref(null); -const isCheckData = computed(() => { - if ( - organizationPositionOld.value !== "" && - positionTypeOld.value !== "" && - positionLevelOld.value !== "" && - posNo.value !== "" && - date.value !== null && - dataDetail.value.commanderReject !== null && - dataDetail.value.oligarchReject !== null - ) { - return true; - } else return false; -}); - -/**เปิด-ปิด modal */ -function closeModal() { - modal.value = false; -} -function openModal() { - modal.value = true; -} - const isNoDebt = ref(false); const isNoBurden = ref(false); const isDiscipline = ref(false); +/** ฟังก์ชันปิด popup อนุญาตหรือยับยั้ง*/ +function closeModal() { + modal.value = false; +} + +/** ฟังก์ชันเปิด popup อนุญาตหรือยับยั้ง*/ +function openModal() { + modal.value = true; +} + +/** ฟังก์ชันตรวจสอบวันที่ขอลาออกจากราชการน้อยกว่า 30 วัน*/ function diffDate() { if (date.value !== null && dateLeave.value !== null) { const time = dateLeave.value.getTime() - date.value.getTime(); @@ -247,9 +235,11 @@ function diffDate() { return false; } -/** นำข้อมูลมาจาก API*/ +/** + * ฟังก์ชันดึงข้อมูลรายละเอียดการยกเลิกการลาออก + * @param id id ของผู้ใช้งาน + */ async function fetchData(id: string) { - showLoader(); await http .get(config.API.listResign() + `/cancel/${id}`) .then(async (res) => { @@ -271,6 +261,8 @@ async function fetchData(id: string) { isNoDebt.value = data.isNoDebt; isNoBurden.value = data.isNoBurden; isDiscipline.value = data.isDiscipline; + approveStep.value = data.approveStep; + group.value = data.group; statusCheck.value = data.status; profileType.value = data.profileType; @@ -282,13 +274,14 @@ async function fetchData(id: string) { }) .catch((e) => { messageError($q, e); - }) - .finally(() => { - hideLoader(); }); } -/**Pop up */ +/** + * ฟังก์ชันเปิด pop up อนุญาตหรือยับยั้ง + * @param action action อนุญาตหรือยับยั้ง + * @param type ประเภทผู้ใช้งาน + */ function popUp(action: "pass" | "passNot", type: string) { reasonReign.value = ""; dateBreak.value = null; @@ -297,7 +290,7 @@ function popUp(action: "pass" | "passNot", type: string) { openModal(); } -//เงื่อนไขpop up +/** ฟังก์ชันยืนยันการอนุญาตหรือยับยั้งการยกเลิกการลาออก*/ function onSubmit() { dialogConfirm($q, async () => { showLoader(); @@ -321,9 +314,7 @@ function onSubmit() { }); } -/** - * กดยกเลิก - */ +/** ฟังก์ชันยกเลิกการแก้ไขข้อมูลแนบท้าย*/ async function clickCancel() { edit.value = false; const data = dataDetail.value; @@ -346,7 +337,7 @@ async function clickCancel() { myForm.value?.resetValidation(); } -/** Function บันทึก ,แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/ +/** ฟังก์ชันบันทึกข้อมูลเพื่อลงบัญชีแนบท้าย*/ function onSubmitAttached() { dialogConfirm($q, () => { const formData = new FormData(); @@ -381,7 +372,7 @@ function onSubmitAttached() { } /** - * Function เพิ่ม Class เวลา Edit + * ฟังก์ชันเปลี่ยน Class * @param val เมื่อเป็นEdit จะเปลี่ยน Class */ function getClass(val: boolean) { @@ -391,22 +382,16 @@ function getClass(val: boolean) { }; } -/** แปลง StatusOrder */ -function statusOrder(val: boolean) { - switch (val) { - case true: - return "ยับยั้ง"; - case false: - return "อนุญาต"; - } -} - -/** เปิด POP UP */ +/** + * ฟังก์ชันเปิด popup เพิ่มผู้บังคับบัญชา, ผู้มีอำนาจ + * @param type ผู้บังคับบัญชา, ผู้มีอำนาจ + */ function onAddPerson(type: string) { modalAdd.value = true; typeAdd.value = type; } +/** ฟังก์ดึงข้อมูลสิทธ์ สกจ,กจ*/ async function checkOfficer() { try { const data = await fetchDataCheckIsoffice("SYS_RESIGN"); @@ -417,6 +402,7 @@ async function checkOfficer() { } } +/** ฟังก์ชันส่งไปพิจารณา*/ function onSend() { dialogConfirm( $q, @@ -424,20 +410,23 @@ function onSend() { showLoader(); http .get(config.API.sendApproveRetirement("", id.value)) - .then(async (res) => { + .then(async () => { await fetchData(id.value); success($q, "ส่งไปพิจารณา"); }) .catch((e) => { messageError($q, e); }) - .finally(() => {}); + .finally(() => { + hideLoader(); + }); }, "ยืนยันการส่งไปพิจารณา", "ต้องการส่งไปพิจารณาใช่หรือไม่" ); } +/** ฟังก์ชันดึงข้อมูลตำแหน่งจาก Keycloak*/ async function fetchKeycloakPosition() { if (keycloakId.value == "") { await http @@ -452,11 +441,16 @@ async function fetchKeycloakPosition() { } } -/** Hook */ +/** hook ฟังก์ชันเมื่อโหลดคอมโพเนนต์*/ onMounted(async () => { - await fetchData(id.value); - await fetchKeycloakPosition(); - await checkOfficer(); + showLoader(); + await Promise.all([ + fetchData(id.value), + fetchKeycloakPosition(), + checkOfficer(), + ]).finally(() => { + hideLoader(); + }); }); @@ -573,10 +567,14 @@ onMounted(async () => {
- ผลการพิจารณาของผู้บังคับบัญชา + ผลการพิจารณาของผู้บังคับบัญชา {{ group }}
{ เพิ่มรายชื่อผู้บังคับบัญชา - - -
@@ -648,23 +618,16 @@ onMounted(async () => {
{ @click="popUp('pass', 'commander')" /> { ผลการพิจารณาของผู้มีอำนาจ
{
+ + { >คลิกเพื่อส่งไปพิจารณา + { -
+
{ />
- +
@@ -1075,13 +1039,6 @@ onMounted(async () => {
- -
@@ -1115,7 +1072,6 @@ onMounted(async () => { >บันทึกข้อมูล - diff --git a/src/modules/06_retirement/store/resignMain.ts b/src/modules/06_retirement/store/resignMain.ts index 3ab0dcc5d..3cede1e6d 100644 --- a/src/modules/06_retirement/store/resignMain.ts +++ b/src/modules/06_retirement/store/resignMain.ts @@ -18,7 +18,7 @@ export const useDataStore = defineStore("resign", () => { group: "1", }, { - name: "อนุมัติแล้ว", + name: "อนุมัติ/ยับยั้ง", value: "APPROVE", group: "1", },