diff --git a/src/api/05_placement/api.placement.ts b/src/api/05_placement/api.placement.ts index 7ea4e0ae7..f0588c167 100644 --- a/src/api/05_placement/api.placement.ts +++ b/src/api/05_placement/api.placement.ts @@ -93,6 +93,7 @@ export default { `${order}/order/attachment/file/${orderId}`, orderReady: (id: string) => `${order}/order/ready/${id}`, attachmentOrder: (orderId: string) => `${order}/order/attachment/${orderId}`, + searchOrderprofile: () => `${order}/order/search/profile/command`, //receive ระบบรับโอน receiveData: () => `${receive}`, diff --git a/src/modules/07_insignia/components/5_Borrow/Main.vue b/src/modules/07_insignia/components/5_Borrow/Main.vue index d97b20c90..f7d1b2ce9 100644 --- a/src/modules/07_insignia/components/5_Borrow/Main.vue +++ b/src/modules/07_insignia/components/5_Borrow/Main.vue @@ -381,7 +381,7 @@ const paginationLabel = (start: number, end: number, total: number) => { flat bordered class="col-12 q-my-md q-mt-sm rounded-borders" - v-if="loadView == tr" + v-if="loadView == true" > ([]); const modal = ref(false); const employeeClass = ref(""); -const typeKeyword = ref(""); -const Keyword = ref(""); -const positionKeyword = ref(""); const reportType = ref(""); const reportYear = ref(); const reportNo = ref(""); -const positionOps = ref([]); const columns = ref([ { name: "no", @@ -85,100 +81,52 @@ const clickOpenpopup = () => { let currentDate = new Date(); let currentYear = currentDate.getFullYear(); reportYear.value = currentYear; + rows.value = []; + reportNo.value = ""; } }; - -// const fecthPositionOfficer = async () => { -// await http -// .get(config.API.listPositionPathHistory) -// .then((res) => { -// let data = res.data.result.items; -// console.log(data); -// positionOps.value = data.map((e: any) => ({ id: e.id, name: e.name })); -// options.value = positionOps.value; -// }) -// .catch((err) => { -// messageError($q, err); -// }); -// }; -// const fetchPositionPerm = async () => { -// await http -// .get(config.API.listPositionEmployeePositionHistory) -// .then((res) => { -// let data = res.data.result.items; -// positionOps.value = data.map((e: any) => ({ id: e.id, name: e.name })); -// options.value = positionOps.value; -// }) -// .catch((err) => { -// messageError($q, err); -// }); -// }; - -const clickSearch = async (type: string) => { +const clickSearch = async () => { await myForm.value!.validate().then((result: boolean) => { if (result) { - console.log(reportType.value); - console.log(reportYear.value); - console.log(reportNo.value); - // showLoader(); - // let body = {}; - // if (typeKeyword.value === "no") { - // Object.assign(body, { - // posNo: Keyword.value, - // }); - // } else if (typeKeyword.value === "position") { - // Object.assign(body, { - // positionId: positionKeyword.value, - // }); - // } - // http - // .post(config.API.profileHistory(type), body) - // .then((res) => { - // let data = res.data.result; - // if (data.length !== 0) { - // rows.value = data.map((e: any) => ({ - // id: e.id, - // citizenId: e.citizenId, - // name: e.firstName + " " + e.lastName, - // posNo: e.posNo, - // position: e.position, - // date: date2Thai(e.date), - // })); - // } else { - // notifyError($q, "ไม่มีข้อมูลที่ต้องการค้นหา"); - // rows.value = []; - // } - // }) - // .catch((err) => { - // messageError($q, err); - // rows.value = []; - // }) - // .finally(() => { - // hideLoader(); - // }); + let body = { + commandTypeId: reportType.value, + year: reportYear.value, + posno: reportNo.value, + }; + // console.log(body); + showLoader(); + http + .post(config.API.searchOrderprofile(), body) + .then((res) => { + let data = res.data.result; + console.log(data); + + if (data.length !== 0) { + rows.value = data.map((e: any) => ({ + id: e.id, + citizenId: e.citizenId, + name: e.fullName, + posNo: e.posNo, + position: e.position, + })); + } else { + notifyError($q, "ไม่มีข้อมูลที่ต้องการค้นหา"); + rows.value = []; + } + }) + .catch((err) => { + messageError($q, err); + rows.value = []; + }) + .finally(() => { + hideLoader(); + }); } }); }; -// const options = ref([]); -// const filterFn = (val: string, update: any) => { -// if (val === "") { -// update(() => { -// options.value = OrderTypeOption.value; -// }); -// return; -// } else { -// update(() => { -// options.value = OrderTypeOption.value.filter( -// (e: any) => e.name.search(val) !== -1 -// ); -// }); -// } -// console.log(options.value); -// }; const clickRedirect = (id: string) => { router.push(`/registry/${id}`); }; - const paging = ref(true); const pagination = ref({ sortBy: "citizenId", @@ -302,7 +250,7 @@ const paginationLabel = (start: number, end: number, total: number) => { icon="mdi-magnify" label="ค้นหา" class="q-px-md" - @click="clickSearch(employeeClass)" + @click="clickSearch" />