diff --git a/src/modules/06_retirement/components/resign/Resign.vue b/src/modules/06_retirement/components/resign/Resign.vue index ca3c259ba..d12c07654 100644 --- a/src/modules/06_retirement/components/resign/Resign.vue +++ b/src/modules/06_retirement/components/resign/Resign.vue @@ -103,7 +103,7 @@ const columns = ref([ { name: "datetext", align: "left", - label: "วันที่ดำเนินการ", + label: "วันที่ยื่น", sortable: true, field: "datetext", headerStyle: "font-size: 14px", diff --git a/src/modules/06_retirement/components/resign/ResignByid.vue b/src/modules/06_retirement/components/resign/ResignByid.vue index bc5250dc2..0b8866dc7 100644 --- a/src/modules/06_retirement/components/resign/ResignByid.vue +++ b/src/modules/06_retirement/components/resign/ResignByid.vue @@ -46,12 +46,11 @@ const { /** ตัวแปร */ const modalPersonal = ref(false); const personId = ref(""); -// const roleUser = ref(""); +const roleUser = ref(""); const dataProfile = ref(); const id = ref(route.params.id.toString()); const myForm = ref(null); -const myFormConfirm = ref(null); const edit = ref(false); const conditions = ref(false); const dataDetail = ref({ @@ -95,13 +94,21 @@ const reasonReign = ref(""); const dateBreak = ref(null); const isCheckData = computed(() => { + console.log(workflowRef.value?.permission.isOperate); + if ( organizationPositionOld.value !== "" && positionTypeOld.value !== "" && positionLevelOld.value !== "" && posNo.value !== "" && salary.value !== 0 && - date.value !== null + date.value !== null && + (workflowRef.value?.permission.isOperate + ? dataDetail.value.commanderReject !== null + : true) && + (workflowRef.value?.permission.isSign + ? dataDetail.value.oligarchReject !== null + : true) ) { return true; } else return false; @@ -140,8 +147,12 @@ const columns = ref([ ]); /**เปิด-ปิด modal */ -const closeModal = () => (modal.value = false); -const openModal = () => (modal.value = true); +function closeModal() { + modal.value = false; +} +function openModal() { + modal.value = true; +} const file = ref(null); const fileList = ref([]); @@ -175,8 +186,8 @@ async function fetchData(id: string) { showLoader(); await http .get(config.API.resingByid(id)) - .then((res: any) => { - const data = res.data.result; + .then(async (res) => { + const data = await res.data.result; dataProfile.value = data as DataProfile; let list: TypeFile[] = []; @@ -215,80 +226,87 @@ async function fetchData(id: string) { } /**Pop up */ -function popUp(action: "pass" | "passNot") { +function popUp(action: "pass" | "passNot", type: string) { reasonReign.value = ""; dateBreak.value = null; actionPass.value = action === "pass"; + roleUser.value = type; openModal(); } //เงื่อนไขpop up -// function conditionPopup() { -// if (myFormConfirm.value !== null) { -// myFormConfirm.value.validate().then(async (check) => { -// if (check) { -// if (actionPass.value) { -// await confirmpopUp(); -// } else { -// await rejectpopUp(); -// } -// } -// }); -// } -// } +function onSubmit() { + if (actionPass.value) { + confirmpopUp(); + } else { + rejectpopUp(); + } + + // if (myFormConfirm.value !== null) { + // myFormConfirm.value.validate().then(async (check) => { + // if (check) { + + // } + // }); + // } +} //pop up ยืนยันการอนุญาต -// async function confirmpopUp() { -// dialogConfirm( -// $q, -// async () => { -// const body = { -// reason: reasonReign.value, -// }; -// await http -// .put(config.API.resignConfirm(roleUser.value, id.value), body) -// .then(() => { -// success($q, "การอนุญาตสำเร็จ"); -// closeModal(); -// }) -// .catch((e) => { -// messageError($q, e); -// }) -// .finally(() => { -// fetchData(id.value); -// }); -// }, -// "ยืนยันการอนุญาต", -// "ต้องการยืนยันการอนุญาตการลานี้หรือไม่ ?" -// ); -// } +async function confirmpopUp() { + dialogConfirm( + $q, + async () => { + showLoader(); + const body = { + reason: reasonReign.value, + }; + await http + .put(config.API.resignConfirm(roleUser.value, id.value), body) + .then(async () => { + await fetchData(id.value); + closeModal(); + success($q, "การอนุญาตสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); + }, + "ยืนยันการอนุญาต", + "ต้องการยืนยันการอนุญาตการลานี้หรือไม่ ?" + ); +} //pop up การยับยั้งสำเร็จ -// async function rejectpopUp() { -// dialogConfirm( -// $q, -// async () => { -// const body = { -// reason: reasonReign.value, -// date: dateBreak.value, -// }; -// await http -// .put(config.API.resignReject(roleUser.value, id.value), body) -// .then(() => { -// success($q, "การยับยั้งสำเร็จ"); -// closeModal(); -// }) -// .catch((e) => { -// messageError($q, e); -// }) -// .finally(() => { -// fetchData(id.value); -// }); -// }, -// "ยืนยันการยับยั้ง", -// "ต้องการยืนยันการยับยั้งนี้หรือไม่ ?" -// ); -// } +async function rejectpopUp() { + dialogConfirm( + $q, + async () => { + showLoader(); + const body = { + reason: reasonReign.value, + date: dateBreak.value, + }; + await http + .put(config.API.resignReject(roleUser.value, id.value), body) + .then(async () => { + await fetchData(id.value); + closeModal(); + success($q, "การยับยั้งสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); + }, + "ยืนยันการยับยั้ง", + "ต้องการยืนยันการยับยั้งนี้หรือไม่ ?" + ); +} /** * กดยกเลิก @@ -316,8 +334,8 @@ function onSubmitConditions() { isNoBurden: isNoBurden.value, isDiscipline: isDiscipline.value, }) - .then(() => { - fetchData(id.value); + .then(async () => { + await fetchData(id.value); success($q, "บันทึกเงื่อนไขต่าง ๆ สำเร็จ"); conditions.value = false; }) @@ -350,16 +368,16 @@ function onSubmitAttached() { showLoader(); http .put(config.API.resingByid(id.value), formData) - .then(() => { - edit.value = false; + .then(async () => { + await fetchData(id.value); success($q, "บันทึกข้อมูลสำเร็จ"); + edit.value = false; }) .catch((e) => { messageError($q, e); }) - .finally(async () => { - await fetchData(id.value); - await hideLoader(); + .finally(() => { + hideLoader(); }); }); } @@ -523,7 +541,7 @@ function removeFile(fileName: string) { onMounted(async () => { fetchData(id.value); fetchFile(); - const user = await tokenParsed(); + // const user = await tokenParsed(); // if (user) { // const commander = await user.role.includes("commander"); // const oligarch = await user.role.includes("oligarch"); @@ -926,7 +944,7 @@ onMounted(async () => { - + @@ -976,7 +994,29 @@ onMounted(async () => {
ผลการพิจารณาของผู้บังคับบัญชา
+ +
+ + +
+
@@ -1020,6 +1060,27 @@ onMounted(async () => {
ผลการพิจารณาของผู้มีอำนาจ
+ +
+ + +
@@ -1307,7 +1368,7 @@ onMounted(async () => { - + { v-model="reasonReign" :label="`${'กรอกความคิดเห็น/เหตุผล'}`" type="textarea" + class="inputgreen" />
@@ -1343,6 +1405,7 @@ onMounted(async () => { { + บันทึกข้อมูล +