เปลี่ยน api ค้นหาคนจากทะเบียนประวัติใหม่ ของวินัยและประเมิน

This commit is contained in:
Warunee Tamkoo 2024-02-16 14:05:12 +07:00
parent 3b0dea6b52
commit 4c54ac272c
3 changed files with 5 additions and 88 deletions

View file

@ -48,4 +48,7 @@ export default {
/** struct-chart*/
orgStructChart: (id: string, type: string) =>
`${organization}/struct-chart/${id}/${type}`,
// ค้นหาคนตามเงื่อนไข
orgSearchPersonal: () => `${organization}/profile/search-personal`,
};

View file

@ -142,45 +142,6 @@ const visibleColumnsRespondent = ref<string[]>([
"organization",
]);
/**
* เพมบคลากร
*/
function addEmployee() {
if (idCard.value.length === 13) {
showLoader();
http
.post(config.API.profileSearchPersonal(), {
fieldName: "idcard",
keyword: idCard.value,
})
.then((res) => {
const dataApi = res.data.result;
if (dataApi.length > 0) {
const dataList = dataApi[0];
formData.prefix = dataList.prefix;
formData.firstname = dataList.firstName;
formData.lastname = dataList.lastName;
formData.position = dataList.position;
formData.phone = dataList.phone;
formData.email = dataList.email;
} else {
dialogMessageNotify($q, "ไม่มีข้อมูลบุคคลากรที่ต้องการค้นหา");
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
}
if (idCard.value.length !== 13) {
hideLoader();
dialogMessageNotify($q, "กรุณากรอกเลขประจำตัวประชาชนให้ครบ 13 หลัก");
} else {
}
}
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
function onValidate() {
const hasError = [];
@ -219,7 +180,7 @@ async function searchInput() {
keyword: search.value,
};
await http
.post(config.API.searchPersonal(), body)
.post(config.API.orgSearchPersonal(), body)
.then((res) => {
const data = res.data.result;
const list = data.map((e: ResponsePreson) => ({

View file

@ -145,53 +145,6 @@ watch(props.data, async () => {
formData.email = props.data.email;
});
/**
* เพมบคลากร
*/
function addEmployee() {
showLoader();
const idCardNew = idCard.value.replace(/-/g, "");
if (idCardNew.length === 13) {
http
.post(config.API.profileSearchPersonal(), {
fieldName: "idcard",
keyword: idCardNew,
})
.then((res) => {
console.log(res);
const dataApi = res.data.result;
if (dataApi.length > 0) {
const dataList = dataApi[0];
formData.personalId = dataList.personId;
formData.prefix = dataList.prefix;
formData.firstname = dataList.firstName;
formData.lastname = dataList.lastName;
formData.position = dataList.position;
formData.phone = dataList.phone;
formData.email = dataList.email;
} else {
dialogMessageNotify($q, "ไม่มีข้อมูลบุคคลากรที่ต้องการค้นหา");
formData.personalId = "";
formData.prefix = "";
formData.firstname = "";
formData.lastname = "";
formData.position = "";
formData.phone = "";
formData.email = "";
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
} else {
dialogMessageNotify($q, "กรุณากรอกเลขประจำตัวประชาชนให้ครบ 13 หลัก");
hideLoader();
}
}
/**
* ตรวจสอบขอมลกอนสงไปย api
*/
@ -250,7 +203,7 @@ async function searchInput() {
keyword: search.value,
};
await http
.post(config.API.searchPersonal(), body)
.post(config.API.orgSearchPersonal(), body)
.then((res) => {
const data = res.data.result;
const list = data.map((e: ResponsePreson) => ({