From d457a7694ee046f0821217d87dddccc3df3bd0ae Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 25 Feb 2026 10:36:53 +0700 Subject: [PATCH] fix: getColumnLabel posNo --- .../Workflow/DialogSelectPerson.vue | 14 ++--- .../probation/FormAppoint/FormAppoint.vue | 60 +++++++++---------- .../FormEvaluation/DialogSelectAuthority.vue | 15 ++--- .../components/DialogAddCommander.vue | 15 ++--- .../05_Leave/Dialog/DialogAddCommander.vue | 19 ++---- .../components/Step/Dialog1_AddOperetor.vue | 12 +--- .../components/Step/View0_Digital.vue | 15 ++--- src/utils/function.ts | 13 ++++ 8 files changed, 65 insertions(+), 98 deletions(-) diff --git a/src/components/Workflow/DialogSelectPerson.vue b/src/components/Workflow/DialogSelectPerson.vue index c262ae89c..f3a0dd922 100644 --- a/src/components/Workflow/DialogSelectPerson.vue +++ b/src/components/Workflow/DialogSelectPerson.vue @@ -5,6 +5,7 @@ import { useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; +import { getColumnLabel } from "@/utils/function"; import type { QTableProps } from "quasar"; @@ -65,15 +66,6 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, - { - name: "actFullName", - align: "left", - label: "รักษาการแทน", - field: "actFullName", - sortable: true, - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, ]); const total = ref(0); @@ -258,7 +250,9 @@ watch(modal, (val) => { - {{ col.label }} + + {{ getColumnLabel(col, isAct) }} + diff --git a/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue b/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue index d64ccb033..08de2bb3a 100644 --- a/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue +++ b/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue @@ -184,7 +184,7 @@ const columns = ref([ }, ]); -const columnsMember = ref([ +const baseColumnsMember = ref([ { name: "no", align: "left", @@ -236,17 +236,20 @@ const columnsMember = ref([ }`; }, }, - { - name: "actFullName", - align: "left", - label: "รักษาการแทน", - sortable: true, - field: "actFullName", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, ]); +const columnsMember = computed(() => { + if (isAct.value) { + const actColumns = JSON.parse(JSON.stringify(baseColumnsMember.value)); + const posNoCol = actColumns.find((col: any) => col.name === "posNo"); + if (posNoCol) { + posNoCol.label = "เลขที่ตำแหน่ง (รักษาการแทน)"; + } + return actColumns; + } + return baseColumnsMember.value; +}); + /** เพิ่ม คณะกรรมการ */ function onAdd() { modal.value = true; @@ -315,11 +318,6 @@ async function getPerson() { .then(async (res) => { const data = await res.data.result.data; const dataTotal = await res.data.result.total; - - // rowsDirector.value = data.filter( - // (item: MemBerType, index: number, self: any[]) => - // index === self.findIndex((t: any) => t.id === item.id) - // ); rowsDirector.value = data.filter( (item: MemBerType) => !rows.value.some((i: PersonsAppointData) => i.profileId == item.id) @@ -443,6 +441,7 @@ async function onDirector() { await getPerson(); selected.value = []; } + async function onAct() { pagination.value.page = 1; isDirector.value = false; @@ -725,22 +724,8 @@ onMounted(async () => { :rows-per-page-options="[10, 25, 50, 100]" @update:pagination="updatePagination" > - - + + + diff --git a/src/modules/05_placement/components/probation/FormEvaluation/DialogSelectAuthority.vue b/src/modules/05_placement/components/probation/FormEvaluation/DialogSelectAuthority.vue index 64791591d..f0d1cb636 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/DialogSelectAuthority.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/DialogSelectAuthority.vue @@ -6,6 +6,7 @@ import { useRoute } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; +import { getColumnLabel } from "@/utils/function"; import type { QTableProps } from "quasar"; @@ -83,16 +84,6 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, - - { - name: "actFullName", - align: "left", - label: "รักษาการแทน", - sortable: true, - field: "actFullName", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, ]); function onCloseDialog() { @@ -232,7 +223,9 @@ watch(modal, (val) => { :key="col.name" :props="props" > - {{ col.label }} + + {{ getColumnLabel(col, isAct) }} diff --git a/src/modules/06_retirement/components/DialogAddCommander.vue b/src/modules/06_retirement/components/DialogAddCommander.vue index ce753a5ac..f988f3345 100644 --- a/src/modules/06_retirement/components/DialogAddCommander.vue +++ b/src/modules/06_retirement/components/DialogAddCommander.vue @@ -4,7 +4,7 @@ import { useQuasar, type QTableProps } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; - +import { getColumnLabel } from "@/utils/function"; import { useCounterMixin } from "@/stores/mixin"; import DialogHeader from "@/components/DialogHeader.vue"; @@ -78,15 +78,6 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, - { - name: "actFullName", - align: "left", - label: "รักษาการแทน", - field: "actFullName", - sortable: true, - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, ]); function onSearchData() { @@ -315,7 +306,9 @@ watch( :key="col.name" :props="props" > - {{ col.label }} + {{ + getColumnLabel(col, isAct) + }} diff --git a/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue b/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue index 42bb546f4..1382174e9 100644 --- a/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue +++ b/src/modules/09_leave/components/05_Leave/Dialog/DialogAddCommander.vue @@ -4,7 +4,7 @@ import { useQuasar, type QTableProps } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; - +import { getColumnLabel } from "@/utils/function"; import { useCounterMixin } from "@/stores/mixin"; import DialogHeader from "@/components/DialogHeader.vue"; @@ -81,15 +81,6 @@ const columns = ref([ }, style: "font-size: 14px", }, - { - name: "actFullName", - align: "left", - label: "รักษาการแทน", - field: "actFullName", - sortable: true, - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, ]); function onSearchData() { @@ -107,10 +98,6 @@ function getSearch() { } async function getData() { - // const url = - // props.type == "COMMANDER" - // ? config.API.workflowCommanderOperate - // : config.API.workflowCommanderSign; showLoader(); await http .put(config.API.workflowCommanderOperate, { @@ -324,7 +311,9 @@ watch( :key="col.name" :props="props" > - {{ col.label }} + {{ + getColumnLabel(col, isAct) + }} diff --git a/src/modules/18_command/components/Step/Dialog1_AddOperetor.vue b/src/modules/18_command/components/Step/Dialog1_AddOperetor.vue index 71ce96260..07dda6246 100644 --- a/src/modules/18_command/components/Step/Dialog1_AddOperetor.vue +++ b/src/modules/18_command/components/Step/Dialog1_AddOperetor.vue @@ -4,6 +4,7 @@ import { useQuasar, type QTableProps } from "quasar"; import { usePagination } from "@/composables/usePagination"; import { useCounterMixin } from "@/stores/mixin"; +import { getColumnLabel } from "@/utils/function"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -64,15 +65,6 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, - { - name: "actFullName", - align: "left", - label: "รักษาการแทน", - field: "actFullName", - sortable: true, - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, ]); const roleName = ref(""); @@ -282,7 +274,7 @@ watch(modal, (newVal) => { :key="col.name" :props="props" > - {{ col.label }} + {{ getColumnLabel(col, isAct) }} diff --git a/src/modules/18_command/components/Step/View0_Digital.vue b/src/modules/18_command/components/Step/View0_Digital.vue index fbff4569c..42e00356f 100644 --- a/src/modules/18_command/components/Step/View0_Digital.vue +++ b/src/modules/18_command/components/Step/View0_Digital.vue @@ -7,6 +7,7 @@ import { useRoute, useRouter } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useCommandDetail } from "@/modules/18_command/store/DetailStore"; import { usePagination } from "@/composables/usePagination"; +import { getColumnLabel } from "@/utils/function"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -111,16 +112,6 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, - - { - name: "actFullName", - align: "left", - label: "รักษาการแทน", - sortable: true, - field: "actFullName", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, ]); //รอผู้มีอำนาจลงนามอนุมัติ @@ -776,7 +767,9 @@ onMounted(async () => { :key="col.name" :props="props" > - {{ col.label }} + {{ + getColumnLabel(col, isAct) + }} diff --git a/src/utils/function.ts b/src/utils/function.ts index d24194346..013ea7ad0 100644 --- a/src/utils/function.ts +++ b/src/utils/function.ts @@ -60,3 +60,16 @@ export function calculateAge(birthDate: Date | null) { return `${years} ปี ${months} เดือน ${days} วัน`; } + +/** + * คืนค่าชื่อคอลัมน์ตามเงื่อนไข + * @param col คอลัมน์ + * @param isAct สถานะรักษาการแทน + * @returns ชื่อคอลัมน์ + */ +export function getColumnLabel(col: any, isAct: boolean) { + if (col.name === "posNo" && isAct) { + return "เลขที่ตำแหน่ง (รักษาการแทน)"; + } + return col.label; +}