diff --git a/src/api/15_development/api.development.ts b/src/api/15_development/api.development.ts index da4023246..0ea20d574 100644 --- a/src/api/15_development/api.development.ts +++ b/src/api/15_development/api.development.ts @@ -4,6 +4,7 @@ const developmentOrg = `${env.API_URI}/org`; const devScholarship = `${env.API_URI}/development/scholarship`; const developmentReport = `${env.API_URI}/development/report`; const devStrategy = `${env.API_URI}/development/strategy`; +const developmentScholarshipReport = `${env.API_URI}/development/report/scholarship`; export default { development, /** history */ @@ -56,5 +57,6 @@ export default { `${developmentOrg}/profile/development/registry/OFFICER/${id}`, developmentIDP: (id: string) => `${development}/main/registry/OFFICER/${id}`, - devStrategySort:`${devStrategy}/sort` + devStrategySort:`${devStrategy}/sort`, + developmentScholarshipReport }; diff --git a/src/modules/04_registryPerson/components/detail/Achievement/02_Train.vue b/src/modules/04_registryPerson/components/detail/Achievement/02_Train.vue index 4069f1d3b..dd138d859 100644 --- a/src/modules/04_registryPerson/components/detail/Achievement/02_Train.vue +++ b/src/modules/04_registryPerson/components/detail/Achievement/02_Train.vue @@ -2,7 +2,7 @@ import { ref, reactive, onMounted } from "vue"; import { QForm, useQuasar } from "quasar"; -import { useRoute } from "vue-router"; +import { useRoute, useRouter } from "vue-router"; import { checkPermission } from "@/utils/permissions"; import type { QTableColumn } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; @@ -21,6 +21,7 @@ const isLeave = defineModel("isLeave", { }); const route = useRoute(); +const router = useRouter(); const $q = useQuasar(); const mixin = useCounterMixin(); const { @@ -368,6 +369,9 @@ function onViewHistory(id: string) { historyId.value = id; historyDialog.value = true; } +function onViewDevelopment(id: string) { + router.push(`/development-detail/${id}`); +} /** fetch ข้อมูลประวัติการแก้ไขข้อมูลใบอนุญาตประกอบวิชาชีพ*/ async function fetchDataHistory() { @@ -505,6 +509,21 @@ onMounted(() => { + +
(""); const $q = useQuasar(); @@ -36,6 +40,11 @@ const checkRouteDetail = ref( route.name == "developmentScholarshipidDetail" ); // check ชือ route +const modalUpload = ref(false); +const documentFile = ref(null); +const fileList = ref(); + +const dialogReturn = ref(false); const title = ref(route.params.id ? "แก้ไข" : "เพิ่ม"); //หัวข้อหน้า const scholarshipId = ref( route.params.id ? route.params.id.toLocaleString() : null @@ -52,6 +61,21 @@ const budgetSourceOp = ref([ { id: "OTHER", name: "เงินอื่นๆ" }, ]); +const useOfficialTimeOp = ref([ + { + id: "NOUSETIME", + name: "ไม่ใช้เวลาราชการ", + }, + { + id: "USETIME", + name: "ใช้เวลาราชการ", + }, + { + id: "SOMETIME", + name: "ใช้เวลาราชการบางส่วน", + }, +]); + const scholarshipTypeOp = ref([ { id: "DOMESTICE", name: "การศึกษาในประเทศ" }, { @@ -67,8 +91,12 @@ const scholarshipTypeOp = ref([ name: "ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยงานภายนอก (หลักสูตรประเภทนักบริหาร)", }, { - id: "RESEARCH", - name: "ศึกษา ฝึกอบรม ประชุม ดูงาน และปฏิบัติการวิจัย ณ ต่างประเทศ", + id: "STUDY", + name: "ทุนการศึกษา ณ ต่างประเทศ", + }, + { + id: "TRAINING", + name: "ทุนฝึกอบรม ณ ต่างประเทศ", }, ]); const fundTypeOp = ref([ @@ -141,7 +169,7 @@ const formBody = reactive({ bookNo: "", //เลขที่หนังสืออนุมัติ bookNoDate: null, //ลงวันที่(หนังสือ) bookApproveDate: null, //หนังสืออนุมัติเมื่อวันที่ - useOfficialTime: false, //ใช้เวลาราชการ + useOfficialTime: "NOUSETIME", //ใช้เวลาราชการ changeDetail: "", //เปลี่ยนแปลงรายละเอียด scholarshipType: "", //เลือกประเภททุน fundType: "", //ประเภททุน @@ -168,6 +196,7 @@ const formBody = reactive({ totalPeriod: "", //รวมระยะเวลาในการศึกษา/รวมระยะเวลาในการฝึกอบรม planType: "", isNoUseBudget: false, + budgetSourceOther: "", //เงินอื่นๆ }); /** @@ -213,7 +242,7 @@ async function fetchDataDetail(id: string) { formBody.bookApproveDate = data.bookApproveDate; formBody.useOfficialTime = data.useOfficialTime ? data.useOfficialTime - : false; + : "NOUSETIME"; formBody.changeDetail = data.changeDetail; formBody.scholarshipType = data.scholarshipType; formBody.fundType = data.fundType; @@ -239,6 +268,7 @@ async function fetchDataDetail(id: string) { formBody.studyAbroadStartDate = data.studyAbroadStartDate; formBody.studyAbroadEndDate = data.studyAbroadEndDate; formBody.totalPeriod = data.totalPeriod; + formBody.budgetSourceOther = data.budgetSourceOther; formBody.planType = data.planType ? data.planType : ""; formBody.isNoUseBudget = data.isNoUseBudget ? data.isNoUseBudget : false; @@ -289,15 +319,11 @@ function onSubmit() { ? Number(formBody.budgetApprove.replace(/,/g, "")) : formBody.budgetApprove; - if (formBody.scholarshipType === "RESEARCH") { - formBody.planType = ""; - formBody.fundType = ""; - formBody.budgetSource = ""; - formBody.useOfficialTime = false; - formBody.reportBackNo = ""; - formBody.reportBackNoDate = null; - formBody.reportBackDate = null; - formBody.changeDetail = ""; + if ( + formBody.scholarshipType === "STUDY" || + formBody.scholarshipType === "TRAINING" + ) { + formBody.useOfficialTime = "NOUSETIME"; } try { @@ -492,13 +518,16 @@ function upDate(data: DataPerson) { * @param id id ของรายการ */ async function checkFileBackReceived(id: string) { - await http - .get( - config.API.file("ระบบพัฒนาบุคคล", "ฟอร์มรายงานตัวกลับเข้ารับราชการ", id) - ) - .then(async (res) => { - fileBackReceived.value = res.data.length > 0 ? res.data[0].fileName : ""; - }); + if (fileBackReceived.value.length == 0) { + await http + .get( + config.API.file("ระบบพัฒนาบุคคล", "ฟอร์มรายงานตัวกลับเข้ารับราชการ", id) + ) + .then(async (res) => { + fileBackReceived.value = + res.data.length > 0 ? res.data[0].fileName : ""; + }); + } } /** download file */ @@ -538,39 +567,104 @@ const classInput = (val: boolean) => { }; }; -// const convertStudyPlace = () => { -// switch (formBody.studyTopic) { -// case "ศึกษา": -// return "สถานที่ไปศึกษา (เมือง/ประเทศ)"; -// case "ฝึกอบรม": -// return "สถานที่เข้ารับการฝึกอบรม (เมือง/ประเทศ)"; -// case "ดูงาน": -// return "สถานที่ไปดูงาน"; -// case "ประชุม": -// return "สถานที่จัดประชุม (เมือง/ประเทศ)"; -// case "ปฏิบัติการวิจัย": -// return "สถานที่ไปปฏิบัติการวิจัย (เมือง/ประเทศ)"; -// default: -// return "สถานที่ (เมือง/ประเทศ)"; -// } -// }; +function onOpenReturn() { + dialogReturn.value = true; +} -const convertCourse = () => { - switch (formBody.studyTopic) { - case "ศึกษา": - return "หลักสูตรการศึกษา"; - case "ฝึกอบรม": - return "หลักสูตรการฝึกอบรม"; - case "ดูงาน": - return "หัวข้อการไปดูงาน"; - case "ประชุม": - return "ชื่อการประชุม"; - case "ปฏิบัติการวิจัย": - return "หลักสูตร"; - default: - return "หลักสูตร"; - } -}; +async function onDownload(type: string) { + showLoader(); + await http + .get(config.API.developmentScholarshipReport + `/${scholarshipId.value}`) + .then(async (res) => { + const dataList = res.data.result; + await genReport( + dataList, + "ฟอร์มรายงานตัวกลับเข้ารับราชการ(ต้นแบบ)", + type + ); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); +} + +function closeDialog() { + modalUpload.value = false; + documentFile.value = null; +} + +async function clickUpload(file: any) { + const fileName = { fileName: file.name }; + + dialogConfirm( + $q, + async () => { + const selectedFile = file; + const formdata = new FormData(); + formdata.append("file", selectedFile); + showLoader(); + + await http + .post( + config.API.file( + "ระบบพัฒนาบุคคล", + "ฟอร์มรายงานตัวกลับเข้ารับราชการ", + scholarshipId.value as string + ), + { + replace: false, + fileList: fileName, + } + ) + .then(async (res) => { + const foundKey: string | undefined = Object.keys(res.data).find( + (key) => + res.data[key]?.fileName !== undefined && + res.data[key]?.fileName !== "" + ); + foundKey && + uploadFileDoc(res.data[foundKey]?.uploadUrl, documentFile.value); + }) + .catch((err) => { + messageError($q, err); + hideLoader(); + }); + }, + "ยืนยันการอัปโหลดไฟล์", + "ต้องการยืนยันการอัปโหลดไฟล์นี้หรือไม่ ?" + ); +} + +/** + * ฟังก์ชั่นสำหรับอัปโหลดไฟล์เอกสารหลักฐาน + */ +async function uploadFileDoc(uploadUrl: string, file: any) { + const Data = new FormData(); + Data.append("file", documentFile.value); + await axios + .put(uploadUrl, file, { + headers: { + "Content-Type": file.type, + }, + }) + .then((res) => { + closeDialog(); + success($q, "อัปโหลดไฟล์สำเร็จ"); + fetchDataDetail(scholarshipId.value as string); + checkFileBackReceived(scholarshipId.value as string); + }) + .catch((e) => { + messageError($q, e); + hideLoader(); + }) + .finally(() => { + hideLoader(); + documentFile.value = null; + }); +} /** ดึงข้อมูลเมื่อคอมโพเนนต์โหลดเสร็จสมบูรณ์ */ onMounted(async () => { @@ -595,8 +689,8 @@ onMounted(async () => { /> {{ checkRouteDetail - ? "รายละเอียดข้าราชการ ฯ ที่ได้รับทุนการศึกษา/ฝึกอบรม" - : `${title}ข้าราชการ ฯ ที่ได้รับทุนการศึกษา/ฝึกอบรม` + ? "รายละเอียดข้าราชการฯ ที่ได้รับทุนการศึกษา/ฝึกอบรม" + : `${title}ข้าราชการฯ ที่ได้รับทุนการศึกษา/ฝึกอบรม` }}
@@ -611,7 +705,61 @@ onMounted(async () => { > ดาวน์โหลด -
+
+
+ + + + + + + + แก้ไขข้อมูลรายงานตัวกลับเข้ารับราชการ + + + + + + + + อัปโหลดไฟล์เอกสารหลักฐาน + + + + + + + + ดาวน์โหลดฟอร์มต้นแบบ .docx + + + + + + + + ดาวน์โหลดฟอร์มต้นแบบ .pdf + + + + + + +
{ class="col-3" v-if=" formBody.scholarshipType !== '' && - formBody.scholarshipType !== 'EXECUTIVE' && - formBody.scholarshipType !== 'RESEARCH' + formBody.scholarshipType !== 'EXECUTIVE' " > { />
-
+
{ />
-
-
- - - - - -
-
- + -
-
- -
-
- + /> +
+
+ +
-
-
- -
-
- +
+
+ +
+
+ + + + + +
+
+ + + + + +
+
- - - - -
-
- - - - - -
-
- + + +
+
+ +
@@ -1053,96 +1234,98 @@ onMounted(async () => {
-
-
- -
-
- - - - - -
-
- - - - - +
+
+
+ +
+
+ + + + + +
+
+ + + + + +
@@ -1236,7 +1419,7 @@ onMounted(async () => { ]" />
-
+
{ week-start="0" :min-date="formBody.startDate" :readonly="checkRouteDetail" + @update:model-value=" + updateTotalPeriod(formBody.startDate, formBody.endDate) + " >
+
+ +
{
-
- -
@@ -1616,7 +1802,7 @@ onMounted(async () => { ]" />
-
+
{ :enableTimePicker="false" week-start="0" :min-date="formBody.startDate" + @update:model-value=" + updateTotalPeriod(formBody.startDate, formBody.endDate) + " >
+
+ +
{ :enableTimePicker="false" week-start="0" :min-date="formBody.studyStartDate" - @update:model-value=" - updateTotalPeriod( - formBody.studyStartDate, - formBody.studyEndDate - ) - " >
-
- -
@@ -1887,7 +2070,7 @@ onMounted(async () => { ]" /> -
+
{ :enableTimePicker="false" week-start="0" :min-date="formBody.startDate" + @update:model-value=" + updateTotalPeriod(formBody.startDate, formBody.endDate) + " >
+
+ +
{ :readonly="checkRouteDetail" week-start="0" :min-date="formBody.studyAbroadStartDate" - @update:model-value=" - updateTotalPeriod( - formBody.studyAbroadStartDate, - formBody.studyAbroadEndDate - ) - " >
-
- -
- +
-
+ -
+