From 5cba196dd23e1eba9bd3c9b142f95fe3ad15da93 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Mon, 11 Sep 2023 13:27:49 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20=E0=B8=9F=E0=B8=B4=E0=B8=A5=E0=B9=80=E0=B8=95=E0=B8=AD?= =?UTF-8?q?=E0=B8=A3=E0=B9=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/probation/MainProbation.vue | 234 +++++++++++++++--- 1 file changed, 201 insertions(+), 33 deletions(-) diff --git a/src/modules/05_placement/components/probation/MainProbation.vue b/src/modules/05_placement/components/probation/MainProbation.vue index 458cb4532..68e75c611 100644 --- a/src/modules/05_placement/components/probation/MainProbation.vue +++ b/src/modules/05_placement/components/probation/MainProbation.vue @@ -169,6 +169,36 @@ const probationlist = ref([]); onMounted(async () => { getpersonalList(); }); +const fillter = ref(0); +const Opfillter = ref([{ id: 0, value: "ทั้งหมด" }]); +const fillterStatus = ref([]); +const ProbationMainFilter = () => { + const useStatus = new Set(); + fillterStatus.value.forEach((item: any) => { + const ID = item.probation_status; + const title = statusProbationMain(Number(item.probation_status)); + if (ID !== null && !useStatus.has(ID)) { + Opfillter.value.push({ + id: ID, + value: title, + }); + useStatus.add(ID); + } + }); + Opfillter.value.sort((a: any, b: any) => a.id - b.id); +}; +const dataUpdate = ref([]); +const updateRows = (body: any) => { + console.log(body.value); + if (body.value !== "ทั้งหมด") { + const filteredRows = dataUpdate.value.filter( + (item: any) => item.probation_status === body.value + ); + rows.value = filteredRows; + } else { + rows.value = dataUpdate.value; + } +}; const getpersonalList = async () => { showLoader(); @@ -176,6 +206,11 @@ const getpersonalList = async () => { .get(config.API.probationPersonalList()) .then((res) => { const data = res.data.data; + fillterStatus.value = data; + console.log( + "🚀 ~ file: MainProbation.vue:193 ~ .then ~ fillterStatus:", + fillterStatus + ); rows.value = data.map((item: FormMainProbation) => ({ personal_id: item.personal_id, name: item.name, @@ -188,8 +223,10 @@ const getpersonalList = async () => { order_number: item.order_number, probation_status: statusProbationMain(Number(item.probation_status)), })); + dataUpdate.value = rows.value; + ProbationMainFilter(); }) - .catch(() => { }) + .catch(() => {}) .finally(() => { hideLoader(); }); @@ -208,7 +245,7 @@ const fecthlistPersonal = async () => { .catch((e) => { messageError($q, e); }) - .finally(() => { }); + .finally(() => {}); }; const fecthlistProbation = async (id: string, data: any) => { try { @@ -226,6 +263,7 @@ const fecthlistProbation = async (id: string, data: any) => { hideLoader(); } }; + const findlist = async (id: string) => { let data = [ { criteriaType: "is_retire", criteriaValue: "false" }, @@ -354,29 +392,92 @@ const paginationLabel2 = (start: string, end: string, total: string) => {
-
- - เพิ่มผู้ทดลองปฏิบัติหน้าที่ราชการ - +
+
+ + + เพิ่มผู้ทดลองปฏิบัติหน้าที่ราชการ + +
- - + - +
- +
@@ -446,23 +558,55 @@ const paginationLabel2 = (start: string, end: string, total: string) => { - + - +
- +