ทะเบียนประวัติ == > TableSort

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-25 15:27:01 +07:00
parent e47184c4d4
commit fd120a918f
35 changed files with 800 additions and 373 deletions

View file

@ -61,6 +61,8 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px; width: 50px;",
format: (v) => date2Thai(v),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "detail",
@ -73,11 +75,22 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
format: (v) => date2Thai(v, false, true),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>(["date", "detail"]);
const visibleColumns = ref<String[]>(["date", "detail", "lastUpdatedAt"]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
sortBy: "lastUpdatedAt",
});
/** fetch รายการข้อมูลอื่นๆ*/
@ -285,9 +298,7 @@ onMounted(() => {
flat
:card-container-class="mode === 'card' ? 'q-col-gutter-md' : ''"
:grid="mode === 'card'"
:paging="true"
:visible-columns="visibleColumns"
:rows-per-page-options="[10, 25, 50, 100]"
>
<template v-slot:header="props">
<q-tr :props="props">

View file

@ -42,6 +42,8 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px; width: 50px;",
format: (v) => date2Thai(v),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "detail",
@ -84,6 +86,9 @@ const visibleColumns = ref<String[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
const pagination = ref({
sortBy: "lastUpdatedAt",
});
/** ฟังก์ชันดึงข้อมูลประวัติการแก่ไขข้อมูล*/
function getHistory() {
@ -179,9 +184,8 @@ watch(modal, (status) => {
dense
:columns="columns"
:rows="rows"
:paging="true"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>
>
<template v-slot:header="props">