From a7d629da8662ff7f71ae5fdb3a3afb142260b17a Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 13 Mar 2025 10:18:43 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9A=E0=B8=B1=E0=B8=99=E0=B8=97=E0=B8=B6?= =?UTF-8?q?=E0=B8=81=E0=B8=A7=E0=B8=B1=E0=B8=99=E0=B8=97=E0=B8=B5=E0=B9=88?= =?UTF-8?q?=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B9=84=E0=B8=94=E0=B9=89=E0=B8=A3?= =?UTF-8?q?=E0=B8=B1=E0=B8=9A=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B8=94?= =?UTF-8?q?=E0=B8=B7=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/Salary/01_PositionSalary.vue | 11 +- .../detail/Salary/02_NotReceiveSalary.vue | 157 ++++++----- .../Salary/02_NotReceiveSalaryHistory.vue | 246 ------------------ 3 files changed, 101 insertions(+), 313 deletions(-) delete mode 100644 src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalaryHistory.vue 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 06bb7eea1..b46d3a6de 100644 --- a/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue +++ b/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue @@ -7,6 +7,9 @@ import { useRoute } from "vue-router"; import http from "@/plugins/http"; import config from "@/app.config"; +import { useCounterMixin } from "@/stores/mixin"; +import { useSalaryDataStore } from "@/modules/04_registryPerson/stores/salary"; + import type { QTableColumn } from "quasar"; import type { DataPositions, @@ -22,11 +25,6 @@ import type { ResListSalary } from "@/modules/04_registryPerson/interface/respon import DialogHeader from "@/components/DialogHeader.vue"; import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogHistory.vue"; - -// import DialogHistory from "@/modules/04_registryPerson/components/detail/Salary/01_PositionSalaryHistory.vue"; - -import { useCounterMixin } from "@/stores/mixin"; -import { useSalaryDataStore } from "@/modules/04_registryPerson/stores/salary"; import DialogPreviewCommand from "@/modules/18_command/components/DialogPreviewCommand.vue"; const { findOrgName } = useCounterMixin(); @@ -341,7 +339,8 @@ const columns = computed(() => { } } return baseColumns.value.filter( - (e: any) => e.name !== "lastUpdateFullName" && e.name !== "lastUpdatedAd" + (e: QTableColumn) => + e.name !== "lastUpdateFullName" && e.name !== "lastUpdatedAd" ); }); const visibleColumns = ref( 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 6f4ec108d..2e1b79045 100644 --- a/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue +++ b/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue @@ -8,12 +8,12 @@ import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; -import type { QTableProps } from "quasar"; +import type { QTableColumn } from "quasar"; import type { RowList } from "@/modules/04_registryPerson/interface/index/salary"; import type { RequestNoPaidObject } from "@/modules/04_registryPerson/interface/request/Salary"; import DialogHeader from "@/components/DialogHeader.vue"; -import DialogHisotory from "@/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalaryHistory.vue"; +import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogHistory.vue"; const $q = useQuasar(); const route = useRoute(); @@ -26,6 +26,7 @@ const { success, pathRegistryEmp, onSearchDataTable, + convertDateToAPI, } = useCounterMixin(); const id = ref(""); @@ -52,11 +53,7 @@ const formData = reactive({ refCommandDate: null, //'เอกสารอ้างอิง (ลงวันที่)' }); -//Table -const rows = ref([]); //รายการ -const rowsMain = ref([]); //รายการ -const keyword = ref(""); //คำค้นหา -const columns = ref([ +const baseColumns = ref([ { name: "date", align: "left", @@ -102,7 +99,6 @@ const columns = ref([ sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, - { name: "refCommandDate", align: "left", @@ -116,34 +112,92 @@ const columns = ref([ a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { - name: "lastUpdatedAt", + name: "lastUpdateFullName", align: "left", - label: "วันที่แก้ไข", + label: "ผู้ดำเนินการ", sortable: true, - field: "lastUpdatedAt", - format: (v) => date2Thai(v, false, true), + field: "lastUpdateFullName", headerStyle: "font-size: 14px", style: "font-size: 14px", sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, + { + name: "lastUpdatedAt", + align: "left", + label: "วันที่แก้ไข", + sortable: true, + field: "lastUpdatedAt", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + format: (v) => date2Thai(v, false, true), + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + }, ]); -const visibleColumns = ref([ +const baseVisibleColumns = ref([ "date", - "detail", "reference", + "detail", "refCommandNo", "refCommandDate", + "lastUpdateFullName", "lastUpdatedAt", ]); + +//Table +const rows = ref([]); //รายการ +const rowsMain = ref([]); //รายการ +const keyword = ref(""); //คำค้นหา +const columns = ref( + baseColumns.value.filter((e: QTableColumn) => e.name !== "lastUpdateFullName") +); +const visibleColumns = ref( + baseVisibleColumns.value.filter((e: string) => e !== "lastUpdateFullName") +); const pagination = ref({ sortBy: "lastUpdatedAt", }); +const columnsHistory = ref(baseColumns.value); +const visibleColumnsHistory = ref(baseVisibleColumns.value); + /** funciton ยืนยันการบันทึกข้อมูล*/ function onSubmit() { - dialogConfirm($q, () => { - isStatusEdit.value ? editData() : saveData(); + dialogConfirm($q, async () => { + showLoader(); + const url = isStatusEdit.value + ? config.API.profileNewNoPaidById(id.value, empType.value) + : config.API.profileNewNoPaid(empType.value); + + const methods = isStatusEdit.value ? http.patch : http.post; + + await methods(url, { + ...formData, + date: convertDateToAPI(formData.date), + refCommandDate: convertDateToAPI(formData.refCommandDate), + profileId: isStatusEdit.value + ? undefined + : empType.value === "" + ? profileId.value + : undefined, + profileEmployeeId: isStatusEdit.value + ? undefined + : empType.value !== "" + ? profileId.value + : undefined, + }) + .then(async () => { + await getData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + onClickCloseDialog(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); }); } @@ -152,7 +206,10 @@ function onSubmit() { * @param StatusEdit แก้ไข , เพิ่ม * @param data ข้อมูล */ -function onClickOpenDialog(StatusEdit: boolean = false, data: any = []) { +function onClickOpenDialog( + StatusEdit: boolean = false, + data: RowList = {} as RowList +) { isStatusEdit.value = StatusEdit; id.value = StatusEdit ? data.id : ""; formData.date = StatusEdit ? data.date : null; @@ -186,55 +243,27 @@ async function getData() { }); } -/** function เพิ่มข้อมูลรายการบันทึกวันที่ไม่ได้รับเงินเดือนฯ*/ -function saveData() { - showLoader(); - http - .post(config.API.profileNewNoPaid(empType.value), { - ...formData, - profileId: empType.value === "" ? profileId.value : undefined, - profileEmployeeId: empType.value !== "" ? profileId.value : undefined, - }) - .then(async () => { - await getData(); - await success($q, "บันทึกข้อมูลสำเร็จ"); - onClickCloseDialog(); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); -} - -/** function แก้ไขข้อมูลรายการบันทึกวันที่ไม่ได้รับเงินเดือนฯ*/ -function editData() { - showLoader(); - http - .patch(config.API.profileNewNoPaidById(id.value, empType.value), { - ...formData, - profileId: undefined, - }) - .then(async () => { - await getData(); - await success($q, "บันทึกข้อมูลสำเร็จ"); - onClickCloseDialog(); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); -} - /** function เปิดข้อมูลประวัติการแก้ไช*/ function onClickHistory(rowId: string) { id.value = rowId; modalHistory.value = true; } +/** fetch รายการข้อมูลประวัติการแก้ไช*/ +async function fetchDataHistory() { + showLoader(); + try { + const res = await http.get( + config.API.profileNewNoPaidHisById(id.value, empType.value) + ); + return res.data.result; + } catch (err) { + messageError($q, err); + } finally { + hideLoader(); + } +} + function serchDataTable() { rows.value = onSearchDataTable( keyword.value, @@ -569,7 +598,13 @@ onMounted(() => { - + diff --git a/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalaryHistory.vue b/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalaryHistory.vue deleted file mode 100644 index ae6fbd6ee..000000000 --- a/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalaryHistory.vue +++ /dev/null @@ -1,246 +0,0 @@ - - - -