From 70373acacda2a4b2ec612955458831284c4ff79d Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 18 Mar 2025 15:25:08 +0700 Subject: [PATCH 1/4] =?UTF-8?q?=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A?= =?UTF-8?q?=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7?= =?UTF-8?q?=E0=B8=B1=E0=B8=95=E0=B8=B4=20=3D=3D>=20uploadFile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Achievement/01_ProfessionalLicense.vue | 170 ++++++++++++- .../detail/Achievement/03_Insignia.vue | 6 +- .../Achievement/04_DeclarationHonor.vue | 19 +- .../GovernmentInformation/02_Discipline.vue | 223 ++++++++++++++++-- .../04_PerformSpecialWork.vue | 4 +- .../PersonalInformation/06_SpecialSkill.vue | 11 +- .../detail/Salary/02_NotReceiveSalary.vue | 174 +++++++++++++- .../interface/index/discipline.ts | 1 + .../interface/index/salary.ts | 1 + .../interface/response/ProfesLicense.ts | 1 + src/modules/04_registryPerson/store.ts | 88 +++++++ 11 files changed, 656 insertions(+), 42 deletions(-) diff --git a/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue b/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue index e22eeb689..cd6686ccc 100644 --- a/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue +++ b/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue @@ -5,10 +5,12 @@ import { QForm, useQuasar } from "quasar"; import { useRoute } from "vue-router"; import { checkPermission } from "@/utils/permissions"; import { useCounterMixin } from "@/stores/mixin"; +import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store"; import http from "@/plugins/http"; import config from "@/app.config"; import type { QTableColumn } from "quasar"; +import type { ResFileData } from "@/modules/04_registryPerson/interface/index/Main"; import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/ProfesLicense"; import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/ProfesLicense"; @@ -29,6 +31,8 @@ const { onSearchDataTable, convertDateToAPI, } = mixin; +const { createPathUploadFlie, getPathUploadFlie, uploadFile } = + useRegistryNewDataStore(); const id = ref(route.params.id.toString()); const empType = ref(pathRegistryEmp(route.name?.toString() ?? "")); @@ -165,6 +169,11 @@ const profesLicenseData = reactive({ profileId: id.value, }); +const fileGroup = ref("เอกสารใบอนุญาตประกอบวิชาชีพ"); +const fileUpload = ref(null); +const fileData = ref(null); +const isUpload = ref(false); + /** ยืนยันการบันทึกข้อมูล*/ function onSubmit() { dialogConfirm( @@ -195,7 +204,11 @@ function onSubmit() { ? id.value : undefined, }) - .then(async () => { + .then(async (res) => { + if (fileUpload.value) { + const isId = isEdit ? editId.value : res.data.result; + await uploadfile(isId); + } await fetchData(id.value); success($q, "บันทึกข้อมูลสำเร็จ"); closeDialog(); @@ -212,6 +225,21 @@ function onSubmit() { ); } +async function uploadfile(subId: string) { + try { + const uploadUrl = await createPathUploadFlie( + fileGroup.value, + id.value, + subId + ); + + await uploadFile(uploadUrl, fileUpload.value); + fileUpload.value = null; + } catch (err) { + messageError($q, err); + } +} + /** fetch ข้อมูลรายการใบอนุญาตประกอบวิชาชีพ*/ async function fetchData(id: string) { showLoader(); @@ -247,7 +275,7 @@ function clearForm() { * เปิด form แก้ไขข้อมูลใบอนุญาตประกอบวิชาชีพ * @param row ข้อมูลใบอนุญาตประกอบวิชาชีพ */ -function editForm(row: ResponseObject) { +async function editForm(row: ResponseObject) { dialogStatus.value = "edit"; editId.value = row.id; profesLicenseData.certificateType = row.certificateType; @@ -255,7 +283,16 @@ function editForm(row: ResponseObject) { profesLicenseData.issuer = row.issuer; profesLicenseData.issueDate = row.issueDate; profesLicenseData.expireDate = row.expireDate; + isUpload.value = row.isUpload ? row.isUpload : false; dialog.value = true; + if (isUpload.value) { + const data = await getPathUploadFlie( + fileGroup.value, + id.value, + editId.value + ); + fileData.value = data; + } } function onViewHistory(id: string) { @@ -281,6 +318,11 @@ async function fetchDataHistory() { } } +async function onDownloadFile(subId: string) { + const data = await getPathUploadFlie(fileGroup.value, id.value, subId); + window.open(data.downloadUrl, "_blank"); +} + function serchDataTable() { rows.value = onSearchDataTable( keyword.value, @@ -393,6 +435,7 @@ onMounted(() => { {{ col.label }} + +
+ + + + + + + {{ fileData?.fileName }} + +
+ + + +
+
+
+
+
diff --git a/src/modules/04_registryPerson/components/detail/Achievement/03_Insignia.vue b/src/modules/04_registryPerson/components/detail/Achievement/03_Insignia.vue index 56ee9e0f9..a815618ad 100644 --- a/src/modules/04_registryPerson/components/detail/Achievement/03_Insignia.vue +++ b/src/modules/04_registryPerson/components/detail/Achievement/03_Insignia.vue @@ -333,6 +333,8 @@ async function getInsigniaActive() { .get(config.API.orgInsigniaActive()) .then((res) => { const data = res.data.result; + console.log(data); + mapInsigniaOption(data); }) .catch((e) => { @@ -365,7 +367,7 @@ async function addEditData(editStatus: boolean = false) { }; try { await http[method](url, reqBody).then(async (res) => { - if ((fileUpload.value && id.value) || res.data.result) { + if (fileUpload.value) { await uploadProfile(editStatus ? id.value : res.data.result); } }); @@ -589,6 +591,8 @@ function filterSelector(val: string, update: Function, refData: string) { function insigniaTypeSelection(check: boolean, id: string) { if (check) { insigniaForm.insigniaId = ""; + console.log(store.insigniaTypeOpMain); + const data = store.insigniaTypeOpMain.find( (item: InsigniasType) => item.id == id ); diff --git a/src/modules/04_registryPerson/components/detail/Achievement/04_DeclarationHonor.vue b/src/modules/04_registryPerson/components/detail/Achievement/04_DeclarationHonor.vue index 58150d506..7a5583e19 100644 --- a/src/modules/04_registryPerson/components/detail/Achievement/04_DeclarationHonor.vue +++ b/src/modules/04_registryPerson/components/detail/Achievement/04_DeclarationHonor.vue @@ -190,15 +190,9 @@ const pagination = ref({ }); //Table ประวัติแก้ไข -const rowsHistory = ref([]); -const rowsHistoryMain = ref([]); -const filterHistory = ref(""); const historyId = ref(""); const columnsHistory = ref(baseColumns.value); const visibleColumnsHistory = ref(baseVisibleColumns.value); -const historyPagination = ref({ - sortBy: "lastUpdatedAt", -}); /** fetch รายการข้อมูลประกาศเกียรติคุณ*/ async function fetchData() { @@ -246,7 +240,7 @@ async function addEditData(editStatus: boolean = false) { }; try { await http[method](url, reqBody).then(async (res) => { - if ((fileUpload.value && id.value) || res.data.result) { + if (fileUpload.value) { await uploadProfile(editStatus ? id.value : res.data.result); } }); @@ -601,6 +595,17 @@ onMounted(() => {
+ + ดาวน์โหลด + import { ref, onMounted, reactive } from "vue"; import { useQuasar } from "quasar"; +import axios from "axios"; import { useRoute } from "vue-router"; import { checkPermission } from "@/utils/permissions"; import { useCounterMixin } from "@/stores/mixin"; +import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store"; import http from "@/plugins/http"; import config from "@/app.config"; import type { QTableColumn } from "quasar"; +import type { ResFileData } from "@/modules/04_registryPerson/interface/index/Main"; import type { RequestItemsObject, DisciplineOps, @@ -21,6 +24,8 @@ import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogH const route = useRoute(); const $q = useQuasar(); const mixin = useCounterMixin(); +const { createPathUploadFlie, getPathUploadFlie, uploadFile } = + useRegistryNewDataStore(); const { date2Thai, dialogConfirm, @@ -43,17 +48,6 @@ const isLeave = defineModel("isLeave", { required: true, }); -//ฟอร์มข้อมูลวินัย -const disciplineData = reactive({ - date: null, //วัน/เดือน/ปี - level: "", //ระดับการลงโทษทางวินัย - detail: "", //รายละเอียด - unStigma: "", //ประเภทคำสั่ง - refCommandNo: "", //เลขที่คำสั่ง - profileId: profileId.value, - refCommandDate: null, //เอกสารอ้างอิง (ลงวันที่) -}); - const baseColumns = ref([ { name: "date", @@ -234,6 +228,22 @@ const OpsFilter = ref({ ], }); +//ฟอร์มข้อมูลวินัย +const disciplineData = reactive({ + date: null, //วัน/เดือน/ปี + level: "", //ระดับการลงโทษทางวินัย + detail: "", //รายละเอียด + unStigma: "", //ประเภทคำสั่ง + refCommandNo: "", //เลขที่คำสั่ง + profileId: profileId.value, + refCommandDate: null, //เอกสารอ้างอิง (ลงวันที่) +}); + +const fileGroup = ref("เอกสารวินัย"); +const fileUpload = ref(null); +const fileData = ref(null); +const isUpload = ref(false); + /** * function ค้นหา คำใน option * @param val คำค้นหา @@ -295,16 +305,33 @@ async function fetchData(id: string) { * กดเลือกข้อมูลที่จะแก้ไข * @param props ค่า props ใน row ที่เลือก */ -function openDialogEdit(props: RequestItemsObject) { - modal.value = true; - edit.value = true; - id.value = props.id ? props.id : ""; - disciplineData.date = props.date; - disciplineData.detail = props.detail; - disciplineData.level = props.level; - disciplineData.unStigma = props.unStigma; - disciplineData.refCommandNo = props.refCommandNo; - disciplineData.refCommandDate = props.refCommandDate; +async function openDialogEdit(props: RequestItemsObject) { + showLoader(); + try { + modal.value = true; + edit.value = true; + id.value = props.id ? props.id : ""; + disciplineData.date = props.date; + disciplineData.detail = props.detail; + disciplineData.level = props.level; + disciplineData.unStigma = props.unStigma; + disciplineData.refCommandNo = props.refCommandNo; + disciplineData.refCommandDate = props.refCommandDate; + isUpload.value = props.isUpload ? props.isUpload : false; + + if (isUpload.value) { + const data = await getPathUploadFlie( + fileGroup.value, + profileId.value, + id.value + ); + fileData.value = data; + } + } catch (err) { + messageError($q, err); + } finally { + hideLoader(); + } } /** function ยืนยันการบันทึกข้อมูล*/ @@ -336,7 +363,11 @@ function onSubmit() { }; await method(url, body) - .then(async () => { + .then(async (res) => { + if (fileUpload.value) { + const isId = edit.value ? id.value : res.data.result; + await uploadfile(isId); + } await fetchData(profileId.value); success($q, "บันทึกข้อมูลสำเร็จ"); closeDialog(); @@ -353,6 +384,26 @@ function onSubmit() { ); } +async function uploadfile(id: string) { + try { + const uploadUrl = await createPathUploadFlie( + fileGroup.value, + profileId.value, + id + ); + + await uploadFile(uploadUrl, fileUpload.value); + fileUpload.value = null; + } catch (err) { + messageError($q, err); + } +} + +async function onDownloadFile(id: string) { + const data = await getPathUploadFlie(fileGroup.value, profileId.value, id); + window.open(data.downloadUrl, "_blank"); +} + /** * function ดูประวัติการแ้ไขรายการวินัย * @param idOrder @@ -484,10 +535,11 @@ onMounted(() => { >
+
+ + + + + + + {{ fileData?.fileName }} + +
+ + + +
+
+
+
+
diff --git a/src/modules/04_registryPerson/components/detail/GovernmentInformation/04_PerformSpecialWork.vue b/src/modules/04_registryPerson/components/detail/GovernmentInformation/04_PerformSpecialWork.vue index 2f8f17a77..e20012766 100644 --- a/src/modules/04_registryPerson/components/detail/GovernmentInformation/04_PerformSpecialWork.vue +++ b/src/modules/04_registryPerson/components/detail/GovernmentInformation/04_PerformSpecialWork.vue @@ -348,7 +348,7 @@ async function uploadProfile(id: string) { .post( config.API.subFile( "ทะเบียนประวัติ", - "ประกาศเกียรติคุณ", + "เอกสารปฏิบัติราชการพิเศษ", profileId.value, id ), @@ -418,7 +418,7 @@ async function onDownloadFile(id: string, isLoad: boolean = true) { .get( config.API.subFileByFileName( "ทะเบียนประวัติ", - "ประกาศเกียรติคุณ", + "เอกสารปฏิบัติราชการพิเศษ", profileId.value, id, "เอกสารหลักฐาน" diff --git a/src/modules/04_registryPerson/components/detail/PersonalInformation/06_SpecialSkill.vue b/src/modules/04_registryPerson/components/detail/PersonalInformation/06_SpecialSkill.vue index fac548aee..8a6e74abe 100644 --- a/src/modules/04_registryPerson/components/detail/PersonalInformation/06_SpecialSkill.vue +++ b/src/modules/04_registryPerson/components/detail/PersonalInformation/06_SpecialSkill.vue @@ -193,8 +193,9 @@ function onSubmit() { }; await method(url, body) .then(async (res) => { - if (fileUpload.value && res.data.result) { - await uploadProfile(res.data.result); + if (fileUpload.value) { + const isId = isEdit.value ? editId.value : res.data.result; + await uploadfile(isId); } await fetchData(id.value); success($q, "บันทึกข้อมูลสำเร็จ"); @@ -292,12 +293,12 @@ async function fetchDataHistory() { * ฟังก์ชันส้ราง Path อัปโหลดไฟล์ * @param id */ -async function uploadProfile(id: string) { +async function uploadfile(id: string) { await http .post( config.API.subFile( "ทะเบียนประวัติ", - "ประกาศเกียรติคุณ", + "เอกสารความสามารถพิเศษ", profileId.value, id ), @@ -366,7 +367,7 @@ async function onDownloadFile(id: string, isLoad: boolean = true) { .get( config.API.subFileByFileName( "ทะเบียนประวัติ", - "ประกาศเกียรติคุณ", + "เอกสารความสามารถพิเศษ", profileId.value, id, "เอกสารหลักฐาน" diff --git a/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue b/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue index 2e1b79045..26d051470 100644 --- a/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue +++ b/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue @@ -5,10 +5,12 @@ import { useQuasar } from "quasar"; import { useRoute } from "vue-router"; import { checkPermission } from "@/utils/permissions"; import { useCounterMixin } from "@/stores/mixin"; +import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store"; import http from "@/plugins/http"; import config from "@/app.config"; import type { QTableColumn } from "quasar"; +import type { ResFileData } from "@/modules/04_registryPerson/interface/index/Main"; import type { RowList } from "@/modules/04_registryPerson/interface/index/salary"; import type { RequestNoPaidObject } from "@/modules/04_registryPerson/interface/request/Salary"; @@ -28,6 +30,8 @@ const { onSearchDataTable, convertDateToAPI, } = useCounterMixin(); +const { createPathUploadFlie, getPathUploadFlie, uploadFile } = + useRegistryNewDataStore(); const id = ref(""); const profileId = ref( @@ -162,6 +166,11 @@ const pagination = ref({ const columnsHistory = ref(baseColumns.value); const visibleColumnsHistory = ref(baseVisibleColumns.value); +const fileGroup = ref("เอกสารบันทึกวันที่ไม่ได้รับเงินเดือน"); +const fileUpload = ref(null); +const fileData = ref(null); +const isUpload = ref(false); + /** funciton ยืนยันการบันทึกข้อมูล*/ function onSubmit() { dialogConfirm($q, async () => { @@ -187,7 +196,11 @@ function onSubmit() { ? profileId.value : undefined, }) - .then(async () => { + .then(async (res) => { + if (fileUpload.value) { + const isId = isStatusEdit.value ? id.value : res.data.result; + await uploadfile(isId); + } await getData(); success($q, "บันทึกข้อมูลสำเร็จ"); onClickCloseDialog(); @@ -201,12 +214,27 @@ function onSubmit() { }); } +async function uploadfile(id: string) { + try { + const uploadUrl = await createPathUploadFlie( + fileGroup.value, + profileId.value, + id + ); + + await uploadFile(uploadUrl, fileUpload.value); + fileUpload.value = null; + } catch (err) { + messageError($q, err); + } +} + /** * function เปิด Didalig บันทึกวันที่ไม่ได้รับเงินเดือนฯ * @param StatusEdit แก้ไข , เพิ่ม * @param data ข้อมูล */ -function onClickOpenDialog( +async function onClickOpenDialog( StatusEdit: boolean = false, data: RowList = {} as RowList ) { @@ -217,7 +245,16 @@ function onClickOpenDialog( formData.detail = StatusEdit ? data.detail : ""; formData.refCommandNo = StatusEdit ? data.refCommandNo : ""; formData.refCommandDate = StatusEdit ? data.refCommandDate : null; + isUpload.value = data.isUpload; modalDialog.value = true; + if (isUpload.value) { + const data = await getPathUploadFlie( + fileGroup.value, + profileId.value, + id.value + ); + fileData.value = data; + } } /** function ปิด Didalig บันทึกวันที่ไม่ได้รับเงินเดือนฯ*/ @@ -226,6 +263,11 @@ function onClickCloseDialog() { isStatusEdit.value = false; } +async function onDownloadFile(id: string) { + const data = await getPathUploadFlie(fileGroup.value, profileId.value, id); + window.open(data.downloadUrl, "_blank"); +} + /** function fetch รายการบันทึกวันที่ไม่ได้รับเงินเดือนฯ*/ async function getData() { showLoader(); @@ -277,6 +319,7 @@ onMounted(() => { getData(); }); + + +
+ + + + + + + {{ fileData?.fileName }} + +
+ + + +
+
+
+
+
diff --git a/src/modules/04_registryPerson/interface/index/discipline.ts b/src/modules/04_registryPerson/interface/index/discipline.ts index 411acce15..5de9e6e28 100644 --- a/src/modules/04_registryPerson/interface/index/discipline.ts +++ b/src/modules/04_registryPerson/interface/index/discipline.ts @@ -7,6 +7,7 @@ interface RequestItemsObject { refCommandNo: string; refCommandDate: Date | null; date: Date | null; + isUpload?: boolean; } interface FormFilter { diff --git a/src/modules/04_registryPerson/interface/index/salary.ts b/src/modules/04_registryPerson/interface/index/salary.ts index 4c9c7bb09..6b8652479 100644 --- a/src/modules/04_registryPerson/interface/index/salary.ts +++ b/src/modules/04_registryPerson/interface/index/salary.ts @@ -5,6 +5,7 @@ interface RowList { detail: string; refCommandNo: string; refCommandDate: Date | null; + isUpload: boolean; } interface ObjectSalaryRef { diff --git a/src/modules/04_registryPerson/interface/response/ProfesLicense.ts b/src/modules/04_registryPerson/interface/response/ProfesLicense.ts index 2991ad767..8fdb99649 100644 --- a/src/modules/04_registryPerson/interface/response/ProfesLicense.ts +++ b/src/modules/04_registryPerson/interface/response/ProfesLicense.ts @@ -7,6 +7,7 @@ interface ResponseObject { issueDate: Date | null; isActive: boolean; expireDate: Date | null; + isUpload?: boolean; } export type { ResponseObject }; diff --git a/src/modules/04_registryPerson/store.ts b/src/modules/04_registryPerson/store.ts index 19784c625..41419b903 100644 --- a/src/modules/04_registryPerson/store.ts +++ b/src/modules/04_registryPerson/store.ts @@ -1,5 +1,11 @@ import { defineStore } from "pinia"; import { ref, reactive, computed } from "vue"; +import { useQuasar } from "quasar"; +import axios from "axios"; + +import http from "@/plugins/http"; +import config from "@/app.config"; +import { useCounterMixin } from "@/stores/mixin"; import { useRoute } from "vue-router"; import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main"; @@ -9,6 +15,9 @@ import type { } from "@/modules/04_registryPerson/interface/response/Main"; import type { FormFilter } from "@/modules/04_registryPerson/interface/request/Main"; +const $q = useQuasar(); +const { messageError } = useCounterMixin(); + export const useRegistryNewDataStore = defineStore("registryNew", () => { const route = useRoute(); const routerName = ref(); @@ -151,6 +160,82 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => { { id: "ASC", name: "เรียงตามวันที่บรรจุแต่งตั้ง (เก่า-ล่าสุด)" }, ]); + /** + * ฟังก์ชันสร้าง Path อัพโหลดไฟล์ + * @param group กลุ่มไฟล์ + * @param profileId id + * @param id subId + * @returns Path อัพโหลดไฟล์ + */ + async function createPathUploadFlie( + group: string, + profileId: string, + id: string + ) { + try { + const res = await http.post( + config.API.subFile("ทะเบียนประวัติ", group, profileId, id), + { + replace: true, + fileList: [ + { + fileName: "เอกสารหลักฐาน", + }, + ], + } + ); + + return res.data["เอกสารหลักฐาน"].uploadUrl; + } catch (err) { + messageError($q, err); + } + } + + /** + * ฟังก์ชันเรียก Path อัพโหลดไฟล์ + * @param group กลุ่มไฟล์ + * @param profileId id + * @param id subId + * @returns ข้อมูลไฟล์ + */ + async function getPathUploadFlie( + group: string, + profileId: string, + id: string + ) { + try { + const res = await http.get( + config.API.subFileByFileName( + "ทะเบียนประวัติ", + group, + profileId, + id, + "เอกสารหลักฐาน" + ) + ); + return res.data; + } catch (err) { + messageError($q, err); + } + } + + /** + * ฟังก์ชันอัพโหลดไฟล์ + * @param uploadUrl Path อัพโหลดไฟล์ + * @param file ไฟล์ + */ + async function uploadFile(uploadUrl: string, file: any) { + try { + await axios.put(uploadUrl, file, { + headers: { + "Content-Type": file.type, + }, + }); + } catch (err) { + messageError($q, err); + } + } + return { fetchType, fetchLevel, @@ -172,5 +257,8 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => { citizenId, displayOrderOps, routerName, + createPathUploadFlie, + getPathUploadFlie, + uploadFile, }; }); From 2f6b495d4344412986758a869ebe4d565ee78e53 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 18 Mar 2025 17:06:21 +0700 Subject: [PATCH 2/4] update isupload --- .../Achievement/01_ProfessionalLicense.vue | 46 ++++++++++++++++--- .../GovernmentInformation/02_Discipline.vue | 27 ++++++++++- .../detail/Salary/02_NotReceiveSalary.vue | 20 +++++++- 3 files changed, 84 insertions(+), 9 deletions(-) diff --git a/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue b/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue index cd6686ccc..8fc8a1551 100644 --- a/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue +++ b/src/modules/04_registryPerson/components/detail/Achievement/01_ProfessionalLicense.vue @@ -141,7 +141,6 @@ const baseVisibleColumns = ref([ "lastUpdateFullName", "lastUpdatedAt", ]); - const rows = ref([]); //รายการใบอนุญาตประกอบวิชาชีพ const rowsMain = ref([]); //รายการใบอนุญาตประกอบวิชาชีพ const keyword = ref(""); //คำค้นหา @@ -154,7 +153,6 @@ const visibleColumns = ref( const pagination = ref({ sortBy: "lastUpdatedAt", }); - //Table ประวัติแก้ไขใบอนุญาตประกอบวิชาชีพ const historyId = ref(""); const columnsHistory = ref(baseColumns.value); @@ -169,10 +167,10 @@ const profesLicenseData = reactive({ profileId: id.value, }); -const fileGroup = ref("เอกสารใบอนุญาตประกอบวิชาชีพ"); -const fileUpload = ref(null); -const fileData = ref(null); -const isUpload = ref(false); +const fileGroup = ref("เอกสารใบอนุญาตประกอบวิชาชีพ"); //กลุ่มไฟล์ +const fileUpload = ref(null); //ไฟล์อัพโหล +const fileData = ref(null); //ข้อมูลไฟล์ +const isUpload = ref(false); //สถานะการอัพโหล /** ยืนยันการบันทึกข้อมูล*/ function onSubmit() { @@ -193,6 +191,7 @@ function onSubmit() { ...profesLicenseData, issueDate: convertDateToAPI(profesLicenseData.issueDate), expireDate: convertDateToAPI(profesLicenseData.expireDate), + isUpload: !isEdit ? undefined : isUpload.value, profileId: isEdit ? undefined : empType.value === "" @@ -209,6 +208,7 @@ function onSubmit() { const isId = isEdit ? editId.value : res.data.result; await uploadfile(isId); } + await fetchData(id.value); success($q, "บันทึกข้อมูลสำเร็จ"); closeDialog(); @@ -225,21 +225,44 @@ function onSubmit() { ); } +/** + * ฟังก์ชันอัพโหลไฟล์ + * @param subId id รายการที่อัพโหลไฟล์ + */ async function uploadfile(subId: string) { try { + //สร้าง Path url อัพโหลด const uploadUrl = await createPathUploadFlie( fileGroup.value, id.value, subId ); + //อัพโหลไฟล์ await uploadFile(uploadUrl, fileUpload.value); - fileUpload.value = null; + await updateIsUpload(); } catch (err) { messageError($q, err); } } +/** ฟังก์ชันอัพเดทสถานะอัพโหลด*/ +async function updateIsUpload() { + await http + .patch( + config.API.profileNewCertificateByCertificateId( + editId.value, + empType.value + ), + { + isUpload: fileUpload.value ? true : false, + } + ) + .then(() => { + fileUpload.value = null; + }); +} + /** fetch ข้อมูลรายการใบอนุญาตประกอบวิชาชีพ*/ async function fetchData(id: string) { showLoader(); @@ -295,6 +318,10 @@ async function editForm(row: ResponseObject) { } } +/** + * ฟังก์ชันดูประวัติการแก้ไขข้อมูล + * @param id รายการที่ต้องการดูประวัติการแก้ไข + */ function onViewHistory(id: string) { historyId.value = id; historyDialog.value = true; @@ -318,11 +345,16 @@ async function fetchDataHistory() { } } +/** + * ฟังก์ชันโหลดไฟล์ + * @param subId id รายการที่ต้องการโหลดไฟล์ + */ async function onDownloadFile(subId: string) { const data = await getPathUploadFlie(fileGroup.value, id.value, subId); window.open(data.downloadUrl, "_blank"); } +/** ฟังก์ชันค้นหาข้อมูลในตาราง*/ function serchDataTable() { rows.value = onSearchDataTable( keyword.value, diff --git a/src/modules/04_registryPerson/components/detail/GovernmentInformation/02_Discipline.vue b/src/modules/04_registryPerson/components/detail/GovernmentInformation/02_Discipline.vue index ee7050cf3..b754ac899 100644 --- a/src/modules/04_registryPerson/components/detail/GovernmentInformation/02_Discipline.vue +++ b/src/modules/04_registryPerson/components/detail/GovernmentInformation/02_Discipline.vue @@ -350,6 +350,7 @@ function onSubmit() { ...disciplineData, date: convertDateToAPI(disciplineData.date), refCommandDate: convertDateToAPI(disciplineData.refCommandDate), + isUpload: !edit.value ? undefined : isUpload.value, profileId: edit.value ? undefined : empType.value === "" @@ -384,21 +385,45 @@ function onSubmit() { ); } +/** + * ฟังก์ชันอัพโหลไฟล์ + * @param id id รายการที่อัพโหลไฟล์ + */ async function uploadfile(id: string) { try { + //สร้าง Path url อัพโหลด const uploadUrl = await createPathUploadFlie( fileGroup.value, profileId.value, id ); + //อัพโหลไฟล์ await uploadFile(uploadUrl, fileUpload.value); - fileUpload.value = null; + await updateIsUpload(); } catch (err) { messageError($q, err); } } +/** ฟังก์ชันอัพเดทสถานะอัพโหลด*/ +async function updateIsUpload() { + await http + .patch( + config.API.profileNewDisciplineByDisciplineId(id.value, empType.value), + { + isUpload: fileUpload.value ? true : false, + } + ) + .then(() => { + fileUpload.value = null; + }); +} + +/** + * ฟังก์ชันโหลดไฟล์ + * @param id id รายการที่ต้องการโหลดไฟล์ + */ async function onDownloadFile(id: string) { const data = await getPathUploadFlie(fileGroup.value, profileId.value, id); window.open(data.downloadUrl, "_blank"); diff --git a/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue b/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue index 26d051470..51ecd7408 100644 --- a/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue +++ b/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue @@ -185,6 +185,7 @@ function onSubmit() { ...formData, date: convertDateToAPI(formData.date), refCommandDate: convertDateToAPI(formData.refCommandDate), + isUpload: !isStatusEdit.value ? undefined : isUpload.value, profileId: isStatusEdit.value ? undefined : empType.value === "" @@ -214,21 +215,38 @@ function onSubmit() { }); } +/** + * ฟังก์ชันอัพโหลไฟล์ + * @param id id รายการที่อัพโหลไฟล์ + */ async function uploadfile(id: string) { try { + //สร้าง Path url อัพโหลด const uploadUrl = await createPathUploadFlie( fileGroup.value, profileId.value, id ); + //อัพโหลไฟล์ await uploadFile(uploadUrl, fileUpload.value); - fileUpload.value = null; + await updateIsUpload(); } catch (err) { messageError($q, err); } } +/** ฟังก์ชันอัพเดทสถานะอัพโหลด*/ +async function updateIsUpload() { + await http + .patch(config.API.profileNewNoPaidById(id.value, empType.value), { + isUpload: fileUpload.value ? true : false, + }) + .then(() => { + fileUpload.value = null; + }); +} + /** * function เปิด Didalig บันทึกวันที่ไม่ได้รับเงินเดือนฯ * @param StatusEdit แก้ไข , เพิ่ม From b0c67c3f01d58d52f3e3e648fc2b73c8711a1d93 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 19 Mar 2025 09:45:48 +0700 Subject: [PATCH 3/4] =?UTF-8?q?fix=20=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A?= =?UTF-8?q?=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7?= =?UTF-8?q?=E0=B8=B1=E0=B8=95=E0=B8=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/detail/GovernmentInformation/07_Position.vue | 2 +- .../components/detail/Salary/01_PositionSalary.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue b/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue index ad14fd5c2..361e419b1 100644 --- a/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue +++ b/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue @@ -151,7 +151,7 @@ const baseColumns = ref([ { name: "amount", align: "left", - label: empType.value === "-employee" ? "ค่าตอบแทนรายเดือน" : "เงินเดือน", + label: empType.value === "-employee" ? "ค่าจ้าง" : "เงินเดือน", sortable: true, field: "amount", headerStyle: "font-size: 14px", diff --git a/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue b/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue index 856a8ff13..d9c170eed 100644 --- a/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue +++ b/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue @@ -156,7 +156,7 @@ const baseColumns = ref([ { name: "amount", align: "left", - label: empType.value === "-employee" ? "ค่าตอบแทนรายเดือน" : "เงินเดือน", + label: empType.value === "-employee" ? "ค่าจ้าง" : "เงินเดือน", sortable: true, field: "amount", headerStyle: "font-size: 14px", From 9f6c33ee54e590fed99d6b48b3f685cb09b83c75 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 19 Mar 2025 10:09:09 +0700 Subject: [PATCH 4/4] =?UTF-8?q?fix=20=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A?= =?UTF-8?q?=E0=B8=B5=E0=B8=A2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/GovernmentInformation/07_Position.vue | 7 ++----- .../components/detail/Salary/01_PositionSalary.vue | 8 +++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue b/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue index 361e419b1..d6befdc8e 100644 --- a/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue +++ b/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue @@ -178,7 +178,7 @@ const baseColumns = ref([ field: "commandNo", format(val, row) { return row.commandNo && row.commandYear - ? `${row.commandNo}/${row.commandYear}` + ? `${row.commandNo}/${Number(row.commandYear) + 543}` : ""; }, headerStyle: "font-size: 14px", @@ -929,7 +929,7 @@ onMounted(async () => { :class="props.row.isEntry ? 'text-red' : ''" >
ดูคำสั่ง
-
- - -
{{ col.value ? col.value : "-" }} diff --git a/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue b/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue index d9c170eed..c8cd9b208 100644 --- a/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue +++ b/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue @@ -211,7 +211,7 @@ const baseColumns = ref([ field: "commandNo", format(val, row) { return row.commandNo && row.commandYear - ? `${row.commandNo}/${row.commandYear}` + ? `${row.commandNo}/${Number(row.commandYear) + 543}` : ""; }, headerStyle: "font-size: 14px", @@ -897,7 +897,7 @@ onMounted(async () => { :class="props.row.isEntry ? 'text-red' : ''" >
ดูคำสั่ง
-
- - -
+
{{ col.value ? col.value : "-" }}