diff --git a/src/api/registry/api.profile.ts b/src/api/registry/api.profile.ts index ad1fdd93f..c4afaf591 100644 --- a/src/api/registry/api.profile.ts +++ b/src/api/registry/api.profile.ts @@ -204,4 +204,8 @@ export default { registryNew, registryNewId: (id: string) => `${registryNew}${id}`, + + /**ปรับรายการเงินเดือนขึ้น-ลง*/ + salarySwap: (dierction: string, id: string) => + `${profile}salary/swap/${dierction}/${id}`, }; diff --git a/src/modules/02_organizationalNew/components/DialogSelectPerson.vue b/src/modules/02_organizationalNew/components/DialogSelectPerson.vue index 32264e22d..03cc140c9 100644 --- a/src/modules/02_organizationalNew/components/DialogSelectPerson.vue +++ b/src/modules/02_organizationalNew/components/DialogSelectPerson.vue @@ -17,7 +17,6 @@ import type { } from "@/modules/02_organizationalNew/interface/index/Main"; import type { OptionType, - OptionExecutive, OptionLevel, SelectPerson, TypePos, @@ -49,11 +48,11 @@ const props = defineProps({ type: Function, require: true, }, - dataDetailPos: { type: Object, require: true }, fetchDataTable: { type: Function, required: true, }, + dataDetailPos: { type: Object, require: true }, }); const isReadonly = ref(false); // อ่านได้อย่างเดียว diff --git a/src/modules/04_registry/components/DialogFooter.vue b/src/modules/04_registry/components/DialogFooter.vue index 9bd3f9279..cb9efbdcd 100644 --- a/src/modules/04_registry/components/DialogFooter.vue +++ b/src/modules/04_registry/components/DialogFooter.vue @@ -20,7 +20,7 @@ /> console.log("not function"), }, + name: { + type: String, + default: "", + }, }); const emit = defineEmits([ "update:editvisible", diff --git a/src/modules/04_registry/components/Salary.vue b/src/modules/04_registry/components/Salary.vue index 46dd9062d..879654e69 100644 --- a/src/modules/04_registry/components/Salary.vue +++ b/src/modules/04_registry/components/Salary.vue @@ -364,6 +364,7 @@ v-model:previous="previous" v-model:modalEdit="modalEdit" :coppy="coppyForm" + :name="'salary'" /> @@ -420,6 +421,7 @@ import { useQuasar } from "quasar"; import type { RequestItemsObject, DataProps, + RequestItemsHistory, } from "@/modules/04_registry/interface/request/Salary"; import type { ResponseObject } from "@/modules/04_registry/interface/response/Salary"; import type { @@ -789,7 +791,7 @@ const rowIndex = ref(0); //indexข้อมูลเดิมที่ const previous = ref(); //แสดงปุ่มดูข้อมูลก่อนหน้า const next = ref(); //แสดงปุ่มดูข้อมูลต่อไป const editRow = ref(false); //เช็คมีการแก้ไขข้อมูล -const rowsHistory = ref([]); //select data history +const rowsHistory = ref([]); //select data history const tittleHistory = ref("ประวัติแก้ไขตำแหน่ง/เงินเดือน"); // const filterHistory = ref(""); //search data table history const modalHistory = ref(false); //modal ประวัติการแก้ไขข้อมูล @@ -1415,6 +1417,8 @@ const fetchData = async () => { agencyName: e.agencyName ?? "-", cLevel: e.cLevel ?? "-", createdAt: new Date(e.createdAt), + postionTypeName: e.postionTypeName ?? "-", + positionLevelName: e.positionLevelName ?? "-", }); }); }) @@ -1671,7 +1675,7 @@ const selectData = async (props: DataProps) => { rowIndex.value = props.rowIndex; id.value = props.row.id; - console.log(props.row); + // console.log(props.row); // date.value = props.row.date; // amount.value = props.row.amount; @@ -1699,8 +1703,8 @@ const selectData = async (props: DataProps) => { formDataSalary.posNo = props.row.posNo ?? "-"; formDataSalary.templatePos = ""; formDataSalary.position = props.row.positionName ?? "-"; - formDataSalary.typePosition = props.row.positionType ?? "-"; - formDataSalary.levelPosition = props.row.positionLevel ?? "-"; + formDataSalary.typePosition = props.row.postionTypeName ?? "-"; + formDataSalary.levelPosition = props.row.positionLevelName ?? "-"; formDataSalary.salary = props.row.amount ?? 0; formDataSalary.salaryPos = props.row.positionSalaryAmount ?? 0; formDataSalary.templateDoc = ""; @@ -2031,33 +2035,25 @@ watch( */ async function onClicksortPos(value: any, up: boolean = true) { if (up) { - await swapUp(value.row.personalId); + await swapSalary("up", value.row.id); } else { - await swapDown(value.row.personalId); + await swapSalary("down", value.row.id); } } /** ปรับรายการเงินเดือนขึ้น */ -async function swapUp(id: string) { - // await http - // .put(config.API.swapUpOrder(id)) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(async () => { - // hideLoader(); - // }); -} -/** ปรับรายการเงินเดือนชื่อลง */ -async function swapDown(id: string) { - // await http - // .put(config.API.swapDownOrder(id)) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(async () => { - // hideLoader(); - // }); +async function swapSalary(dierction: string, id: string) { + await http + .post(config.API.salarySwap(dierction, id)) + .then(() => { + fetchData(); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + hideLoader(); + }); } function updatePos(val: string) { diff --git a/src/modules/04_registry/interface/request/Salary.ts b/src/modules/04_registry/interface/request/Salary.ts index 1ab977cf0..24dbc702c 100644 --- a/src/modules/04_registry/interface/request/Salary.ts +++ b/src/modules/04_registry/interface/request/Salary.ts @@ -47,6 +47,48 @@ interface RequestItemsObject { salaryStatus: string | null; createdFullName: string; createdAt: Date; + postionTypeName: string; + positionLevelName: string; +} + +interface RequestItemsHistory { + id: string; + date: Date; + amount: number; + positionSalaryAmount: number; + mouthSalaryAmount: number; + oc: string; + ocId: string; + position: string; + positionName: string; + positionId: string; + posNo: string; + posNoId: string; + positionLine: string; + positionLineName: string; + positionLineId: string; + positionPathSide: string; + positionPathSideId: string; + positionPathSideName: string; + positionType: string; + positionTypeId: string; + positionLevel: string; + positionLevelId: string; + positionExecutive: string; + positionExecutiveName: string; + positionExecutiveId: string; + positionExecutiveSide: string; + positionExecutiveSideId: string; + salaryClass: string; + salaryRef: string; + refCommandNo: string; + orgName: string; + agencyName: string; + cLevel: string; + // refCommandDate: Date | null; + salaryStatus: string | null; + createdFullName: string; + createdAt: Date; } interface RequestItemsEmployee { @@ -96,4 +138,5 @@ export type { DataProps, RequestItemsEmployee, DataPropsEmployee, + RequestItemsHistory };