fix: getColumnLabel posNo

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-02-25 10:36:53 +07:00
parent 7543a40967
commit d457a7694e
8 changed files with 65 additions and 98 deletions

View file

@ -184,7 +184,7 @@ const columns = ref<QTableProps["columns"]>([
},
]);
const columnsMember = ref<QTableProps["columns"]>([
const baseColumnsMember = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
@ -236,17 +236,20 @@ const columnsMember = ref<QTableProps["columns"]>([
}`;
},
},
{
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"
>
<template v-slot:pagination="scope">
งหมด {{ total.toLocaleString() }} รายการ
<q-pagination
v-model="pagination.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="getPerson()"
></q-pagination>
</template>
<template v-slot:header-selection="scope"> </template>
<template v-slot:body="props">
<q-tr :props="props">
<td class="text-center">
@ -780,6 +765,21 @@ onMounted(async () => {
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ total.toLocaleString() }} รายการ
<q-pagination
v-model="pagination.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="getPerson()"
></q-pagination>
</template>
</d-table>
</div>
</div>

View file

@ -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<QTableProps["columns"]>([
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"
>
<span class="text-weight-medium">{{ col.label }}</span>
<span class="text-weight-medium">
{{ getColumnLabel(col, isAct) }}</span
>
</q-th>
</q-tr>
</template>