diff --git a/src/api/registry/api.profile.ts b/src/api/registry/api.profile.ts index 75343c494..77a70667b 100644 --- a/src/api/registry/api.profile.ts +++ b/src/api/registry/api.profile.ts @@ -175,6 +175,8 @@ export default { profileReactive: (profileId: string) => `${profile}reactive/${profileId}`, profileReportId: (profileId: string) => `${report}kk1/${profileId}`, + profileReportEmpId: (profileId: string) => + `${report}kk1-employee/${profileId}`, profileKp7ShortId: (profileId: string) => `${report}kp7-short/${profileId}`, profileChangeNameId: (profileId: string) => @@ -212,8 +214,8 @@ export default { /**ปรับรายการเงินเดือนขึ้น-ลง*/ salarySwap: (dierction: string, id: string) => `${profile}salary/swap/${dierction}/${id}`, - listProfileNew:(id:string,page:number,pageSize:number)=>`${profile}search/new-page/oc/${id}/officer?page=${page}&pageSize=${pageSize}`, + listProfileNew: (id: string, page: number, pageSize: number) => + `${profile}search/new-page/oc/${id}/officer?page=${page}&pageSize=${pageSize}`, - - orgProfileAvatar:`${registryNew}avatar` + orgProfileAvatar: `${registryNew}avatar`, }; 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 a8369cc69..1622b0702 100644 --- a/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue +++ b/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue @@ -14,6 +14,10 @@ import type { } from "@/modules/04_registryPerson/interface/index/Main"; import type { FormSalaryNew } from "@/modules/04_registryPerson/interface/request/Salary"; +import type { + ResListSalary, + ResType, +} from "@/modules/04_registryPerson/interface/response/Salary"; import DialogHeader from "@/components/DialogHeader.vue"; import DialogHistory from "@/modules/04_registryPerson/components/detail/Salary/01_PositionSalaryHistory.vue"; @@ -130,7 +134,6 @@ const baseColumns = ref([ style: "font-size: 14px", }, ]); - const columns = computed(() => { if (empType.value === "-employee") { if (baseColumns.value) { @@ -143,7 +146,6 @@ const columns = computed(() => { } return baseColumns.value; }); - const visibleColumns = ref([ "date", "amount", @@ -155,18 +157,12 @@ const visibleColumns = ref([ "templateDoc", "refCommandNo", ]); -const formFilter = reactive({ - page: 1, - pageSize: 10, - keyword: "", -}); - const pagination = ref({ page: 1, rowsPerPage: 10, }); - -const rows = ref([]); +const rows = ref([]); +const keyword = ref(""); const formDataSalary = reactive({ date: null, @@ -189,7 +185,7 @@ const formDataSalary = reactive({ const modalDialogSalary = ref(false); const isStatusEdit = ref(false); const salaryId = ref(""); -const dataLevel = ref([]); +const dataLevel = ref([]); const posNoOptions = ref(store.optionTemplatePos); @@ -206,6 +202,9 @@ const posExecutiveOptionMain = ref([]); const docOption = ref(store.optionTemplateDoc); +/** + * function fetch รายการ ตำแหน่งเงินเดือน + */ function fetchListSalary() { showLoader(); http @@ -221,6 +220,9 @@ function fetchListSalary() { }); } +/** + * function fetch รายการ ตำแหน่งเงินเดือน + */ function fetchType() { http .get(config.API.orgPosType) @@ -237,6 +239,11 @@ function fetchType() { }); } +/** + * function เลือกประเภทตำแหน่ง + * @param val + * @param status + */ async function updateSelectType(val: string, status: boolean = false) { const listLevel = await dataLevel.value.find( (e: any) => e.posTypeName === val @@ -252,7 +259,12 @@ async function updateSelectType(val: string, status: boolean = false) { } } -async function onClickOpenDialog(statusEdit: boolean = false, data: any = []) { +/** + * function เปิด dialog ตำแหน่งเงินเดือน + * @param statusEdit แก้ไข,เพิ่ม + * @param data + */ +function onClickOpenDialog(statusEdit: boolean = false, data: any = []) { if (empType.value === "") { dataLevel.value.length === 0 && fetchType(); fetchDataOption(); @@ -261,6 +273,7 @@ async function onClickOpenDialog(statusEdit: boolean = false, data: any = []) { fetchOptionGroup(); } + // หาระดับตำแหน่ง setTimeout(async () => { statusEdit && (await updateSelectType(data.positionType, true)); isStatusEdit.value = statusEdit; @@ -288,10 +301,19 @@ async function onClickOpenDialog(statusEdit: boolean = false, data: any = []) { formDataSalary.doc = statusEdit ? data.templateDoc : ""; } +/** + * function ปิด dialog ตำแหน่งเงินเดือน + */ function onClickCloseDialog() { modalDialogSalary.value = false; } +/** + * ฟิลเตอร์ข้อมูลจาก input + * @param val ค่าที่ป้อนให้ input + * @param update function จาก quasar + * @param filtername type ที่กำหนด ของ input นั้นๆ + */ function filterSelector(val: any, update: Function, filtername: string) { switch (filtername) { case "pos": @@ -350,75 +372,91 @@ function filterSelector(val: any, update: Function, filtername: string) { } } +/** + * function เลือกต้นแบบ tamplate ตำแหน่ง + * @param val + */ function updatePos(val: string) { formDataSalary.position = val; } +/** + * function เลือกต้นแบบ tamplate เอกสาร + * @param val + */ function updateDoc(val: string) { formDataSalary.doc = val; } +/** + * function ยืนยันการบันทึกข้อมูล + */ function onSubmit() { - dialogConfirm($q, () => { - submit(); + dialogConfirm($q, async () => { + showLoader(); + const formData = { + profileEmployeeId: + !isStatusEdit.value && empType.value !== "" + ? profileId.value + : undefined, + profileId: + !isStatusEdit.value && empType.value === "" + ? profileId.value + : undefined, + date: formDataSalary.date, // วันที่ + posNo: formDataSalary.posNo, //ตำแหน่งเลขที่ + position: formDataSalary.position, //ตำแหน่ง + positionLine: + empType.value === "" ? formDataSalary.positionLine : undefined, //สายงาน + positionPathSide: + empType.value === "" ? formDataSalary.positionPathSide : undefined, // ด้าน/สาขา + positionExecutive: + empType.value === "" ? formDataSalary.positionExecutive : undefined, //ตำแหน่งทางการบริหาร + positionType: formDataSalary.positionType, // ประเภทตำแหน่ง + positionLevel: formDataSalary.positionLevel, // ระดับตำแหน่ง + amount: + typeof formDataSalary.salary === "number" + ? formDataSalary.salary + : Number(formDataSalary?.salary?.replace(/,/g, "")), //เงินเดือนฐาน + positionSalaryAmount: + typeof formDataSalary.salaryPos === "number" + ? formDataSalary.salaryPos + : Number(formDataSalary?.salaryPos?.replace(/,/g, "")), // เงินประจำตำแหน่ง + mouthSalaryAmount: + typeof formDataSalary.salaryCompensation === "number" + ? formDataSalary.salaryCompensation + : Number(formDataSalary?.salaryCompensation?.replace(/,/g, "")), //เงินค่าตอบแทนรายเดือน + refCommandNo: formDataSalary.refCommandNo, // เลขที่คำสั่ง + templateDoc: formDataSalary.doc, // เอกสารอ้างอิง + }; + + try { + const url = isStatusEdit.value + ? config.API.profileListSalaryNew(salaryId.value, empType.value) + : config.API.profileSalaryNew(empType.value); + const method = isStatusEdit.value ? "patch" : "post"; + await http[method](url, formData); + await fetchListSalary(); + success($q, "บันทึกข้อมูลสำเร็จ"); + await onClickCloseDialog(); + } catch (e) { + messageError($q, e); + } finally { + hideLoader(); + } }); } -async function submit() { - const formData = { - profileEmployeeId: - !isStatusEdit.value && empType.value !== "" ? profileId.value : undefined, - profileId: - !isStatusEdit.value && empType.value === "" ? profileId.value : undefined, - date: formDataSalary.date, // วันที่ - posNo: formDataSalary.posNo, //ตำแหน่งเลขที่ - position: formDataSalary.position, //ตำแหน่ง - positionLine: - empType.value === "" ? formDataSalary.positionLine : undefined, //สายงาน - positionPathSide: - empType.value === "" ? formDataSalary.positionPathSide : undefined, // ด้าน/สาขา - positionExecutive: - empType.value === "" ? formDataSalary.positionExecutive : undefined, //ตำแหน่งทางการบริหาร - positionType: formDataSalary.positionType, // ประเภทตำแหน่ง - positionLevel: formDataSalary.positionLevel, // ระดับตำแหน่ง - amount: - typeof formDataSalary.salary === "number" - ? formDataSalary.salary - : Number(formDataSalary?.salary?.replace(/,/g, "")), //เงินเดือนฐาน - positionSalaryAmount: - typeof formDataSalary.salaryPos === "number" - ? formDataSalary.salaryPos - : Number(formDataSalary?.salaryPos?.replace(/,/g, "")), // เงินประจำตำแหน่ง - mouthSalaryAmount: - typeof formDataSalary.salaryCompensation === "number" - ? formDataSalary.salaryCompensation - : Number(formDataSalary?.salaryCompensation?.replace(/,/g, "")), //เงินค่าตอบแทนรายเดือน - refCommandNo: formDataSalary.refCommandNo, // เลขที่คำสั่ง - templateDoc: formDataSalary.doc, // เอกสารอ้างอิง - }; - - try { - const url = isStatusEdit.value - ? config.API.profileListSalaryNew(salaryId.value, empType.value) - : config.API.profileSalaryNew(empType.value); - const method = isStatusEdit.value ? "patch" : "post"; - await http[method](url, formData); - fetchListSalary(); - onClickCloseDialog(); - success($q, "บันทึกข้อมูลสำเร็จ"); - } catch (e) { - messageError($q, e); - } finally { - hideLoader(); - } -} - +/** + * function เลื่อนรายการเงินเดือนขึ้น + * @param id รายการเงินเดือน + */ function onSwapUp(id: string) { showLoader(); http .get(config.API.profileSalarySwapNew("up", id, empType.value)) - .then(() => { - fetchListSalary(); + .then(async () => { + await fetchListSalary(); }) .catch((err) => { messageError($q, err); @@ -427,12 +465,17 @@ function onSwapUp(id: string) { hideLoader(); }); } + +/** + * function เลื่อนรายการเงินเดือนลง + * @param id รายการเงินเดือน + */ function onSwapDown(id: string) { showLoader(); http .get(config.API.profileSalarySwapNew("down", id, empType.value)) - .then(() => { - fetchListSalary(); + .then(async () => { + await fetchListSalary(); }) .catch((err) => { messageError($q, err); @@ -443,14 +486,22 @@ function onSwapDown(id: string) { } const modalHistory = ref(false); + +/** + * function ดูข้อมูลประวัติการแก้ไขรายการเงินเดือน + * @param id รายการเงินเดือน + */ function onClikcHistory(id: string) { salaryId.value = id; modalHistory.value = true; } -async function fetchDataOption() { +/** + * function fetch ข้อมูลสายงาน + */ +function fetchDataOption() { showLoader(); - await http + http .get(config.API.orgPosPosition + `?keyword=&type=ALL`) .then((res) => { const data = res.data.result; @@ -497,6 +548,9 @@ async function fetchDataOption() { }); } +/** + * function fetch ข้อมูลตำแหน่งข้อมูลทางการบริหาร + */ function fetchDataOptionExecutive() { showLoader(); http @@ -516,11 +570,14 @@ function fetchDataOptionExecutive() { }); } -async function fetchOptionGroup() { +/** + * function fetch ข้อมูลปรเภทตำแหน่ง + */ +function fetchOptionGroup() { showLoader(); - await http + http .get(config.API.orgEmployeeType) - .then(async (res) => { + .then((res) => { dataLevel.value = res.data.result; posTypeOptionsMain.value = res.data.result.map((e: any) => ({ id: e.id, @@ -561,20 +618,14 @@ const classInput = (val: boolean) => { เพิ่มข้อมูล - + @@ -600,7 +651,7 @@ const classInput = (val: boolean) => { flat bordered dense - :filter="formFilter.keyword" + :filter="keyword" :columns="columns" :rows="rows" :paging="true" diff --git a/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalaryHistory.vue b/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalaryHistory.vue index 1e9a6f681..82ea899d1 100644 --- a/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalaryHistory.vue +++ b/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalaryHistory.vue @@ -13,15 +13,8 @@ import { useCounterMixin } from "@/stores/mixin"; const $q = useQuasar(); const route = useRoute(); -const { - date2Thai, - dialogConfirm, - showLoader, - hideLoader, - messageError, - success, - pathRegistryEmp, -} = useCounterMixin(); +const { date2Thai, showLoader, hideLoader, messageError, pathRegistryEmp } = + useCounterMixin(); const empType = ref(pathRegistryEmp(route.name?.toString() ?? "")); @@ -242,6 +235,9 @@ function closeDialog() { modal.value = false; } +/** + * function fetch ข้อมูลประวัติการแก้ไข + */ function fetchListHistory() { showLoader(); http 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 27f8d7811..b78775483 100644 --- a/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue +++ b/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue @@ -23,7 +23,6 @@ const { hideLoader, messageError, success, - dialogRemove, pathRegistryEmp, } = useCounterMixin(); const id = ref(""); @@ -111,24 +110,27 @@ const formData = reactive({ refCommandNo: "", refCommandDate: null, }); -const formFilter = reactive({ - page: 1, - pageSize: 10, - keyword: "", -}); -const maxPage = ref(1); + +const keyword = ref(""); const pagination = ref({ page: 1, rowsPerPage: 10, }); +/** + * funciton ยืนยันการบันทึกข้อมูล + */ function onSubmit() { dialogConfirm($q, () => { isStatusEdit.value ? editData() : saveData(); - onClickCloseDialog(); }); } +/** + * function เปิด Didalig บันทึกวันที่ไม่ได้รับเงินเดือนฯ + * @param StatusEdit แก้ไข , เพิ่ม + * @param data ข้อมูล + */ function onClickOpenDialog(StatusEdit: boolean = false, data: any = []) { isStatusEdit.value = StatusEdit; id.value = StatusEdit ? data.id : ""; @@ -140,14 +142,20 @@ function onClickOpenDialog(StatusEdit: boolean = false, data: any = []) { modalDialog.value = true; } +/** + * function ปิด Didalig บันทึกวันที่ไม่ได้รับเงินเดือนฯ + */ function onClickCloseDialog() { modalDialog.value = false; isStatusEdit.value = false; } -async function getData() { +/** + * function fetch รายการบันทึกวันที่ไม่ได้รับเงินเดือนฯ + */ +function getData() { showLoader(); - await http + http .get(config.API.profileNewNoPaidByProfileId(profileId.value, empType.value)) .then((res) => { rows.value = res.data.result; @@ -160,18 +168,21 @@ async function getData() { }); } -async function saveData() { +/** + * function เพิ่มข้อมูลรายการบันทึกวันที่ไม่ได้รับเงินเดือนฯ + */ +function saveData() { showLoader(); - await http + http .post(config.API.profileNewNoPaid(empType.value), { ...formData, profileId: empType.value === "" ? profileId.value : undefined, profileEmployeeId: empType.value !== "" ? profileId.value : undefined, }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - getData(); + .then(async () => { + await getData(); onClickCloseDialog(); + await success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((e) => { messageError($q, e); @@ -181,17 +192,20 @@ async function saveData() { }); } -async function editData() { +/** + * function แก้ไขข้อมูลรายการบันทึกวันที่ไม่ได้รับเงินเดือนฯ + */ +function editData() { showLoader(); - await http + http .patch(config.API.profileNewNoPaidById(id.value, empType.value), { ...formData, profileId: undefined, }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - getData(); + .then(async () => { + await getData(); onClickCloseDialog(); + await success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((e) => { messageError($q, e); @@ -201,22 +215,9 @@ async function editData() { }); } -// async function deleteData(id: string) { -// showLoader(); -// await http -// .delete(config.API.profileNewNoPaidById(id)) -// .then((res) => { -// success($q, "ลบข้อมูลสำเร็จ"); -// getData(); -// }) -// .catch((e) => { -// messageError($q, e); -// }) -// .finally(() => { -// hideLoader(); -// }); -// } - +/** + * function เปิดข้อมูลประวัติการแก้ไช + */ function onClickHistory(rowId: string) { id.value = rowId; modalHistory.value = true; @@ -243,7 +244,7 @@ onMounted(() => { { > @@ -320,7 +321,7 @@ onMounted(() => { :columns="columns" :rows="rows" :paging="true" - :filter="formFilter.keyword" + :filter="keyword" v-model:pagination="pagination" :rows-per-page-options="[20, 50, 100]" :visible-columns="visibleColumns" diff --git a/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalaryHistory.vue b/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalaryHistory.vue index 295a59aac..d79d746d6 100644 --- a/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalaryHistory.vue +++ b/src/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalaryHistory.vue @@ -119,6 +119,9 @@ const pagination = ref({ rowsPerPage: 10, }); +/** + * fetch รายการข้อมูลประวัติการแก้ไช + */ function getHistory() { showLoader(); http diff --git a/src/modules/04_registryPerson/interface/response/Salary.ts b/src/modules/04_registryPerson/interface/response/Salary.ts new file mode 100644 index 000000000..82b1b34b9 --- /dev/null +++ b/src/modules/04_registryPerson/interface/response/Salary.ts @@ -0,0 +1,41 @@ +interface ResListSalary { + amount: number; + createdAt: string; + createdFullName: string; + createdUserId: string; + date: string; + id: string; + lastUpdateFullName: string; + lastUpdateUserId: string; + lastUpdatedAt: string; + mouthSalaryAmount: number; + order: number; + posNo: string; + position: string; + positionExecutive: string; + positionLevel: string; + positionLine: string; + positionPathSide: string; + positionSalaryAmount: number; + positionType: string; + profileEmployeeId: null | string; + profileId: string; + refCommandNo: string; + templateDoc: string; +} + +interface ResType { + id: string; + posTypeName: string; + posTypeRank: number; + posLevels: PosLevel[]; +} + +interface PosLevel { + id: string; + posLevelAuthority: null; + posLevelName: string; + posLevelRank: number; +} + +export type { ResListSalary, ResType }; diff --git a/src/modules/04_registryPerson/views/detailView.vue b/src/modules/04_registryPerson/views/detailView.vue index f50385435..9cf8c56be 100644 --- a/src/modules/04_registryPerson/views/detailView.vue +++ b/src/modules/04_registryPerson/views/detailView.vue @@ -285,10 +285,14 @@ async function fetchDataPersonal() { } function onClickDownloadKp7(type: string) { + console.log(empType.value); + showLoader(); const url = type === "FULL" - ? config.API.profileReportId(profileId.value) + ? empType.value + ? config.API.profileReportEmpId(profileId.value) + : config.API.profileReportId(profileId.value) : config.API.profileKp7ShortId(profileId.value); const fileName = type === "FULL" ? "ก.พ.7/ก.ก.1" : "ประวัติแบบย่อ"; http diff --git a/src/modules/09_leave/views/RoundMain.vue b/src/modules/09_leave/views/RoundMain.vue index eb1363071..1889df409 100644 --- a/src/modules/09_leave/views/RoundMain.vue +++ b/src/modules/09_leave/views/RoundMain.vue @@ -244,14 +244,6 @@ onMounted(() => { @click="onClickDelete(props.row.id)" >ลบข้อมูล - - เวลา Default -
@@ -268,6 +260,18 @@ onMounted(() => { color="grey" />
+
+ + เวลา Default + + + {{ col.value }} +
{{ col.value }}