From cc0c600174d1f30de230cf5142165bc8800fc6ab Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 21 Mar 2025 11:53:41 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=87?= =?UTF-8?q?=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80=E0=B8=94=E0=B8=B7?= =?UTF-8?q?=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interface/request/Edit.ts | 29 +++- .../interface/response/Edit.ts | 49 +++++- src/modules/04_registryPerson/stores/Edit.ts | 3 + .../views/edit/components/DialogForm.vue | 144 ++++++++++++------ .../views/edit/components/FormPosition.vue | 17 +-- .../views/edit/components/Table.vue | 66 ++++---- .../04_registryPerson/views/edit/list.vue | 29 ++-- .../04_registryPerson/views/edit/salary.vue | 26 +++- 8 files changed, 255 insertions(+), 108 deletions(-) diff --git a/src/modules/04_registryPerson/interface/request/Edit.ts b/src/modules/04_registryPerson/interface/request/Edit.ts index 691adc377..57eaa9b24 100644 --- a/src/modules/04_registryPerson/interface/request/Edit.ts +++ b/src/modules/04_registryPerson/interface/request/Edit.ts @@ -6,4 +6,31 @@ interface DataFilter { pageSize: number; } -export type { DataFilter }; +interface FormDataSalary { + commandCode: string; //ประเภทคำสั่ง + commandNo: string; //เลขที่คำสั่ง + commandYear: number | null; //ปี + commandDateAffect: Date | null; //วันที่มีผล + commandDateSign: Date | null; //วันที่ลงนาม + posNoAbb: string; //ตัวย่อเลขที่ตำแหน่ง + posNo: string; //เลขที่ตำแหน่ง + positionName: string; //ตำแหน่ง + positionType: string; //ประเภทตำแหน่ง, กลุ่มงาน + positionLevel: string; //ระดับตำแหน่ง, ระดับชั้นงาน + positionCee: string; //ระดับซี + positionLine: string; // สายงาน + positionPathSide: string; //ด้าน/สาขา + positionExecutive: string; //ตำแหน่งทางการบริหาร + amount: number | null; //เงินเดือน + amountSpecial: number | null; //เงินค่าตอบแทนพิเศษ + positionSalaryAmount: number | null; //เงินประจำตำแหน่ง + mouthSalaryAmount: number | null; //เงินค่าตอบแทนรายเดือน + orgRoot: string; //หน่วยงาน + orgChild1: string; //ส่วนราชการระดับ 1 + orgChild2: string; //ส่วนราชการระดับ 2 + orgChild3: string; //ส่วนราชการระดับ 3 + orgChild4: string; //ส่วนราชการระดับ 4 + remark: string; //หมายเหตุstring +} + +export type { DataFilter, FormDataSalary }; diff --git a/src/modules/04_registryPerson/interface/response/Edit.ts b/src/modules/04_registryPerson/interface/response/Edit.ts index f3b8ec70e..f27f8e890 100644 --- a/src/modules/04_registryPerson/interface/response/Edit.ts +++ b/src/modules/04_registryPerson/interface/response/Edit.ts @@ -23,4 +23,51 @@ interface DataSalaryPos { type: string; } -export type { DataSalaryPos }; +interface DataPosition { + amount: number; + amountSpecial: number; + commandCode: string; + commandDateAffect: string; + commandDateSign: string; + commandId: string; + commandName: string; + commandNo: string; + commandYear: number; + createdAt: string; + createdFullName: string; + createdUserId: string; + dateGovernment: string; + id: string; + isDelete: boolean; + isEdit: boolean; + isEntry: boolean; + isGovernment: string; + lastUpdateFullName: string; + lastUpdateUserId: string; + lastUpdatedAt: string; + mouthSalaryAmount: number; + order: number; + orgChild1: string; + orgChild2: string; + orgChild3: string; + orgChild4: string; + orgRoot: string; + posNo: string; + posNoAbb: string; + positionCee: string; + positionExecutive: string; + positionLevel: string; + positionLine: string; + positionName: string; + positionPathSide: string; + positionSalaryAmount: number; + positionType: string; + profileEmployeeId: string; + profileId: string; + refId: number; + remark: string; + salaryId: string; + status: string; +} + +export type { DataSalaryPos, DataPosition }; diff --git a/src/modules/04_registryPerson/stores/Edit.ts b/src/modules/04_registryPerson/stores/Edit.ts index 6e05a62a8..3d3f7cc4d 100644 --- a/src/modules/04_registryPerson/stores/Edit.ts +++ b/src/modules/04_registryPerson/stores/Edit.ts @@ -4,6 +4,8 @@ import { defineStore } from "pinia"; import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main"; export const useEditPosDataStore = defineStore("EditPos", () => { + + const orgData = ref([]); const commandCodeData = ref([]); const posTypeData = ref([]); //รายการประเภทตำแหน่ง | กลุ่มงาน const posLevelData = ref([]); //รายการระดับตำแหน่ง | ระดับชั้นงาน @@ -25,6 +27,7 @@ export const useEditPosDataStore = defineStore("EditPos", () => { posLineData, posPathSideData, posExecutiveData, + orgData, // Function convertCommandCodeName, diff --git a/src/modules/04_registryPerson/views/edit/components/DialogForm.vue b/src/modules/04_registryPerson/views/edit/components/DialogForm.vue index b71b595da..d2ff12992 100644 --- a/src/modules/04_registryPerson/views/edit/components/DialogForm.vue +++ b/src/modules/04_registryPerson/views/edit/components/DialogForm.vue @@ -8,6 +8,15 @@ import http from "@/plugins/http"; import config from "@/app.config"; import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main"; +import type { DataPosition } from "@/modules/04_registryPerson/interface/response/Edit"; +import type { FormDataSalary } from "@/modules/04_registryPerson/interface/request/Edit"; +import type { + DataCommandCode, + DataPosType, + DataPosLevel, + DataPosPosition, + DataPosExecutive, +} from "@/modules/04_registryPerson/interface/response/Position"; import DialogHeader from "@/components/DialogHeader.vue"; import FormPosition from "@/modules/04_registryPerson/views/edit/components/FormPosition.vue"; @@ -19,21 +28,20 @@ const { hideLoader, messageError, success, - convertDateToAPI, } = useCounterMixin(); const store = useEditPosDataStore(); const modal = defineModel("modal", { required: true }); const empType = defineModel("empType", { required: true }); -const rowData = defineModel("rowData", { required: true }); +const rowData = defineModel("rowData", { required: true }); const rowIndex = defineModel("rowIndex", { required: true }); const props = defineProps({ fetchData: { type: Function, required: true }, }); -const formData = reactive({ +const formData = reactive({ commandCode: "", //ประเภทคำสั่ง commandNo: "", //เลขที่คำสั่ง commandYear: null, //ปี @@ -59,7 +67,7 @@ const formData = reactive({ orgChild4: "", //ส่วนราชการระดับ 4 remark: "", //หมายเหตุ }); -const formReadonly = reactive({ +const formReadonly = reactive({ commandCode: "", //ประเภทคำสั่ง commandNo: "", //เลขที่คำสั่ง commandYear: null, //ปี @@ -86,7 +94,7 @@ const formReadonly = reactive({ remark: "", //หมายเหตุ }); -const dataLevel = ref([]); //รายการ ตำแหน่งเงินเดือน +const dataLevel = ref([]); //รายการ ตำแหน่งเงินเดือน const commandCodeOptions = ref(store.commandCodeData); //รายการปรเภทคำสั่ง const posTypeOptions = ref(store.posTypeData); //รายการประเภทตำแหน่ง | กลุ่มงาน const posLevelOptions = ref(store.posLevelData); //รายการระดับตำแหน่ง | ระดับชั้นงาน @@ -98,12 +106,15 @@ const salaryId = ref(""); async function fetchDataPosition() { try { + showLoader(); const res = await http.get( config.API.salaryTemp + `/get/${salaryId.value}` ); return res.data.result; } catch (err) { messageError($q, err); + } finally { + hideLoader(); } } @@ -115,7 +126,7 @@ async function fetchDataCommandCode() { .then((res) => { const data = res.data.result; - store.commandCodeData = data.map((e: any) => ({ + store.commandCodeData = data.map((e: DataCommandCode) => ({ id: e.code.toString(), name: e.name, })); @@ -133,7 +144,7 @@ async function fetchType() { .get(config.API.orgPosType) .then((res) => { dataLevel.value = res.data.result; - store.posTypeData = res.data.result.map((e: any) => ({ + store.posTypeData = res.data.result.map((e: DataPosType) => ({ id: e.id, name: e.posTypeName, })); @@ -150,7 +161,7 @@ async function fetchOptionGroup() { .get(config.API.orgEmployeeType) .then((res) => { dataLevel.value = res.data.result; - store.posTypeData = res.data.result.map((e: any) => ({ + store.posTypeData = res.data.result.map((e: DataPosType) => ({ id: e.id, name: e.posTypeName, })); @@ -174,7 +185,7 @@ async function fetchDataOption() { const seen = new Set(); const seen2 = new Set(); - const listPositionField = data.filter((item: any) => { + const listPositionField = data.filter((item: DataPosPosition) => { if (seen.has(item.positionField)) { return false; } else { @@ -182,12 +193,12 @@ async function fetchDataOption() { return true; } }); - store.posLineData = listPositionField.map((e: any) => ({ + store.posLineData = listPositionField.map((e: DataPosPosition) => ({ id: e.positionField, name: e.positionField, })); - const listPositionArea = data.filter((item: any) => { + const listPositionArea = data.filter((item: DataPosPosition) => { if ( item.positionArea === null || item.positionArea === "" || @@ -200,7 +211,7 @@ async function fetchDataOption() { return true; } }); - store.posPathSideData = listPositionArea.map((e: any) => ({ + store.posPathSideData = listPositionArea.map((e: DataPosPosition) => ({ id: e.positionArea, name: e.positionArea, })); @@ -216,7 +227,7 @@ async function fetchDataOptionExecutive() { .get(config.API.orgPosExecutive) .then((res) => { const data = res.data.result; - store.posExecutiveData = data.map((e: any) => ({ + store.posExecutiveData = data.map((e: DataPosExecutive) => ({ id: e.posExecutiveName, name: e.posExecutiveName, })); @@ -233,11 +244,11 @@ async function fetchDataOptionExecutive() { */ async function updateSelectType(val: string, status: boolean = false) { const listLevel = val - ? dataLevel.value.find((e: any) => e.posTypeName === val) + ? dataLevel.value.find((e: DataPosType) => e.posTypeName === val) : null; if (listLevel) { - store.posLevelData = listLevel.posLevels.map((e: any) => ({ + store.posLevelData = listLevel.posLevels.map((e: DataPosLevel) => ({ id: e.id, name: empType.value === "officer" @@ -393,7 +404,7 @@ onMounted(async () => { @@ -402,18 +413,32 @@ onMounted(async () => {
- + +
+ ข้อมูลปัจุบัน +
+
+ + + +
@@ -422,18 +447,34 @@ onMounted(async () => {
- + +
+ ข้อมูลที่แก้ไข +
+
+ + + + +
+
@@ -442,26 +483,29 @@ onMounted(async () => { - - บันทึกข้อมูล - - บันทึกข้อมูล + ข้อมูลก่อนหน้า + ข้อมูลถัดไป + + + บันทึกข้อมูล diff --git a/src/modules/04_registryPerson/views/edit/components/FormPosition.vue b/src/modules/04_registryPerson/views/edit/components/FormPosition.vue index 7275a9a03..2ef968e86 100644 --- a/src/modules/04_registryPerson/views/edit/components/FormPosition.vue +++ b/src/modules/04_registryPerson/views/edit/components/FormPosition.vue @@ -5,23 +5,14 @@ import { useCounterMixin } from "@/stores/mixin"; import { useEditPosDataStore } from "@/modules/04_registryPerson/stores/Edit"; import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main"; +import type { FormDataSalary } from "@/modules/04_registryPerson/interface/request/Edit"; -const { - date2Thai, - dialogConfirm, - showLoader, - hideLoader, - messageError, - success, - pathRegistryEmp, - onSearchDataTable, - convertDateToAPI, -} = useCounterMixin(); +const { date2Thai } = useCounterMixin(); const store = useEditPosDataStore(); const isReadonly = defineModel("isReadonly", { required: true }); const empType = defineModel("empType", { required: true }); -const formData = defineModel("formData", { required: true }); +const formData = defineModel("formData", { required: true }); const commandCodeOptions = defineModel("commandCodeOptions", { required: true, }); @@ -209,7 +200,7 @@ function classInput(val: boolean) { autoApply year-picker :enableTimePicker="false" - class="inputgreen" + :class="classInput(isReadonly)" :readonly="isReadonly" > diff --git a/src/modules/04_registryPerson/views/edit/components/Table.vue b/src/modules/04_registryPerson/views/edit/components/Table.vue index 359ae8048..ce9215dbb 100644 --- a/src/modules/04_registryPerson/views/edit/components/Table.vue +++ b/src/modules/04_registryPerson/views/edit/components/Table.vue @@ -1,27 +1,21 @@ diff --git a/src/modules/04_registryPerson/views/edit/salary.vue b/src/modules/04_registryPerson/views/edit/salary.vue index 4cd5cbf50..cf7b7fcb9 100644 --- a/src/modules/04_registryPerson/views/edit/salary.vue +++ b/src/modules/04_registryPerson/views/edit/salary.vue @@ -26,10 +26,11 @@ const router = useRouter(); const dataProfile = ref(); const tabs = ref("PENDING"); +const statusCheckEdit = ref(""); const empType = ref(route.params.type.toString()); const profileId = ref(route.params.id.toString()); -/** funtion*/ +/** funtion fetch ข้อมูลส่วนตัว*/ async function fetchDataProfile() { showLoader(); await http @@ -40,6 +41,7 @@ async function fetchDataProfile() { ) .then(async (res) => { const data = res.data.result; + statusCheckEdit.value = data.statusCheckEdit; dataProfile.value = { fullName: `${data.prefix}${data.firstName} ${data.lastName}`, position: data.position, @@ -69,7 +71,8 @@ function onConfirmEdit() { profileId: profileId.value, type: empType.value?.toLocaleUpperCase(), }) - .then(() => { + .then(async () => { + await fetchDataProfile(); success($q, "ยืนยันเสร็จสิ้นการแก้ไขสำเร็จ"); }) .catch((err) => { @@ -95,7 +98,8 @@ function onConfirmDone() { profileId: profileId.value, type: empType.value?.toLocaleUpperCase(), }) - .then(() => { + .then(async () => { + await fetchDataProfile(); success($q, "ยืนยันข้อมูลถูกต้องสำเร็จ"); }) .catch((err) => { @@ -212,8 +216,15 @@ onMounted(async () => {
{
{ - +
-
+