diff --git a/src/modules/04_registryNew/views/list.vue b/src/modules/04_registryNew/views/list.vue index 55c2414ff..ffe34aa99 100644 --- a/src/modules/04_registryNew/views/list.vue +++ b/src/modules/04_registryNew/views/list.vue @@ -6,7 +6,10 @@ import config from "@/app.config"; /** importType*/ import type { DataOption } from "@/modules/04_registryNew/interface/index/Main"; -import type { DataPerson } from "@/modules/04_registryNew/interface/response/Main"; +import type { + DataPerson, + DataType, +} from "@/modules/04_registryNew/interface/response/Main"; import type { FormFilter } from "@/modules/04_registryNew/interface/request/Main"; /** importComponents*/ @@ -47,6 +50,7 @@ const formFilter = reactive({ isProbation: false, }); const maxPage = ref(1); +const total = ref(0); const dataPersonMain = ref([]); @@ -61,7 +65,9 @@ const conditionTotal = computed(() => { return num; }); -/** function เรียกข้อมูลตำแหน่งประเภท*/ +/** + * function เรียกข้อมูลตำแหน่งประเภท + */ function fetchType() { http .get(config.API.orgPosType) @@ -74,17 +80,20 @@ function fetchType() { } /** function เรียกข้อมูลระดับ*/ -function fetchLevel() { - http - .get(config.API.orgPosLevel) - .then((res) => { - store.fetchLevel(res.data.result); - }) - .catch((err) => { - messageError($q, err); - }); -} +// function fetchLevel() { +// http +// .get(config.API.orgPosLevel) +// .then((res) => { +// store.fetchLevel(res.data.result); +// }) +// .catch((err) => { +// messageError($q, err); +// }); +// } +/** + * function เรียกข้อมูลกลุ่มงาน + */ function fetchOptionGroup() { http .get(config.API.orgEmployeeType) @@ -96,16 +105,16 @@ function fetchOptionGroup() { }); } -function fetchLevelGroup() { - http - .get(config.API.orgEmployeelevel) - .then((res) => { - store.fetchLevel(res.data.result); - }) - .catch((err) => { - messageError($q, err); - }); -} +// function fetchLevelGroup() { +// http +// .get(config.API.orgEmployeelevel) +// .then((res) => { +// store.fetchLevel(res.data.result); +// }) +// .catch((err) => { +// messageError($q, err); +// }); +// } function fetchYearOption() { if (store.yearOps.length === 0) { @@ -121,16 +130,17 @@ function fetchYearOption() { } } -const total = ref(0); -async function fetchDataPerson(search: boolean = false) { +/** + * function fetch รายชื่อข้อมูลทะเบียนประวัติ + */ +function fetchDataPerson() { showLoader(); - let queryParams: any = { page: formFilter.page, pageSize: formFilter.pageSize, }; - if (search) { + if (formFilter.keyword) { queryParams = Object.assign({}, queryParams, { searchField: searchType.value, searchKeyword: formFilter.keyword, @@ -180,6 +190,10 @@ async function fetchDataPerson(search: boolean = false) { }); } +/** + * function fetch รูปโปรไฟล์ + * @param items ข้อมูลคน + */ function insertAvatar(items: DataPerson[]) { items.map((x: any, index: number) => { if (x.avatarName != null) { @@ -208,29 +222,39 @@ function insertAvatar(items: DataPerson[]) { }); } +/** + * funciotn แสดงตัวเลือกเพิ่มเติม + */ function onClickShowFilter() { isShowFilter.value = !isShowFilter.value; isShowBtnFilter.value = false; if (isShowFilter.value) { fetchType(); - fetchLevel(); + // fetchLevel(); fetchYearOption(); } } +/** + * funciotn ค้นหาข้อมูล + */ function onclickSearch() { isShowFilter.value = true; isShowBtnFilter.value = false; formFilter.page = 1; if (isShowFilter.value) { fetchType(); - fetchLevel(); + // fetchLevel(); fetchYearOption(); } formFilter.keyword = formFilter.keyword === null ? "" : formFilter.keyword; - fetchDataPerson(true); + fetchDataPerson(); } +/** + * function เลือกประเภทข้าราชการ + * @param item ประเภทข้าราชการ + */ function selectType(item: DataOption) { labelOption.type = item.name; empType.value = item.id; @@ -242,30 +266,46 @@ function selectType(item: DataOption) { formFilter.isShowRetire = null; formFilter.isProbation = null; fetchOptionGroup(); - fetchLevelGroup(); + // fetchLevelGroup(); } else { fetchType(); - fetchLevel(); + // fetchLevel(); } - fetchDataPerson(true); + fetchDataPerson(); } +/** + * function เลือกประเภทตำแหน่ง + * @param item ประเภทตำแหน่ง + */ function selectPosType(item: DataOption) { + const dataType = store.posTypeMain.find((e: DataType) => e.id === item.id); + store.fetchLevel(dataType?.posLevels); labelOption.posType = item.name; + labelOption.posLevel = "ทั้งหมด"; formFilter.page = 1; fetchDataPerson(); } +/** + * function เลือกประเภทตำแหน่ง + * @param item ประเภทระดับ + */ function selectPosLevel(item: DataOption) { labelOption.posLevel = item.name; formFilter.page = 1; fetchDataPerson(); } +/** + * function เคลีย์ตัวเลือก + * @param t ประเภทตัวเลือก + */ function clearSelect(t: string) { if (t === "posType") { labelOption.posType = "ทั้งหมด"; + labelOption.posLevel = "ทั้งหมด"; } else if (t === "posLevel") { labelOption.posLevel = "ทั้งหมด"; } else if (t === "retireYear") { @@ -425,7 +465,6 @@ onMounted(async () => { - { label-color="white" dropdown-icon="mdi-chevron-down" class="q-px-sm" + :disable="labelOption.posType === 'ทั้งหมด' ? true : false" >