เพิ่ม filter ตามตำแหน่งที่สอบ บรรจุ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-26 12:11:19 +07:00
parent b4a4d8c641
commit 7886d258ff
3 changed files with 155 additions and 126 deletions

View file

@ -14,6 +14,7 @@ import avatar from "@/assets/avatar_user.jpg";
import type { PartialTableName } from "@/modules/05_placement/interface/request/placement";
import type { QTableProps } from "quasar";
import type { DataList } from "@/modules/05_placement/interface/response/SelectOrg";
import type { optionData } from "@/modules/05_placement/interface/index/Main";
import DialogSelectOrg from "@/modules/05_placement/components/PersonalList/DialogSelectOrg.vue";
import Table from "@/modules/05_placement/components/PersonalList/TableView.vue";
@ -96,6 +97,8 @@ const dataInfo = reactive({
reliefDoc: "",
});
const positionCandidateData = ref<optionData[]>([{ id: "", name: "ทั้งหมด" }]);
const examId = route.params.examId;
const examIdString = Array.isArray(examId) ? examId[0] : examId;
const personalId = ref<string>("");
@ -167,6 +170,9 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return `${row.root} (${row.rootShortName}) ${row.nodeName} (${row.nodeShortName}${row.posMasterNo}) `;
},
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
@ -261,25 +267,6 @@ function convertContainStatus(val: string) {
}
}
// /**
// *
// * @param val type
// */
// function convertTypeCommand(val: string) {
// switch (val) {
// case "APPOINTED":
// return "";
// case "APPOINT":
// return "/";
// // case "SLIP":
// // return "";
// // case "MOVE":
// // return "";
// default:
// return "";
// }
// }
/**
* แปลงสถานะการสงรายช
* @param val true/false
@ -295,9 +282,7 @@ function convertDraft(val: boolean) {
}
}
/**
* เรยกขอมลรายชอผสอบผาน
*/
/**เรียกข้อมูลรายชื่อผู้สอบผ่าน*/
async function getTable() {
showLoader();
await http
@ -387,14 +372,14 @@ async function getTable() {
rowsAll.value.push(rowData);
});
//
rows.value = await (roleAdmin.value
const rowData = await (roleAdmin.value
? rowsAll.value
: rowsAll.value.filter((x: any) => x.statusId !== "DONE"));
rowsAwait.value = await (roleAdmin.value
? rowsAll.value
: rowsAll.value.filter((x: any) => x.statusId !== "DONE"));
//
await filterpositionCandidate(rowData);
rows.value = rowData;
rowsAwait.value = rowData;
//
rowsFilter.value = await rows.value.filter(
@ -409,19 +394,36 @@ async function getTable() {
e.nodeName !== null &&
e.reportingDate !== null
);
DataStore.checkLoad(1);
await DataStore.checkLoad(1);
// insertAvatar(rows.value);
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(async () => {});
.finally(() => {
hideLoader();
});
}
/**
* นยนการผอนผ
*/
async function filterpositionCandidate(data: any) {
positionCandidateData.value = [{ id: "", name: "ทั้งหมด" }];
const newData = data
.map((e: any) => ({
id: e.positionCandidate,
name: e.positionCandidate,
}))
.filter((e: any) => e.id !== null && e.id !== 0);
//
const uniqueData = newData.filter(
(item: any, index: number, arr: any) =>
arr.findIndex((e: any) => e.id === item.id) === index
);
positionCandidateData.value.push(...uniqueData);
console.log(positionCandidateData.value);
}
/** ยืนยันการผ่อนผัน*/
async function saveDeferment() {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
@ -434,9 +436,7 @@ async function saveDeferment() {
}
});
}
/**
* post อนผ
*/
/** post ผ่อนผัน*/
async function postDeferment() {
showLoader();
const formData = new FormData();
@ -459,9 +459,7 @@ async function postDeferment() {
});
}
/**
* นยนการสละสทธ
*/
/** ยืนยันการสละสิทธิ์*/
async function saveDisclaim() {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
@ -475,9 +473,7 @@ async function saveDisclaim() {
});
}
/**
* post การสละสทธ
*/
/** post การสละสิทธิ์*/
async function postDisclaimf() {
showLoader();
const dataPost = {
@ -500,16 +496,12 @@ async function postDisclaimf() {
});
}
/**
* dialog
*/
/** เปิด dialog*/
function clickEditRow() {
editRow.value = true;
}
/**
* เปลยน class true/false
*/
/** เปลี่ยน class true/false*/
function getClass(val: boolean) {
return {
"full-width inputgreen cursor-pointer ": val,
@ -595,18 +587,14 @@ function openAppointModal(pid: string, data: DataList) {
modalDialogSelectOrg.value = !modalDialogSelectOrg.value;
}
/**
* close dialog
*/
/** close dialog*/
async function clickCloseModalTree() {
await getTable();
appointModal.value = false;
props.statCard();
}
/**
* validate
*/
/** validate*/
async function validateData() {
checkValidate.value = true;
await myForm.value.validate().then((result: boolean) => {
@ -616,16 +604,12 @@ async function validateData() {
});
}
/**
* dialog
*/
/** ปิด dialog*/
function clickCloseSendModal() {
modaladdlist.value = false;
}
/**
* validate
*/
/** validate*/
async function clickClose() {
userNote.value = "";
if (editRow.value == true) {
@ -648,9 +632,7 @@ async function clickClose() {
}
}
/**
* นยนสงรายชอไปหนวยงาน
*/
/** ยืนยันส่งรายชื่อไปหน่วยงาน*/
function savelist() {
selected.value.map((e: any) => {
personal_selected.value.push(e.personalId);
@ -774,28 +756,30 @@ function openModalOrder(val: boolean) {
modalOrder.value = val;
}
function onUpdateNewRows(val: string) {
const data = rowsAwait.value;
if (val !== "") {
rows.value = data.filter((item: any) => {
if (val === "EXTERNAL") {
return item.bmaOfficerCheck === null;
} else if (val === "OFFICER") {
return item.bmaOfficerCheck === "OFFICER";
}
});
} else {
rows.value = data;
}
}
function onUpdateNewRows(type: string, pos: string) {
const data = onSearchDataTable(
filter.value,
rowsAwait.value,
columns.value ? columns.value : []
);
watch(containStatus, () => {
if (containStatus.value) {
rows.value = rowsAll.value.filter((x: any) => x.statusId == "DONE");
} else {
rows.value = rowsAll.value.filter((x: any) => x.statusId != "DONE");
}
});
rows.value = data.filter((item: any) => {
const isTypeMatch =
type === "OFFICER"
? item.bmaOfficerCheck === "OFFICER"
: type === "EXTERNAL"
? item.bmaOfficerCheck === null
: item.bmaOfficerCheck === "OFFICER" || item.bmaOfficerCheck === null;
const isPositionMatch = pos === "" || item.positionCandidate === pos;
const isStatusMatch = containStatus.value
? item.statusId === "DONE"
: item.statusId !== "";
return isTypeMatch && isPositionMatch && isStatusMatch;
});
}
async function getWorkFlow() {
showLoader();
@ -848,11 +832,11 @@ function onSearch() {
}
function onSearchAdd() {
rowsFilter.value = onSearchDataTable(
filterlistAdd.value,
rowsFilterData.value,
columns.value ? columns.value : []
);
// rowsFilter.value = onSearchDataTable(
// filterlistAdd.value,
// rowsFilterData.value,
// columns.value ? columns.value : []
// );
}
onMounted(async () => {
@ -881,6 +865,7 @@ onMounted(async () => {
:saveNoDraft="true"
:role-admin="roleAdmin"
:display-add="displayAdd"
:position-candidate-data="positionCandidateData"
row-key="fullname"
>
<template #columns="props">