From de115abc22c9144fb6a8c7e297fa79f76ad57504 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 25 Oct 2024 10:30:11 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20=E0=B9=81?= =?UTF-8?q?=E0=B8=95=E0=B9=88=E0=B8=87=E0=B8=95=E0=B8=B1=E0=B9=89=E0=B8=87?= =?UTF-8?q?=E0=B8=84=E0=B8=93=E0=B8=B0=E0=B8=81=E0=B8=A3=E0=B8=A3=E0=B8=A1?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=97=E0=B8=94=E0=B8=A5=E0=B8=AD?= =?UTF-8?q?=E0=B8=87=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../probation/FormAppoint/FormAppoint.vue | 96 +++++++++++-------- 1 file changed, 55 insertions(+), 41 deletions(-) diff --git a/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue b/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue index 91993d4c1..6b7b311cb 100644 --- a/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue +++ b/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue @@ -58,7 +58,7 @@ const pagination = ref({ const countRowLength = computed(() => { return selected.value.length + rows.value.length == 4 ? true - : selected.value.length == 3 + : selected.value.length == 2 ? true : false; }); @@ -66,7 +66,8 @@ const countRowLength = computed(() => { const optionsTypeMain = ref([]); const optionsType = ref([ { id: "chairman", value: "ประธาน" }, - { id: "committee", value: "กรรมการ" }, + { id: "committee", value: "ผู้บังคับบัญชา" }, + { id: "caregiver", value: "ผู้ดูแล" }, ]); const rowsDirector = ref([]); @@ -220,7 +221,7 @@ function onAddPerson() { position: item.position, positionType: item.posType, positionLevel: item.posLevel, - role: member.value == "chairman" ? "chairman" : "committee", + role: member.value, })); rows.value = [...rows.value, ...data]; rows.value.sort((a, b) => (a.role === "chairman" ? -1 : 1)); @@ -229,21 +230,24 @@ function onAddPerson() { async function getPerson() { showLoader(); - http - .post(config.API.orgProfileDirector + `?keyword=${filterKeyword.value}`, { + await http + .post(config.API.orgProfileDirector, { isDirector: isDirector.value, + pageSize: pagination.value.rowsPerPage, + page: pagination.value.page, + keyword: filterKeyword.value, }) - .then((res) => { - const data = res.data.result; + .then(async (res) => { + const data = await res.data.result.data; + const dataTotal = await res.data.result.total; + rowsDirector.value = data; rowsDirector.value = rowsDirector.value.filter( (item: MemBerType) => !rows.value.some((i: PersonsAppointData) => i.profileId == item.id) ); - totalList.value = Math.ceil( - res.data.result.total / pagination.value.rowsPerPage - ); - total.value = data.total; + totalList.value = Math.ceil(dataTotal / pagination.value.rowsPerPage); + total.value = dataTotal; hideLoader(); }) .catch((e) => { @@ -263,7 +267,9 @@ function convertText(val: string) { case "chairman": return "ประธาน"; case "committee": - return "กรรมการ"; + return "ผู้บังคับบัญชา"; + case "caregiver": + return "ผู้ดูแล"; default: "-"; } @@ -340,8 +346,8 @@ async function getData() { .finally(() => {}); } -function onDirector() { - getPerson(); +async function onDirector() { + await getPerson(); selected.value = []; } @@ -355,15 +361,17 @@ watch( if (modal.value) { optionsTypeMain.value = optionsType.value; const optionData = optionsType.value; - const committeeCount = rows.value.filter( - (i) => i.role === "committee" + const caregiverCount = rows.value.filter( + (i) => i.role === "caregiver" ).length; optionsTypeMain.value = optionData.filter( (item: OpfillterTypeSt) => !rows.value.some( - (i) => i.role === "chairman" && item.id === "chairman" - ) && !(item.id === "committee" && committeeCount >= 3) + (i) => + (i.role === "chairman" && item.id === "chairman") || + (i.role === "committee" && item.id === "committee") + ) && !(item.id === "caregiver" && caregiverCount >= 2) ); getPerson(); @@ -531,31 +539,17 @@ onMounted(async () => {
- - แสดงเฉพาะผู้อำนวยการ/หัวหน้า -
- - + แสดงเฉพาะผู้อำนวยการ/หัวหน้า + { bordered :paging="true" dense - :selection="member == 'chairman' ? 'single' : 'multiple'" + :selection=" + member == 'chairman' || member == 'committee' + ? 'single' + : 'multiple' + " v-model:selected="selected" :rows-per-page-options="[1, 25, 50, 100]" @update:pagination="updatePagination" @@ -670,6 +668,22 @@ onMounted(async () => {
+
+ {{ member }} + + +