diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index da0d26cc9..6588f5db0 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -74,6 +74,8 @@ export default { orgSearchPersonal: () => `${organization}/profile/search-personal`, orgSearchPersonalByType: (type: string) => `${organization}/profile${type}/search-personal`, + orgSearchPersonalByTypeNoKeycloak: (type: string) => + `${organization}/profile${type}/search-personal-no-keycloak`, /** บรรจุแต่งตั้ง*/ orgPosPlacement: `${orgPos}/placement/search`, diff --git a/src/components/Dialogs/AddPersonal.vue b/src/components/Dialogs/AddPersonal.vue index 1efebccab..6003ace6f 100644 --- a/src/components/Dialogs/AddPersonal.vue +++ b/src/components/Dialogs/AddPersonal.vue @@ -140,19 +140,27 @@ async function searchInput() { async function getSearch() { showLoader(); + // API ค้นหารายบุคคล + const employeeSuffix = employeeClass.value === "officer" ? "" : "-employee"; + const apiMethod = + props.system === "SYS_DISCIPLINE_APPEAL" + ? config.API.orgSearchPersonalByTypeNoKeycloak + : config.API.orgSearchPersonalByType; + + const apiPath = apiMethod(employeeSuffix); + + // สร้าง query params + const queryParams = `?page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}`; + + // สร้าง body const body = { fieldName: type.value, keyword: search.value ? search.value.trim() : "", system: props.system ?? undefined, }; + await http - .post( - config.API.orgSearchPersonalByType( - employeeClass.value == "officer" ? "" : "-employee" - ) + - `?page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}`, - body - ) + .post(apiPath + queryParams, body) .then((res) => { const data = res.data.result.data; totalList.value = Math.ceil( @@ -358,7 +366,7 @@ watch( @update:pagination="updatePagination" >