diff --git a/src/modules/05_placement/components/PersonalList/Detail.vue b/src/modules/05_placement/components/PersonalList/Detail.vue index a541637c4..03c2e41d4 100644 --- a/src/modules/05_placement/components/PersonalList/Detail.vue +++ b/src/modules/05_placement/components/PersonalList/Detail.vue @@ -33,7 +33,7 @@ const stat = ref({ contain: 0, disclaim: 0, }); - +// เรียกข้อมูล Stat const getStat = async () => { const examIdString = Array.isArray(examId) ? examId[0] : examId; await http @@ -76,7 +76,7 @@ onMounted(async () => { const fetchPlacementData = async () => { showLoader(); - http + await http .get(config.API.MainDetail(0)) .then(async (res) => { DataStore.DataMainOrig = res.data.result; diff --git a/src/modules/05_placement/components/PersonalList/OrgTree.vue b/src/modules/05_placement/components/PersonalList/OrgTree.vue index 046ca478a..40ab23244 100644 --- a/src/modules/05_placement/components/PersonalList/OrgTree.vue +++ b/src/modules/05_placement/components/PersonalList/OrgTree.vue @@ -199,7 +199,7 @@ const closeModal = () => { closeAndClear(); } }; - +// clean ข้อมูล const closeAndClear = async () => { await props.close(); editDataStatus.value = false; @@ -346,7 +346,7 @@ const checkPosition = (val: string) => { }; const personal = ref(); const expanded = ref([]); - +// เมื่อ props เปลี่ยนแปลงจะโหลดหน่วยงาน watch(props, () => { expanded.value = []; const dataPersonal = props.personal; @@ -361,10 +361,10 @@ watch(props, () => { personal.value.draft === false && personal.value.positionNumber !== null ) { - let findData: any = null; + let findData: any = null; dataRespone.value.map((x: any) => { findData = findByPerson(x); - + // ถ้ามีตำแต่งจะทำการ expandedTree if (findData != null) { selectedPosition(findData); for (let i = 3; i <= findData.keyId.length; i += 2) { @@ -374,7 +374,7 @@ watch(props, () => { }); } }); -// หาตำหน่วยงานที่เลือก +// หาหน่วยงานที่เลือก function findByPerson(element: any): any { if ( element.positionNumId && diff --git a/src/modules/05_placement/components/PersonalList/TableDetail.vue b/src/modules/05_placement/components/PersonalList/TableDetail.vue index 4b162ff79..27fe4b9e5 100644 --- a/src/modules/05_placement/components/PersonalList/TableDetail.vue +++ b/src/modules/05_placement/components/PersonalList/TableDetail.vue @@ -7,7 +7,7 @@ import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง -const { showLoader, hideLoader, date2Thai } = mixin; +const { showLoader, hideLoader, date2Thai, messageError } = mixin; const $q = useQuasar(); const props = defineProps({ @@ -78,13 +78,13 @@ const columns = ref([ const myForm = ref([]); const personalForm = ref([]); const selection = ref([]); - +// เมื่อ props.Modal จะเรียกข้อมูลการศึกษา watch(props, () => { if (props.Modal === true) { fetchData(); } }); - +// ข้อมูลการศึกษา const fetchData = async () => { showLoader(); await http @@ -101,7 +101,7 @@ const fetchData = async () => { }); }) .catch((e) => { - console.log("e", e); + messageError($q, e); }) .finally(() => { hideLoader(); @@ -120,7 +120,7 @@ const formBmaofficer = (val: string) => { return ""; } }; - +// ปิด POPUP ข้อมูล const close = async () => { props.close(); selection.value = []; diff --git a/src/modules/06_retirement/components/ListRetirement/AddList.vue b/src/modules/06_retirement/components/ListRetirement/AddList.vue index 09bfab931..4a1ad11af 100644 --- a/src/modules/06_retirement/components/ListRetirement/AddList.vue +++ b/src/modules/06_retirement/components/ListRetirement/AddList.vue @@ -93,6 +93,7 @@ const fecthlistRetire = async () => { messageError($q, e); }); }; +// เรียกรายชื่อประกาศเกษียณอายุราชการเพิ่ม const findlist = async (id: string) => { let data = [{}]; if (type.value === "officer") { @@ -122,7 +123,7 @@ const findlist = async (id: string) => { }); }; -// putlist +// ยืนยันการเพิ่มราชชื่อ const clickAdd = (props: any) => { if (retireld.value == undefined) { retireld.value = retireld_params; diff --git a/src/modules/06_retirement/components/ListRetirement/TableList.vue b/src/modules/06_retirement/components/ListRetirement/TableList.vue index 450e826c1..3980518b5 100644 --- a/src/modules/06_retirement/components/ListRetirement/TableList.vue +++ b/src/modules/06_retirement/components/ListRetirement/TableList.vue @@ -172,6 +172,7 @@ const fecthlistprofile = async (id: string) => { statusReport.value = res.data.result.json; typeReport.value = res.data.result.typeReport; textReport.value = res.data.result.detail; + // รายชื่อผู้เกษียณอายุราชการ rows.value = res.data.result.profile.map((e: any) => ({ id: e.id, profileId: e.profileId, @@ -266,6 +267,7 @@ const UpdateListId = (retireld: string, pId: string) => { profileId.value = pId; fecthlistprofile(retireld); }; +// กลับหน้าเดิม const backHistory = () => { window.history.back(); }; @@ -274,6 +276,7 @@ const visibleNote = computed(() => { return true; } }); +// อัปโหลดไฟล์ const uploadFile = async (event: any) => { showLoader(); const selectedFile = event; @@ -294,7 +297,7 @@ const uploadFile = async (event: any) => { hideLoader(); }); }; - +// downloadAttachment const downloadAttachment = async (type: string, id: string) => { showLoader(); await http @@ -311,6 +314,7 @@ const downloadAttachment = async (type: string, id: string) => { hideLoader(); }); }; +// downloadFile const downloadFile = (response: any, filename: string) => { const link = document.createElement("a"); var fileName = filename; @@ -320,7 +324,7 @@ const downloadFile = (response: any, filename: string) => { link.click(); document.body.removeChild(link); }; - +// ยืนยันการแก้ไขข้อมูล const saveEdiitReport = (reason: string) => { const formdata = new FormData(); formdata.append("Detail", reason); @@ -344,9 +348,11 @@ const saveEdiitReport = (reason: string) => { "ต้องการยืนยันการแก้ไขข้อมูลนี้หรือไม่ ?" ); }; +// เปิด popup เหตุผล const openmodalEditReport = () => { modalEdit.value = true; }; +// ปิด popup เหตุผล const closemodalEditReport = () => { modalEdit.value = false; }; @@ -587,7 +593,7 @@ const paginationLabel = (start: number, end: number, total: number) => { {{ props.row.bureau }} - + { + if (edit.value) { + await editData(id.value); + } else { + await addData(); + clickBack(); + } +}; +// อัพเดทวันที่เริ่มต้น และ สิ้นสุด +const updateDateRange = () => { + if (roundInsig.value.value == 1) { + dateStart.value = new Date(new Date().getFullYear(), 9, 1); + dateEnd.value = new Date(new Date().getFullYear() + 1, 3, 29); + } else if (roundInsig.value.value == 2) { + dateStart.value = new Date(new Date().getFullYear(), 3, 29); + dateEnd.value = new Date(new Date().getFullYear(), 4, 29); + } +}; +// เพิ่มข้อมูลรอบการเสนอขอพระราชทานเครื่องราชฯ +const addData = async () => { + const formData = new FormData(); + const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${ + roundInsig.value.value + } ปี ${yearly.value + 543} `; + formData.append("name", name); + formData.append("year", yearly.value.toString()); + formData.append("amount", datelast.value.toString()); + formData.append("round", roundInsig.value.value); + if (dateStart.value !== null) { + formData.append("startDate", dateToISO(dateStart.value)); + } + if (dateEnd.value !== null) { + formData.append("endDate", dateToISO(dateEnd.value)); + } + formData.append("file", files.value); + showLoader(); + await http + .post(config.API.listRoundInsignia(), formData) + .then(() => { + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + hideLoader(); + }); +}; +// แก้ไขข้อมูล const editData = async (id: string) => { const formData = new FormData(); const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${ @@ -108,66 +172,6 @@ const editData = async (id: string) => { clickBack(); }); }; -const checkSave = () => { - if (myForm.value !== null) { - myForm.value.validate().then(async (success) => { - if (success) { - dialogConfirm($q, () => SaveData()); - } else { - dialogMessageNotify($q, "กรุณาเลือกรอบการเสนอขอพระราชทานเครื่องราชฯ"); - } - }); - } -}; -const SaveData = async () => { - if (edit.value) { - await editData(id.value); - } else { - await addData(); - clickBack(); - } -}; - -const updateDateRange = () => { - if (roundInsig.value.value == 1) { - dateStart.value = new Date(new Date().getFullYear(), 9, 1); - dateEnd.value = new Date(new Date().getFullYear() + 1, 3, 29); - } else if (roundInsig.value.value == 2) { - dateStart.value = new Date(new Date().getFullYear(), 3, 29); - dateEnd.value = new Date(new Date().getFullYear(), 4, 29); - } -}; - -const addData = async () => { - const formData = new FormData(); - const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${ - roundInsig.value.value - } ปี ${yearly.value + 543} `; - formData.append("name", name); - formData.append("year", yearly.value.toString()); - formData.append("amount", datelast.value.toString()); - formData.append("round", roundInsig.value.value); - if (dateStart.value !== null) { - formData.append("startDate", dateToISO(dateStart.value)); - } - if (dateEnd.value !== null) { - formData.append("endDate", dateToISO(dateEnd.value)); - } - formData.append("file", files.value); - - showLoader(); - await http - .post(config.API.listRoundInsignia(), formData) - .then(() => { - success($q, "บันทึกข้อมูลสำเร็จ"); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - hideLoader(); - }); -}; const clickBack = () => { router.push({ name: "insigniaProposals" }); @@ -329,6 +333,11 @@ const clickBack = () => { v-model="datelast" label="จำนวนวันแจ้งเตือนก่อนวันสิ้นสุด" mask="###" + :rules="[ + (val) => + !!val || `${'กรุณากรอกจำนวนวันแจ้งเตือนก่อนวันสิ้นสุด'}`, + ]" + lazy-rules /> ([ style: "font-size: 14px", }, ]); - // ข้อมูลตาราง (จำลอง) const rows = ref([]); @@ -118,11 +117,11 @@ const fetchData = async () => { hideLoader(); }); }; - +// redirect หน้าข้อมูลรอบการเสนอข้อ const clickEdit = (col: any) => { router.push(`/insignia/round-add/${col.period_id}`); }; - +// ยืนยันการลบรอบการเสนอขอ const clickDelete = (id: string) => { dialogRemove($q, async () => { showLoader(); @@ -144,15 +143,15 @@ const clickDelete = (id: string) => { const clickAdd = () => { router.push({ name: "roundAdd" }); }; - +// คำนวณราชชื่อผู้ได้รับเครื่องราช const clickListInsignia = async (propsId: string) => { dialogConfirm( $q, async () => { await getRequest(propsId); }, - "ยืนยันการคำนวณราชชื่อผู้ได้รับเครื่องราช", - "ต้องการยืนยันการคำนวณราชชื่อผู้ได้รับเครื่องราชนี้หรือไม่ ?" + "ยืนยันการคำนวณราชชื่อผู้ได้รับเครื่องราชฯ", + "ต้องการยืนยันการคำนวณราชชื่อผู้ได้รับเครื่องราชฯนี้หรือไม่ ?" ); }; // เรียกจาก API ข้อมูลผู้ได้รับเครื่องราชฯ diff --git a/src/modules/07_insignia/components/2_Manage/Tab1.vue b/src/modules/07_insignia/components/2_Manage/Tab1.vue index 2c68c4d42..17b215ea9 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab1.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab1.vue @@ -241,7 +241,7 @@ const checkStatus = computed(() => { return true; } else return false; }); -// เลืแกหน่วยงาน +// เลือกหน่วยงาน const changtypeOc = () => { if (props.fecthInsigniaByOc) { props.fecthInsigniaByOc( diff --git a/src/modules/07_insignia/components/3_result/DialogForm.vue b/src/modules/07_insignia/components/3_result/DialogForm.vue index 6d8e22301..7270f401e 100644 --- a/src/modules/07_insignia/components/3_result/DialogForm.vue +++ b/src/modules/07_insignia/components/3_result/DialogForm.vue @@ -62,12 +62,12 @@ const clearAnnounceExam = () => { // reset วันที่ได้รับพระราชทานเครื่องราชอิสริยาภรณ์ const clearDateReceivedate = () => { receivedate.value = null; -} +}; // reset วันที่จ่ายใบกำกับ const clearDateInvoiceDate = () => { invoiceDate.value = null; -} +}; const props = defineProps({ modal: Boolean, @@ -90,6 +90,7 @@ const props = defineProps({ type: String, }, }); +// เปิด popup เพิ่มราชชื่อบันทึกผล watch(props, () => { if (props.modal === true) { employeeClass.value = ""; @@ -111,7 +112,7 @@ watch(props, () => { payment.value = ""; if (props.personId !== undefined) { if (props.action === "editData") { - fectDataByid(props.personId); + fectDataByid(props.personId); // เมือแก้ไข เรียกข้อมูลบันทึกผล } } } @@ -121,7 +122,7 @@ const disbleStatus = computed(() => { return false; } else return true; }); - +// เลือกประเภทลูกจ้าง const selectType = async () => { showLoader(); cardid.value = ""; @@ -142,24 +143,27 @@ const selectType = async () => { payment.value = ""; await fecthlistPerson(); }; - +// เรียกหน่วยงาน const fecthlistPerson = async () => { await http .get(config.API.profileOrganizRoot) .then((res) => { const id = res.data.result[0].id; if (id !== "") { - findlist(id); + findlist(id); // id หน่วยงานไปเรียกราชชื่อ } }) .catch((e) => { messageError($q, e); }); }; +// เรียกราชชื่อลูกจ้างตาม id หน่วยงาน const findlist = async (id: string) => { let data = [{}]; + // ข้าราชการ if (employeeClass.value === "officer") { data = [{ criteriaType: "is_retire", criteriaValue: "false" }]; + // ลูกจ้างประจำ } else if (employeeClass.value === "employee") { data = [ { criteriaType: "is_retire", criteriaValue: "false" }, @@ -180,6 +184,7 @@ const findlist = async (id: string) => { hideLoader(); }); }; +// เรียกข้อมูลบันทึกผลตาม id const fectDataByid = async (id: string) => { showLoader(); if (props.profileType !== undefined) { @@ -215,6 +220,7 @@ const fectDataByid = async (id: string) => { hideLoader(); }); }; +// บักทึกผล const clickSave = async () => { let body = { citizanId: cardid.value, // เลขบัตร @@ -233,6 +239,7 @@ const clickSave = async () => { typePayment: payment.value, // รูปแบบการจ่าย address: addressPayment.value, //ที่อยู่ }; + // เช็คค่าว่าง await myForm.value!.validate().then((result: boolean) => { if (result) { dialogConfirm($q, async () => { @@ -241,6 +248,7 @@ const clickSave = async () => { } }); }; +// เพิ่มแก้ ข้อมูลบันทึกผล const addNote = async (body: any) => { if (props.roundId !== undefined) { await http @@ -258,12 +266,13 @@ const addNote = async (body: any) => { }); } }; +// หาเลขบัตรประจำตัวประชาชน const searchcardid = () => { if (cardid.value.length === 13) { let data = listPerson.value.find((e: any) => e.citizenId === cardid.value); if (data) { - fullName.value = data.fullname; - position.value = data.positionEmployeePosition; + fullName.value = data.fullname; // ชื่อ + position.value = data.positionEmployeePosition; // ตำแหน่ง } else notifyError($q, "ไม่พบข้อมูลเลขบัตรประชาชนนี้"); } }; diff --git a/src/modules/07_insignia/components/4_Allocate/Main.vue b/src/modules/07_insignia/components/4_Allocate/Main.vue index 4f44e14ff..ba1546263 100644 --- a/src/modules/07_insignia/components/4_Allocate/Main.vue +++ b/src/modules/07_insignia/components/4_Allocate/Main.vue @@ -13,7 +13,6 @@ import type { OptionDataYear } from "@/modules/07_insignia/interface/index/Main" import type { QTableProps, QInput } from "quasar"; import { useQuasar } from "quasar"; - const DataStore = useAllocateDataStore(); const mixin = useCounterMixin(); const { showLoader, hideLoader, messageError, dialogRemove, success } = mixin; @@ -47,7 +46,7 @@ const loadView = ref(false); onMounted(async () => { await fecthRound(); }); - +// เรียกรอบการเสนอขอ const fecthRound = async () => { await http .get(config.API.noteround()) @@ -78,7 +77,7 @@ const fecthRound = async () => { messageError($q, err); }); }; - +// ประเภทเครื่องราช const fecthInsignia = async () => { await http .get(config.API.insignia) @@ -95,7 +94,7 @@ const fecthInsignia = async () => { ); }); }; - +// tab const fecthInsigniaType = async () => { await http(config.API.insigniaType) .then((res) => { @@ -167,6 +166,7 @@ const columns = ref([ style: "font-size: 14px", }, ]); +// เมื่อเปลี่ยน tab watch(tab, () => { insigniaOp.value = DataStore.insigniaOp.filter( (x: any) => x.type == tab.value || x.type === "" @@ -178,23 +178,25 @@ watch(tab, () => { fecthlistInsignia(); }); +// เลือกรอบการเสนขอ const selectorRound = (round: string | undefined) => { selectRound.value = round; if (selectRound.value) { DataStore.roundId = selectRound.value; } - const yearFilter = selectRoundOption.value.find((x: any) => x.id == round); + const yearFilter = selectRoundOption.value.find((x: any) => x.id == round); // หาปีของรอบการเสนอขอ roundYear.value = yearFilter?.year; DataStore.roundYear = roundYear.value; fecthlistInsignia(); }; - +// เรียกรายการเครืองราชฯ const fecthlistInsignia = async () => { DataStore.mainTab = tab.value; showLoader(); await http .get(config.API.insigniaManageType(tab.value, Number(roundYear.value))) .then((res) => { + console.log(res); let data = res.data.result; DataStore.listinsignia(data); }) @@ -213,7 +215,7 @@ const close = () => { modal.value = false; modalEdit.value = false; }; - +// เปิด popup การเพิ่มการจัดสรรเครื่องราชฯ const addData = () => { modal.value = true; action.value = "addData"; @@ -227,7 +229,7 @@ const clickEditrow = (data: any) => { modalEdit.value = true; actionType.value = "insignia"; }; - +// บันทึกการเพิ่มการจัดสรรเครื่องราชฯ const save = async (insigniaId: string, total: string) => { showLoader(); await http @@ -248,6 +250,7 @@ const save = async (insigniaId: string, total: string) => { close(); }); }; +// แก้ไขการจัดสรรเครื่องราชฯ const saveEdit = async ( id: string, insigniaId: string, @@ -274,6 +277,7 @@ const saveEdit = async ( close(); }); }; +// ลบการจัดสรรเครื่องราชฯ const clickDelete = async (insigniaId: string) => { dialogRemove($q, async () => { showLoader(); @@ -303,16 +307,42 @@ const resetFilter = () => {
จัดสรรเครื่องราชอิสริยาภรณ์
- +
รอบ
- +
- +
@@ -320,41 +350,105 @@ const resetFilter = () => { - +
- + " + />
- + เพิ่ม
- + - +
- +
@@ -424,8 +577,19 @@ const resetFilter = () => {
- + - + diff --git a/src/modules/07_insignia/components/4_Allocate/OrgAdd.vue b/src/modules/07_insignia/components/4_Allocate/OrgAdd.vue index c9031c533..3406c98fa 100644 --- a/src/modules/07_insignia/components/4_Allocate/OrgAdd.vue +++ b/src/modules/07_insignia/components/4_Allocate/OrgAdd.vue @@ -9,8 +9,7 @@ import DialogHeader from "@/modules/07_insignia/components/DialogHeader.vue"; import cardTop from "@/modules/07_insignia/components/2_Manage/StatCard.vue"; const mixin = useCounterMixin(); -const { dialogMessage } = - mixin; +const { dialogMessage } = mixin; const name = ref(""); const $q = useQuasar(); //ใช้ noti quasar const modal = ref(false); @@ -301,15 +300,9 @@ const saveNote = async () => { true ); return; - } else { - await saveTextNote(); } }; -const saveTextNote = async () => {}; -const redirectToPage = (id?: string) => { - router.push({ name: "allocateDetail" }); -}; // ค้นหาในตาราง const filterKeyword = ref(""); const filterRef = ref(null); @@ -483,11 +476,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
- +