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

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-26 16:52:43 +07:00
parent ec57059dc3
commit 0e5e7ac5be
22 changed files with 194 additions and 72 deletions

View file

@ -64,10 +64,9 @@ const visibleColumnsHistory = ref<string[]>([
"ethnicity",
"religion",
"phone",
"createdFullName",
"createdAt",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columnsHistory = ref<QTableProps["columns"]>([
{
name: "citizenId",
@ -214,25 +213,25 @@ const columnsHistory = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "createdFullName",
name: "lastUpdateFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "createdFullName",
field: "lastUpdateFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "createdAt",
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
format: (v) => date2Thai(v, false, true),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},

View file

@ -94,6 +94,9 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const pagination = ref({
sortBy: "lastUpdatedAt",
});
const visibleColumnsHistory = ref<string[]>([
"prefix",
@ -309,6 +312,7 @@ onMounted(async () => {
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
:virtual-scroll-sticky-size-start="48"
v-model:pagination="pagination"
>
<template v-slot:header="props">
<q-tr :props="props">

View file

@ -211,7 +211,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
field: "lastUpdatedAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
format: (v) => date2Thai(v, false, true),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
@ -267,7 +267,7 @@ function getHistory() {
.then((res) => {
const data = res.data.result;
rowsHistory.value = data;
console.log("🚀 ~ .then ~ data:", data)
console.log("🚀 ~ .then ~ data:", data);
rowsHistoryData.value = data;
})
.catch((e) => {

View file

@ -15,7 +15,7 @@ import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const link = ref<string>("");
const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const idFamily = ref<string>("");
const store = useRegistryInFormationStore();
@ -67,6 +67,8 @@ const visibleColumnsHistory = ref<string[]>([
"job",
"isLive",
"lastNameOld",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columnsHistory = ref<QTableProps["columns"]>([
{
@ -134,6 +136,29 @@ const columnsHistory = ref<QTableProps["columns"]>([
style: "font-size: 14px",
format: (val) => (val ? "มีชีวิต" : "ถึงแก่กรรม"),
},
{
name: "lastUpdateFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "lastUpdateFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
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 checkFatherData = ref<boolean>(false);
@ -202,6 +227,8 @@ async function getData(type: string) {
/** get history */
function getHistory() {
rowsHistory.value = [];
rowsHistoryData.value = [];
const url =
dataStore.officerType == "OFFICER"
? config.API.dataUserFamilyHistory(typeForm.value, "", idFamily.value)
@ -216,8 +243,8 @@ function getHistory() {
.get(url)
.then((res) => {
const data = res.data.result;
const listData =
data.map((e: any) => ({
const listData = data.map((e: any) => ({
...e,
citizenId: e[`${typeForm.value}CitizenId`],
prefix: e[`${typeForm.value}Prefix`],
firstName: e[`${typeForm.value}FirstName`],
@ -227,8 +254,8 @@ function getHistory() {
lastNameOld:
typeForm.value === "couple" ? e.coupleLastNameOld : undefined,
}));
rowsHistory.value = listData
rowsHistoryData.value = listData
rowsHistory.value = listData;
rowsHistoryData.value = listData;
})
.catch((e) => {
messageError($q, e);

View file

@ -49,7 +49,6 @@ const visibleColumns = ref<string[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "educationLevel",
@ -237,13 +236,16 @@ const columns = ref<QTableProps["columns"]>([
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
format: (v) => date2Thai(v),
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 pagination = ref({
sortBy: "lastUpdatedAt",
});
const columnsHistory = ref<QTableProps["columns"]>([
{
@ -434,14 +436,13 @@ const columnsHistory = ref<QTableProps["columns"]>([
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
format: (v) => date2Thai(v),
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 visibleColumnsHistory = ref<string[]>([
"educationLevel",
"institute",
@ -569,6 +570,7 @@ onMounted(async () => {
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
:virtual-scroll-sticky-size-start="48"
v-model:pagination="pagination"
>
<template v-slot:header="props">
<q-tr :props="props">
@ -589,7 +591,7 @@ onMounted(async () => {
{{ props.row.status ? props.row.status : "-" }}
</div>
<div v-else>
{{ col.value ? col.value:'-' }}
{{ col.value ? col.value : "-" }}
</div>
</q-td>
<q-td auto-width>

View file

@ -36,7 +36,6 @@ const visibleColumns = ref<string[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "field",
@ -99,13 +98,16 @@ const columns = ref<QTableProps["columns"]>([
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
format: (v) => date2Thai(v),
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 pagination = ref({
sortBy: "lastUpdatedAt",
});
const visibleColumnsHistory = ref<string[]>([
"field",
@ -177,7 +179,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
format: (v) => date2Thai(v),
format: (v) => date2Thai(v, false, true),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
@ -290,6 +292,7 @@ onMounted(async () => {
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
:virtual-scroll-sticky-size-start="48"
v-model:pagination="pagination"
>
<template v-slot:header="props">
<q-tr :props="props">