diff --git a/src/api/13_salary/api.salary.ts b/src/api/13_salary/api.salary.ts index e71c8bb80..94fbffffe 100644 --- a/src/api/13_salary/api.salary.ts +++ b/src/api/13_salary/api.salary.ts @@ -86,4 +86,7 @@ export default { `${salary}/sub-file/${name}/${group}/${id}/${subId}`, salaryUploadFile: (name: string, group: string, id: string, subId: string) => `${salary}/sub-file/${name}/${group}/${id}/${subId}`, + + //รายชื่อออกคำสั่ง + orgPosSalaryReport: `${salary}/report/command/`, }; diff --git a/src/modules/13_salary/views/04_salaryLists.vue b/src/modules/13_salary/views/04_salaryLists.vue index 9438814bd..3d1843c2d 100644 --- a/src/modules/13_salary/views/04_salaryLists.vue +++ b/src/modules/13_salary/views/04_salaryLists.vue @@ -35,6 +35,7 @@ const roundFilter = ref(); //รอบการขึ้นเงินเ const agencyFilter = ref(""); //หน่วยงาน const snapFilter = ref(""); //รอบ const periodLatest = ref(); +const salaryPeriodId = ref(""); //ตัวเลือก const roundOptions = ref([]); //ตัวเลือกรอบการขึ้นเงินเดือน @@ -70,6 +71,7 @@ async function getRound() { roundOptions.value = []; roundFilter.value = []; const data = res.data.result.data; + if (data.length !== 0) { isDisable.value = true; lastPage.value = Math.ceil(res.data.result.total / pageSize.value); @@ -94,6 +96,7 @@ async function getRound() { store.roundMainCode = roundFilter.value.shortCode; store.roundYear = roundFilter.value.year; store.isClosedRound = roundFilter.value.isClose; + salaryPeriodId.value = roundFilter.value.id; await Promise.all([ getSnap(roundFilter.value.shortCode), @@ -199,6 +202,7 @@ async function getAgencyPosition(id: string) { .then(async (res) => { const data = await res.data.result; store.rootId = data.rootId; + const position = agencyOptions.value?.find( (e: DataOption) => e.id === data.rootId ); @@ -242,6 +246,7 @@ async function fetchSalalyPeriod( .post(config.API.salaryListPeriodLatest, body) .then(async (res) => { const data = await res.data.result; + console.log(data); if (roundFilter.value.shortCode !== "SPECIAL") { if (Object.values(data).includes(null)) { @@ -274,6 +279,7 @@ async function fetchSalalyPeriod( async function onChangeRound() { // เก็บสถานะการปิดรอบในตัวแปร isClosedRound เพื่อใช้ในการเช็ค store.isClosedRound = roundFilter.value.isClose; + salaryPeriodId.value = roundFilter.value.id; if (roundFilter.value.shortCode === "SPECIAL") { store.tabGroup = "group1"; } @@ -357,8 +363,21 @@ function filterSelector(val: string, update: Function, refData: string) { } } -onMounted(() => { - getRound(); +async function fetchCheckisOfficer() { + http + .get(config.API.workflowKeycloakSystem(`SALARY_OFFICER`)) + .then((res) => { + const data = res.data.result; + isOfficer.value = data.isOfficer; + isStaff.value = data.isStaff; + }) + .catch((e) => { + messageError($q, e); + }); +} + +onMounted(async () => { + await Promise.all([getRound(), fetchCheckisOfficer()]); }); @@ -542,6 +561,7 @@ onMounted(() => { v-model:is-staff="isStaff" system-name="SALARY" :command-type-code-array="['C-PM-33', 'C-PM-34', 'C-PM-35']" + :salary-period-id="salaryPeriodId" /> diff --git a/src/modules/13_salary/views/05_salaryListsEmployee.vue b/src/modules/13_salary/views/05_salaryListsEmployee.vue index 526ec4e3c..8bf364bb8 100644 --- a/src/modules/13_salary/views/05_salaryListsEmployee.vue +++ b/src/modules/13_salary/views/05_salaryListsEmployee.vue @@ -35,6 +35,7 @@ const roundFilter = ref(); //รอบการขึ้นเงินเ const agencyFilter = ref(""); //หน่วยงาน const snapFilter = ref(""); //รอบ const periodLatest = ref(); +const salaryPeriodId = ref(""); //ตัวเลือก const roundOptions = ref([]); //ตัวเลือกรอบการขึ้นเงินเดือน @@ -92,7 +93,7 @@ async function getRound() { roundFilter.value = await (roundOptions.value ? roundOptions.value[0] : ""); - + salaryPeriodId.value = roundFilter.value.id; store.roundMainCode = roundFilter.value.shortCode; store.isClosedRound = roundFilter.value.isClose; @@ -262,6 +263,7 @@ async function fetchSalalyPeriod( async function onChangeRound() { // เก็บสถานะการปิดรอบในตัวแปร isClosedRound เพื่อใช้ในการเช็ค store.isClosedRound = roundFilter.value.isClose; + salaryPeriodId.value = roundFilter.value.id; await getSnap(roundFilter.value.shortCode); await getAgency(roundFilter.value.revisionId); await getAgencyPosition(roundFilter.value.revisionId); @@ -359,8 +361,21 @@ function filterSelector(val: string, update: Function, refData: string) { } } -onMounted(() => { - getRound(); +async function fetchCheckisOfficer() { + http + .get(config.API.workflowKeycloakSystem(`SALARY_EMP`)) + .then((res) => { + const data = res.data.result; + isOfficer.value = data.isOfficer; + isStaff.value = data.isStaff; + }) + .catch((e) => { + messageError($q, e); + }); +} + +onMounted(async() => { + await Promise.all([getRound(), fetchCheckisOfficer()]); }); @@ -538,6 +553,7 @@ onMounted(() => { v-model:is-staff="isStaff" system-name="SALARY_EMP" :command-type-code-array="['C-PM-36', 'C-PM-37']" + :salary-period-id="salaryPeriodId" /> diff --git a/src/modules/18_command/components/DialogCreateCommandORG.vue b/src/modules/18_command/components/DialogCreateCommandORG.vue index ebd775fdf..78ea9c5b6 100644 --- a/src/modules/18_command/components/DialogCreateCommandORG.vue +++ b/src/modules/18_command/components/DialogCreateCommandORG.vue @@ -40,6 +40,7 @@ const props = defineProps({ commandTypeCodeArray: { type: Array, defult: [] }, // ไอดีประเภทคำสั่ง systemName: String, // ไอดีประเภทคำสั่ง orgPublishDate: { type: Date || undefined, defult: undefined }, + salaryPeriodId: { type: String, defult: "" }, // รอบเงินเดือน }); const commandOp = ref([]); // ประเภทคำสั่ง @@ -49,6 +50,8 @@ const commandYear = ref(new Date().getFullYear()); const commandAffectDate = ref(null); //วันที่ลงนาม const commandExcecuteDate = ref(null); //วันที่คำสั่งมีผล +const commandCode = ref(""); + const group = ref("GROUP1.1"); //กลุ่ม const isCheckOrgPublishDate = ref(false); //เช็คค่าของวันที่คำสั่งมีผล const groupDataOp = ref([ @@ -204,11 +207,20 @@ function filterOption(val: string, update: Function) { } /** - * ฟังก์ชันเลือกกลุ่ม - * @param val กลุ่มที่ต้องการค้นหา + * ฟังก์ชันเลือกประเภทคำสั่งและเลือกกลุ่ม */ -function updateGroup() { - getPerson(); +function updateValue() { + if (props.systemName === "SALARY" || props.systemName === "SALARY_EMP") { + const code = commandOp.value.find( + (e: any) => e.id === commandType.value + )?.code; + if (code && props.salaryPeriodId) { + commandCode.value = code; + getPerson(); + } + } else { + getPerson(); + } } /** ดึงข้อมูลคน */ @@ -221,10 +233,9 @@ function getPerson() { const pathAPI = props.systemName === "ORGANIZATION" ? config.API.orgPosReport - : props.systemName === "SALARY" - ? config.API.orgPosReport - : props.systemName === "SALARY_EMP" - ? config.API.orgPosReport + : props.systemName === "SALARY" || props.systemName === "SALARY_EMP" + ? config.API.orgPosSalaryReport + + `${commandCode.value}/${props.salaryPeriodId}` : props.systemName === "ACTING" ? config.API.orgPosReport : ""; @@ -259,7 +270,9 @@ watch(modal, async () => { (item) => item.id !== "GROUP1.1" ); } - getPerson(); + if (props.systemName !== "SALARY" && props.systemName !== "SALARY_EMP") { + getPerson(); + } } }); @@ -295,6 +308,7 @@ watch(modal, async () => { ? 'inputgreen' : '' " + @update:model-value="updateValue" >