diff --git a/src/api/18_command/api.command.ts b/src/api/18_command/api.command.ts index d986ff9b2..5e960210a 100644 --- a/src/api/18_command/api.command.ts +++ b/src/api/18_command/api.command.ts @@ -27,4 +27,5 @@ export default { commandDirector: `${env.API_URI}/org/profile/commander-director`, commandEditSalary: `${command}/tab2/edit-salary`, + commandOperator: `${env.API_URI}/org/commandoperator`, }; diff --git a/src/api/index.ts b/src/api/index.ts index 7e3e8e494..986a55a8f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,7 +37,7 @@ const config = ref({ API_REPORT2_URI: "https://hrmsbkk.case-collection.com/api/v2", LINK_EVALUATE_PUBLISH: "https://bma-ehr-publish.frappet.synology.me", API_REPORT_TEMPLATE_URI: - "https://report-server.frappet.synology.me/api/v1/report-template", + "https://hrmsbkk.case-collection.com/api/v1/report-template", API_SUPPORT_URI: "https://hrmsbkk.case-collection.com/api/v1/support", DASHBOARD_URL: dashboardPanelUrl, }, diff --git a/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue b/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue index 5d02a74b2..c534a5b77 100644 --- a/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue +++ b/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue @@ -142,70 +142,63 @@ async function getData() { } function onSubmit() { - if (selected.value.length !== 0) { - dialogConfirm($q, () => { - const body = selected.value.map((items: any, index: any) => ({ - seq: index, - prefix: items.prefix, - firstName: items.firstName, - lastName: items.lastName, - positionName: items.position, - positionSign: items.positionSign ?? items.posExecutiveName, - profileId: items.id, - keycloakId: items.keycloakId, - positionLeaveName: - items.posType == "บริหาร" || items.posType == "อำนวยการ" - ? items.posType + items.posLevel - : items.posLevel, - posExecutiveName: items.posExecutiveName, - organizationName: [ - items.orgChild4, - items.orgChild3, - items.orgChild2, - items.orgChild1, - items.orgRoot, - ] - .filter(Boolean) - .join(" "), - })); + dialogConfirm($q, async () => { + const body = selected.value.map((items: any, index: any) => ({ + seq: index, + prefix: items.prefix, + firstName: items.firstName, + lastName: items.lastName, + positionName: items.position, + positionSign: items.positionSign ?? items.posExecutiveName, + profileId: items.id, + keycloakId: items.keycloakId, + positionLeaveName: + items.posType == "บริหาร" || items.posType == "อำนวยการ" + ? items.posType + items.posLevel + : items.posLevel, + posExecutiveName: items.posExecutiveName, + organizationName: [ + items.orgChild4, + items.orgChild3, + items.orgChild2, + items.orgChild1, + items.orgRoot, + ] + .filter(Boolean) + .join(" "), + })); - console.log(body); + const hasCommander = selected.value.some((e) => + props.commandersList?.some((i: any) => i === e.id) + ); - const hasCommander = selected.value.some((e) => - props.commandersList?.some((i: any) => i === e.id) - ); + if (hasCommander) { + dialogMessageNotify($q, "ไม่สามารถเลือกได้ เนื่องจากเลือกรายชื่อซ้ำ"); + return; + } - if (hasCommander) { - dialogMessageNotify($q, "ไม่สามารถเลือกได้ เนื่องจากเลือกรายชื่อซ้ำ"); - return; - } - - showLoader(); - http - .post( - config.API.addApproverByType( - props.type?.toLocaleLowerCase() as string, - // props.profileType?.toLocaleLowerCase() as string, - "officer", - pageId.value - ), - body - ) - .then(async () => { - await props.fetchDetailLeave?.(pageId.value); - closeDialog(); - success($q, "บันทึกสำเร็จ"); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); - }); - } else { - dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 คน"); - } + showLoader(); + await http + .post( + config.API.addApproverByType( + props.type?.toLocaleLowerCase() as string, + "officer", + pageId.value + ), + body.length > 0 ? body : [] + ) + .then(async () => { + await props.fetchDetailLeave?.(pageId.value); + closeDialog(); + success($q, "บันทึกสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); + }); } function closeDialog() { diff --git a/src/modules/18_command/components/Step/1_Detail.vue b/src/modules/18_command/components/Step/1_Detail.vue index 34d7cd38e..7123edad6 100644 --- a/src/modules/18_command/components/Step/1_Detail.vue +++ b/src/modules/18_command/components/Step/1_Detail.vue @@ -1,6 +1,6 @@