From 710e9fe7b354a0e80e86b462daf4e90d3fa64414 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 25 Feb 2026 10:42:46 +0700 Subject: [PATCH] fix: getColumnLabel label posNo --- src/components/Workflow/DialogSelectPerson.vue | 16 +++++----------- .../05_leave/components/FormLeave/Form.vue | 3 ++- src/utils/functions.ts | 13 +++++++++++++ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/components/Workflow/DialogSelectPerson.vue b/src/components/Workflow/DialogSelectPerson.vue index d2fc964..27a359b 100644 --- a/src/components/Workflow/DialogSelectPerson.vue +++ b/src/components/Workflow/DialogSelectPerson.vue @@ -3,6 +3,7 @@ import { reactive, ref, watch, computed } from "vue"; import { useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; +import { getColumnLabel } from "@/utils/functions"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -29,7 +30,7 @@ const props = defineProps({ const rejectName = computed(() => props.sysName && ["SYS_RESIGN", "SYS_RESIGN_EMP"].includes(props.sysName) ? "ยับยั้ง" - : "ไม่อนุมัติ" + : "ไม่อนุมัติ", ); /** table*/ @@ -66,15 +67,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 pagination = ref({ sortBy: "", @@ -240,7 +232,9 @@ watch(modal, (val) => { - {{ col.label }} + {{ + getColumnLabel(col, formDataQuery.isAct) + }} diff --git a/src/modules/05_leave/components/FormLeave/Form.vue b/src/modules/05_leave/components/FormLeave/Form.vue index f1824e8..d9c37f8 100644 --- a/src/modules/05_leave/components/FormLeave/Form.vue +++ b/src/modules/05_leave/components/FormLeave/Form.vue @@ -7,6 +7,7 @@ import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import { useLeaveStore } from "@/modules/05_leave/store"; import { useDataStore } from "@/stores/data"; +import { getColumnLabel } from "@/utils/functions"; import type { PropsTable } from "@/interface/PropsTable"; import type { DataCommander } from "@/modules/05_leave/interface/response/main"; @@ -401,7 +402,7 @@ function getSearch() { :key="col.name" :props="props" > - {{ col.label }} + {{ getColumnLabel(col, isAct) }} diff --git a/src/utils/functions.ts b/src/utils/functions.ts index 837f83d..c43aa95 100644 --- a/src/utils/functions.ts +++ b/src/utils/functions.ts @@ -8,3 +8,16 @@ export function calculateFiscalYear(date: Date) { const month = date.getMonth() + 1; return month >= 10 ? date.getFullYear() + 1 : date.getFullYear(); } + +/** + * คืนค่าชื่อคอลัมน์ตามเงื่อนไข + * @param col คอลัมน์ + * @param isAct สถานะรักษาการแทน + * @returns ชื่อคอลัมน์ + */ +export function getColumnLabel(col: any, isAct: boolean) { + if (col.name === "posNo" && isAct) { + return `${col.label} (รักษาการแทน)`; + } + return col.label; +}