diff --git a/src/modules/12_evaluatePersonal/components/Director/Form.vue b/src/modules/12_evaluatePersonal/components/Director/Form.vue index 9a7b64e7e..89565c6f4 100644 --- a/src/modules/12_evaluatePersonal/components/Director/Form.vue +++ b/src/modules/12_evaluatePersonal/components/Director/Form.vue @@ -14,6 +14,14 @@ import http from "@/plugins/http"; import config from "@/app.config"; import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue"; +const total = ref(0); +const totalList = ref(1); +const pagination = ref({ + sortBy: "createdAt", + descending: true, + page: 1, + rowsPerPage: 10, +}); const modalPersonal = ref(false); const personId = ref(""); const $q = useQuasar(); @@ -47,10 +55,10 @@ const emit = defineEmits(["formDataReturn"]); // const idCard = ref(""); const idCardRef = ref(null); -const type = ref("idcard"); +const type = ref("citizenId"); const search = ref(""); const typeOps = ref([ - { id: "idcard", name: "เลขประจำตัวประชาชน" }, + { id: "citizenId", name: "เลขประจำตัวประชาชน" }, { id: "firstname", name: "ชื่อ" }, { id: "lastname", name: "นามสกุล" }, ]); @@ -203,12 +211,21 @@ async function searchInput() { keyword: search.value, }; await http - .post(config.API.orgSearchPersonal(), body) + .post( + config.API.orgSearchPersonal() + + `?page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}`, + body + ) .then((res) => { - const data = res.data.result; + const data = res.data.result.data; + totalList.value = Math.ceil( + res.data.result.total / pagination.value.rowsPerPage + ); + total.value = res.data.result.total; + const list = data.map((e: ResponsePreson) => ({ personId: e.id, - idcard: e.idcard, + idcard: e.citizenId, prefix: e.prefix, firstName: e.firstName, lastName: e.lastName, @@ -252,6 +269,17 @@ function onclickViewinfo(id: string) { function updatemodalPersonal(modal: boolean) { modalPersonal.value = modal; } +function updatePagination(newPagination: any) { + pagination.value.page = 1; + pagination.value.rowsPerPage = newPagination.rowsPerPage; +} + +watch( + () => pagination.value.rowsPerPage, + async () => { + await searchInput(); + } +);