ข้อมูลทะเบียนประวัติ => ปรับ filter
This commit is contained in:
parent
2c924d24d5
commit
3800da7166
1 changed files with 73 additions and 33 deletions
|
|
@ -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<FormFilter>({
|
|||
isProbation: false,
|
||||
});
|
||||
const maxPage = ref<number>(1);
|
||||
const total = ref<number>(0);
|
||||
|
||||
const dataPersonMain = ref<DataPerson[]>([]);
|
||||
|
||||
|
|
@ -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<number>(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 () => {
|
|||
</q-btn-dropdown>
|
||||
|
||||
<q-separator inset vertical class="lineFil" />
|
||||
|
||||
<q-btn-dropdown
|
||||
flat
|
||||
dense
|
||||
|
|
@ -433,6 +472,7 @@ onMounted(async () => {
|
|||
label-color="white"
|
||||
dropdown-icon="mdi-chevron-down"
|
||||
class="q-px-sm"
|
||||
:disable="labelOption.posType === 'ทั้งหมด' ? true : false"
|
||||
>
|
||||
<template v-slot:label>
|
||||
{{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue