From 019b43b450621587a3bf52a83c452c84271aa53d Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 20 May 2026 18:09:13 +0700 Subject: [PATCH 1/2] feat(registry-edit): add function SortDataByDate --- .../views/edit/components/Table.vue | 89 ++++++------------- 1 file changed, 28 insertions(+), 61 deletions(-) diff --git a/src/modules/04_registryPerson/views/edit/components/Table.vue b/src/modules/04_registryPerson/views/edit/components/Table.vue index f470254c6..cef3e5e81 100644 --- a/src/modules/04_registryPerson/views/edit/components/Table.vue +++ b/src/modules/04_registryPerson/views/edit/components/Table.vue @@ -437,66 +437,6 @@ function classColorRow(isDelete: boolean, isEdit: boolean, isEntry: boolean) { /** ฟังก์ชันดาวน์โหลดไฟล Excel */ function exportToExcel() { exportToExcelPosition(rows.value); - // const newData = rows.value.map((e: DataPosition) => { - // return { - // commandDateAffect: date2Thai(e.commandDateAffect), - // positionName: e.positionName, - // positionType: e.positionType, - // positionLevel: e.positionLevel - // ? e.positionLevel - // : e.positionCee - // ? e.positionCee - // : "", - // positionExecutive: e.positionExecutive, - // amount: e.amount, - // mouthSalaryAmount: e.mouthSalaryAmount, - // positionSalaryAmount: e.positionSalaryAmount, - // organization: findOrgName({ - // root: e.orgRoot, - // child1: e.orgChild1, - // child2: e.orgChild2, - // child3: e.orgChild3, - // child4: e.orgChild4, - // }), - // posNo: - // e.posNoAbb && e.posNo - // ? `${e.posNoAbb} ${e.posNo}` - // : e.posNo - // ? e.posNo - // : "", - // posNumCodeSit: - // e.posNumCodeSitAbb && e.posNumCodeSit - // ? `${e.posNumCodeSit} (${e.posNumCodeSitAbb})` - // : e.posNumCodeSit - // ? e.posNumCodeSit - // : "", - // commandNo: - // e.commandNo && e.commandYear - // ? `${e.commandNo}/${Number(e.commandYear) + 543}` - // : "", - // commandDateSign: date2Thai(e.commandDateSign), - // commandCode: store.convertCommandCodeName(e.commandCode), - // remark: e.remark, - // }; - // }); - - // const headers = columns.value.map((item: any) => item.label) || []; // หัวคอลัมน์ภาษาไทย - // const worksheet = XLSX.utils.json_to_sheet(newData, { - // header: visibleColumns.value, - // }); - - // //แทรกหัวคอลัมน์ภาษาไทย (ใช้ A1, B1, C1 แทน) - // XLSX.utils.sheet_add_aoa(worksheet, [headers], { origin: "A1" }); - - // // Create a new workbook and append the worksheet - // const workbook = XLSX.utils.book_new(); - - // XLSX.utils.book_append_sheet( - // workbook, - // worksheet, - // `รายการประวัติตำแหน่งเงินเดือน` - // ); - // XLSX.writeFile(workbook, "รายการประวัติตำแหน่งเงินเดือน.xlsx"); } const commandCodeOptions = ref(store.commandCodeData); //รายการปรเภทคำสั่ง @@ -931,6 +871,18 @@ function onCancelUpload() { excelPreviewModal.value = false; } +async function handleSortByDate() { + try { + showLoader(); + // http.get(config.API.SortByDate) + await fetchData() + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); + } +} + onMounted(async () => { await Promise.all([fetchData(), fetchType()]); }); @@ -966,8 +918,23 @@ onMounted(async () => { icon="mdi-sort" @click="modalSort = true" > - จัดลำดับข้อมูลจัดลำดับข้อมูล + + + + เรียงลำดับข้อมูล +
Date: Fri, 22 May 2026 14:03:41 +0700 Subject: [PATCH 2/2] feat(registry-edit): implement API sortOrderByDate --- src/api/02_organizational/api.organization.ts | 1 + .../views/edit/components/Table.vue | 31 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index b30ec3ec1..d370d9b29 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -194,6 +194,7 @@ export default { `${orgProfile}${type}/profileid/position`, uploadProfile: (type: string, id: string) => `${organization}/upload/${type}-profileSalaryTemp/${id}`, + sortOrderByDate: `${orgProfile}/salaryTemp/sort-order`, workflowCommanderOperate: `${workflow}/commander/operate`, workflowCommanderSign: `${workflow}/commander/sign`, diff --git a/src/modules/04_registryPerson/views/edit/components/Table.vue b/src/modules/04_registryPerson/views/edit/components/Table.vue index cef3e5e81..b85f00bb9 100644 --- a/src/modules/04_registryPerson/views/edit/components/Table.vue +++ b/src/modules/04_registryPerson/views/edit/components/Table.vue @@ -871,16 +871,27 @@ function onCancelUpload() { excelPreviewModal.value = false; } -async function handleSortByDate() { - try { - showLoader(); - // http.get(config.API.SortByDate) - await fetchData() - } catch (error) { - messageError($q, error); - } finally { - hideLoader(); - } +/** ฟังก์ชันจัดเรียงข้อมูลตามวันที่*/ +function handleSortByDate() { + dialogConfirm( + $q, + async () => { + try { + showLoader(); + await http.put(config.API.sortOrderByDate, { + type: empType.value.toLocaleUpperCase(), + profileId: profileId.value, + }); + await fetchData(); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); + } + }, + "ยืนยันการเรียงลำดับข้อมูล", + "ต้องการยืนยันการเรียงลำดับข้อมูลนี้ใช่หรือไม่?" + ); } onMounted(async () => {