diff --git a/src/modules/05_placement/components/probation/MainProbation.vue b/src/modules/05_placement/components/probation/MainProbation.vue index 356301b9a..45638a2ee 100644 --- a/src/modules/05_placement/components/probation/MainProbation.vue +++ b/src/modules/05_placement/components/probation/MainProbation.vue @@ -34,13 +34,11 @@ const paging = ref(true); const filterRef2 = ref(null); const attrs = ref(useAttrs()); const paging2 = ref(true); -const fillterStatus = ref([]); const fillter = ref(""); const filterKeyword = ref(""); const filterKeyword2 = ref(""); const rows = ref([]); const rows2 = ref([]); -const dataUpdate = ref([]); const Opfillter = ref([]); const Opfillter2 = ref([]); const formProbation = reactive({ keyword: "", pageSize: 10, page: 1 }); @@ -239,22 +237,22 @@ const columns2 = ref([ /** get ข้อมูล */ async function getpersonalList() { + rows.value = []; showLoader(); await http .get( config.API.probationPersonalList() + - `?status=${fillter.value}&page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}` + `?status=${fillter.value}&page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}&keyword=${filterKeyword.value}` ) - .then(async (res) => { - const data = await res.data.data.data; - const resTotal = await res.data.data.total; - rows.value = data; - fillterStatus.value = data; - dataUpdate.value = rows.value; + .then((res) => { + rows.value = res.data.data.data; Opfillter.value = storeFn.optionStatusProbation; Opfillter2.value = storeFn.optionStatusProbation; - totalList.value = Math.ceil(resTotal / pagination.value.rowsPerPage); - total.value = resTotal; + + totalList.value = Math.ceil( + res.data.data.total / pagination.value.rowsPerPage + ); + total.value = res.data.data.total; hideLoader(); }) .catch((e) => { @@ -376,11 +374,6 @@ function resetFilter2() { filterRef2.value.focus(); } -function paginationLabel(start: string, end: string, total: string) { - if (paging.value == true) return " " + start + "-" + end + " ใน " + total; - else return start + "-" + end + " ใน " + total; -} - function paginationLabel2(start: string, end: string, total: string) { if (paging2.value == true) return " " + start + "-" + end + " ใน " + total; else return start + "-" + end + " ใน " + total; @@ -448,14 +441,14 @@ function closeAdd() { topic.value = "แต่งตั้งคณะกรรมการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ"; } -watch([() => formProbation.page, () => formProbation.pageSize], () => { - onclickAddProbation(); -}); - +function getSearch() { + pagination.value.page = 1; + getpersonalList(); +} watch( () => pagination.value.rowsPerPage, - async () => { - await getpersonalList(); + () => { + getSearch(); } ); @@ -537,6 +530,7 @@ onMounted(async () => { outlined debounce="300" placeholder="ค้นหา" + @keydown.enter.prevent="getSearch" >