Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2024-12-26 12:52:03 +07:00
commit a7d5af4600
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">

View file

@ -3,10 +3,9 @@ import { ref, useAttrs } from "vue";
import { QTooltip, useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import type {
PersonData,
optionData,
} from "@/modules/05_placement/interface/index/Main";
import type { PropType } from "vue";
import type { optionData } from "@/modules/05_placement/interface/index/Main";
const $q = useQuasar();
const attrs = ref<any>(useAttrs());
const paging = ref<boolean>(true);
@ -19,6 +18,10 @@ const bmaOfficerOption = ref<optionData[]>([
{ id: "OFFICER", name: "ขรก.กทม. สามัญ" },
{ id: "EXTERNAL", name: "บุคคลภายนอก" },
]);
const positionCandidate = ref<string>("");
const positionCandidateOptions = ref<optionData[]>([]);
const props = defineProps({
inputfilter: String,
inputvisible: Array,
@ -35,6 +38,10 @@ const props = defineProps({
type: Boolean,
defualt: false,
},
positionCandidateData: {
type: Array as PropType<optionData[]>,
defualt: [],
},
saveNoDraft: {
type: Boolean,
defualt: false,
@ -138,7 +145,7 @@ function paginationLabel(start: string, end: string, total: string) {
else return start + "-" + end + " ใน " + total;
}
/**
/**.value
* update าทนหา
* @param value string
*/
@ -157,12 +164,7 @@ function updateVisible(value: any) {
*/
function updateContain(value: any) {
emit("update:containfilter", value);
}
/** reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา */
function resetFilter() {
emit("update:inputfilter", "");
filterRef.value.focus();
onUpdateNewRows();
}
/** ส่งรายชื่อไปยังหน่วยงาน */
@ -177,27 +179,77 @@ function openModalOrder() {
/** ส่งรายชื่อไปยังหน่วยงาน */
function onUpdateNewRows() {
emit("update-newRows", bmaOfficer.value);
emit("update-newRows", bmaOfficer.value, positionCandidate.value);
}
/**
* งชนฟลเตอร input
* @param val input
* @param update Function quasar
*/
function filterSelector(val: string, update: Function) {
update(() => {
positionCandidateOptions.value =
props?.positionCandidateData?.filter(
(v: optionData) => v.name.indexOf(val) > -1
) || [];
});
}
</script>
<template>
<div class="q-px-md q-pb-md">
<div class="col-12 row q-py-sm">
<q-select
outlined
dense
v-model="bmaOfficer"
:options="bmaOfficerOption"
emit-value
map-options
option-value="id"
option-label="name"
label="สถานภาพ"
style="width: 200px"
@update:model-value="onUpdateNewRows"
>
</q-select>
<div class="row q-col-gutter-sm">
<q-select
outlined
dense
v-model="bmaOfficer"
:options="bmaOfficerOption"
emit-value
map-options
option-value="id"
option-label="name"
label="สถานภาพ"
:clearable="bmaOfficer !== ''"
style="width: 200px"
@update:model-value="onUpdateNewRows"
@clear="bmaOfficer = ''"
>
</q-select>
<q-select
outlined
dense
v-model="positionCandidate"
:options="positionCandidateOptions"
emit-value
map-options
option-value="id"
option-label="name"
label="ตำแหน่งที่สอบ"
style="width: 250px"
hide-selected
fill-input
use-input
:clearable="positionCandidate !== ''"
@clear="
(positionCandidate = ''),
(positionCandidateOptions = positionCandidateData || []),
onUpdateNewRows()
"
@update:model-value="onUpdateNewRows"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn
) "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
</div>
<div>
<q-btn
flat
@ -241,17 +293,9 @@ function onUpdateNewRows() {
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
@keydown.enter="onSearch"
@keydown.enter="onUpdateNewRows"
>
<template v-slot:append>
<q-icon name="search" />
<!-- <q-icon
v-if="inputfilter !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter"
/> -->
</template>
<template v-slot:append> </template>
</q-input>
<!-- แสดง table ใน คอลมน -->
<q-select

View file

@ -193,7 +193,7 @@ export const usePlacementDataStore = defineStore("placement", () => {
};
let count = 0; // ตัวแปรนับจำนวนค่าที่รับ
function checkLoad(val: number) {
async function checkLoad(val: number) {
count += val;
DataMainOrig.value.length == 0;
if (count >= 2) {