From 7141e7df02cbe227f8cd2ed234221d45110dee88 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Tue, 8 Jul 2025 14:02:18 +0700 Subject: [PATCH 1/2] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=82?= =?UTF-8?q?=E0=B9=89=E0=B8=AD=E0=B8=84=E0=B8=A7=E0=B8=B2=E0=B8=A1=20web=20?= =?UTF-8?q?socket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/socket.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/socket.ts b/src/stores/socket.ts index 74688fb57..0b5ae15a6 100644 --- a/src/stores/socket.ts +++ b/src/stores/socket.ts @@ -90,7 +90,7 @@ export const useSocketStore = defineStore("socket", () => { fnStyleNotiOrg(); Notify.create({ message: `${message} ${ - type == "draft" ? "ไปยังแบบร่าง" : "ไปยังปัจจุบัน" + type == "draft" ? "ไปยังโครงสร้างแบบร่าง" : "ไปยังโครงสร้างปัจจุบัน" }`, html: true, group: false, From 6a57f6db212c9df9c0ada21b81a2775704f05561 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 8 Jul 2025 16:18:42 +0700 Subject: [PATCH 2/2] =?UTF-8?q?fix=20bug=20and=20load=20=3D=3D=3D>=20?= =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B9=80?= =?UTF-8?q?=E0=B8=A5=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=99=E0=B8=84=E0=B9=88?= =?UTF-8?q?=E0=B8=B2=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=A5=E0=B8=B9?= =?UTF-8?q?=E0=B8=81=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=9B=E0=B8=A3?= =?UTF-8?q?=E0=B8=B0=E0=B8=88=E0=B8=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DialogAddPerson.vue | 36 +++----- .../05_salaryListsEmployee/TabMain.vue | 89 +++++++++++-------- 2 files changed, 66 insertions(+), 59 deletions(-) diff --git a/src/modules/13_salary/components/05_salaryListsEmployee/DialogAddPerson.vue b/src/modules/13_salary/components/05_salaryListsEmployee/DialogAddPerson.vue index e4dd670f0..06a23912f 100644 --- a/src/modules/13_salary/components/05_salaryListsEmployee/DialogAddPerson.vue +++ b/src/modules/13_salary/components/05_salaryListsEmployee/DialogAddPerson.vue @@ -17,7 +17,7 @@ import type { DataPerson } from "@/modules/13_salary/interface/response/SalaryLi /** importComponents*/ import Header from "@/components/DialogHeader.vue"; -/** use*/ +/** use composables */ const $q = useQuasar(); const store = useSalaryEmployeeListSDataStore(); const { messageError, showLoader, hideLoader, dialogConfirm, success } = @@ -102,7 +102,9 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", format(val, row) { - return `${row.posTypeShort}${row.posLevel}`; + return `${row.posTypeShort ? row.posTypeShort : ""}${ + row.posLevel ? row.posLevel : "" + }`; }, }, ]); @@ -117,18 +119,14 @@ const formFilter = reactive({ }); const maxPage = ref(1); -/** - * function close popup - */ +/** function close popup*/ function closeModal() { modal.value = false; formFilter.page = 1; formFilter.keyword = ""; } -/** - * function เรียกรายชื่อ คนเลื่อนเงินเดือน - */ +/** function เรียกรายชื่อ คนเลื่อนเงินเดือน*/ async function fetchListPerson() { showLoader(); formFilter.rootId = store.rootId; @@ -157,10 +155,12 @@ async function fetchListPerson() { */ function onClickAddPerson(data: DataPerson) { data.rank = undefined; + const body: DataPersonReq = { id: store.groupId, type: store.tabType, ...data, + position: data.position ? data.position : "", }; dialogConfirm( @@ -186,32 +186,24 @@ function onClickAddPerson(data: DataPerson) { ); } -/** - * function updatePage - */ +/** function update Pagination*/ async function updatePagePagination() { fetchListPerson(); } -/** - * function updatePageSize - */ +/** function updatePageSize*/ function updatePageSizePagination(newPagination: NewPagination) { formFilter.page = 1; formFilter.pageSize = newPagination.rowsPerPage; } -/** - * function ค้นหาข้อมูลตาม keyword - */ +/** function ค้นหาข้อมูลตาม keyword*/ function searchData() { formFilter.page = 1; fetchListPerson(); } -/** - * callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปิด Popup - */ +/** callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปิด Popup */ watch( () => modal.value, () => { @@ -221,9 +213,7 @@ watch( } ); -/** - * callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปลี่ยน PageSize - */ +/** callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปลี่ยน PageSize*/ watch( () => formFilter.pageSize, () => { diff --git a/src/modules/13_salary/components/05_salaryListsEmployee/TabMain.vue b/src/modules/13_salary/components/05_salaryListsEmployee/TabMain.vue index e94d7b1fa..e9107eb53 100644 --- a/src/modules/13_salary/components/05_salaryListsEmployee/TabMain.vue +++ b/src/modules/13_salary/components/05_salaryListsEmployee/TabMain.vue @@ -23,7 +23,7 @@ import DialogInfoCriteria from "@/modules/13_salary/components/05_salaryListsEmp import { useCounterMixin } from "@/stores/mixin"; import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore"; -/** use*/ +/** use composables */ const $q = useQuasar(); const store = useSalaryEmployeeListSDataStore(); const { messageError, showLoader, hideLoader } = useCounterMixin(); @@ -212,11 +212,11 @@ const formFilter = reactive({ }); /** - * function เรียกข้อมูลจำนวนโควต้า + * ฟังก์ชันเรียกข้อมูลโควต้า * @param id กลุ่ม */ -function fetchDataQuota(id: string) { - http +async function fetchDataQuota(id: string) { + await http .get(config.API.salaryListPeriodQuotaEmp(id)) .then((res) => { const data = res.data.result; @@ -243,11 +243,10 @@ function fetchDataQuota(id: string) { } /** - * function เรียกข้อมูลรายชื่อ + * ฟังก์ชันเรียกข้อมูลรายชื่อ * @param id กลุ่ม */ async function fetchDataPeriod(id: string) { - showLoader(); let formData = { page: formFilter.page.toString(), pageSize: formFilter.pageSize.toString(), @@ -271,35 +270,45 @@ async function fetchDataPeriod(id: string) { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - setTimeout(() => { - hideLoader(); - }, 1000); }); } -/** - * function เปลี่ยนขั้น - */ -function changeTabType() { - formFilter.page = 1; - formFilter.pageSize = 10; - formFilter.keyword = ""; - store.groupId && fetchDataPeriod(store.groupId); +/** ฟังก์ชันเปลี่ยนขั้น*/ +async function changeTabType() { + if (!store.groupId) return; + + showLoader(); + try { + formFilter.page = 1; + formFilter.pageSize = 10; + formFilter.keyword = ""; + await fetchDataPeriod(store.groupId); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); + } +} + +/** ฟังก์ชันเรียกข้อมูลรายชื่ออีกครั้งและโควต้า */ +async function fetchDataPeriodNew() { + if (!store.groupId) return; + showLoader(); + try { + await Promise.all([ + fetchDataPeriod(store.groupId), + fetchDataQuota(store.groupId), + ]); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); + } } /** - * function เรียกข้อมูลรายชื่ออีกครั้ง - */ -function fetchDataPeriodNew() { - store.groupId && fetchDataPeriod(store.groupId); - store.groupId && fetchDataQuota(store.groupId); -} - -/** - * function โหลดไฟล์ - * @param data ข้อมูลที่ต้องการโหล + * ฟังก์ชันโหลดไฟล์ + * @param data ข้อมูลที่ต้องการโหลด * @param type ประเภทไฟล์ docx,xlsx */ async function onClickDownload(data: DataOption, type: string = "xlsx") { @@ -359,19 +368,27 @@ async function onClickDownload(data: DataOption, type: string = "xlsx") { } } -/** - * funrion แสดงเฉพาะผู้เกษียณอายุราชการ - */ +/** funrion แสดงเฉพาะผู้เกษียณอายุราชการ*/ function updateIsShowRetire() { isRetire.value = !isRetire.value; fetchDataPeriodNew(); } -onMounted(() => { +/** ฟังก์ชันเรียกข้อมูลเมื่อ component ถูกเรียก */ +onMounted(async () => { if (props.rootId) { - fetchDataQuota(store.groupId); - fetchDataPeriod(store.groupId); - splitterModel.value = store.roundMainCode === "APR" ? 13 : 16; + showLoader(); + try { + await Promise.all([ + fetchDataQuota(store.groupId), + fetchDataPeriod(store.groupId), + (splitterModel.value = store.roundMainCode === "APR" ? 13 : 16), + ]); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); + } } });