diff --git a/src/modules/04_registryPerson/views/listView.vue b/src/modules/04_registryPerson/views/listView.vue index 65227d649..c7b38a2a5 100644 --- a/src/modules/04_registryPerson/views/listView.vue +++ b/src/modules/04_registryPerson/views/listView.vue @@ -32,7 +32,6 @@ const { fetchStructureTree } = useStructureTree(); const { showLoader, hideLoader, messageError } = useCounterMixin(); const route = useRoute(); -const mode = ref<"table" | "card">("table"); //การแสดงผล const empType = ref("officer"); // officer / employee / perm const dataPersonMain = ref([]); //ข้อมูลรายการที่ค้นหาข้อมูลทะเบียนประวัติ const maxPage = ref(1); //จำนวนหน้า @@ -51,9 +50,7 @@ const nodeData = reactive({ node: null, }); -/** - * function เรียกข้อมูลตำแหน่งประเภท - */ +/** function เรียกข้อมูลตำแหน่งประเภท*/ function fetchType() { http .get(config.API.orgPosType) @@ -65,9 +62,7 @@ function fetchType() { }); } -/** - * function เรียกข้อมูลกลุ่มงาน - */ +/** function เรียกข้อมูลกลุ่มงาน*/ function fetchOptionGroup() { http .get(config.API.orgEmployeeType) @@ -79,9 +74,7 @@ function fetchOptionGroup() { }); } -/** - * function fetch รายชื่อข้อมูลทะเบียนประวัติ - */ +/** function fetch รายชื่อข้อมูลทะเบียนประวัติ*/ async function fetchDataPerson() { showLoader(); dataPersonMain.value = []; @@ -137,10 +130,11 @@ async function fetchDataPerson() { ) .then(async (res) => { const dataList = await res.data.result.data; + dataPersonMain.value = dataList; + maxPage.value = Math.ceil( res.data.result.total / store.formFilter.pageSize ); - dataPersonMain.value = dataList; total.value = res.data.result.total; isShowBtnFilter.value = true; if (dataList) { @@ -209,7 +203,6 @@ function onclickSearch() { */ function selectType() { empType.value = route.name == "registryNew" ? "officer" : "perm"; - if (empType.value !== "officer") { store.formFilter.isShowRetire = null; store.formFilter.isProbation = null; @@ -317,9 +310,7 @@ async function fetchTree() { } } -/** - * ค้นหาข้อมูลรายชื่อข้อมูลทะเบียนประวัติตามหน่วยงาน/ส่วนราชการ - */ +/** ค้นหาข้อมูลรายชื่อข้อมูลทะเบียนประวัติตามหน่วยงาน/ส่วนราชการ*/ function sendNode() { nodeData.node = store.formFilter.node; nodeData.nodeId = store.formFilter.nodeId; @@ -331,7 +322,6 @@ function sendNode() { /** * ฟังก์ชันเลือกหน่วยงาน/ส่วนราชการ * @param data ข้อมูลหน่วยงาน/ส่วนราชการที่ต้องการค้นหาร - * * เพื่อค้นหาข้อมูลตามหน่วยงาน/ส่วนราชการ */ function updateSelectedTreeMain(data: DataStructureTree) { @@ -354,14 +344,12 @@ watch(selectNode, () => { isLoad.value && hideLoader(); }); -/** - * hook เมื่อมีการเรียกใช้ Components - */ - +/** hook เมื่อมีการเรียกใช้ Components*/ function getSearch() { store.formFilter.page = 1; fetchDataPerson(); } + onMounted(async () => { await Promise.all([selectType(), fetchTree()]); });