แก้ ฟิลเตอร์

This commit is contained in:
setthawutttty 2024-12-23 16:22:36 +07:00
parent 2f1572bde0
commit f8d5fe7ba0
7 changed files with 94 additions and 98 deletions

View file

@ -113,6 +113,9 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
format: (val, row) => {
return `${row.root} (${row.rootShortName}) ${row.nodeName} (${row.nodeShortName}${row.posMasterNo})`;
},
},
{
name: "dateOfBirth",
@ -124,6 +127,9 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
format(val, row) {
return date2Thai(row.dateOfBirth);
},
},
{
name: "createdAt",
@ -136,6 +142,9 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
sortOrder: "da",
format(val, row) {
return date2Thai(row.createdAt);
},
},
{
name: "status",
@ -147,6 +156,9 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
format(val, row) {
return statusText(row.status);
},
},
]);
@ -545,9 +557,6 @@ onMounted(async () => {
</div>
</div>
</div>
<div v-else-if="col.name == 'status'">
{{ props.row.status ? statusText(props.row.status) : "-" }}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>

View file

@ -80,6 +80,15 @@ const columns = ref<QTableProps["columns"]>([
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return `${
row.firstName
? `${row.prefix ?? ""}${row.firstName ?? ""} ${
row.lastName ?? ""
}`
: "-"
}`;
},
},
{
name: "organizationName",
@ -89,6 +98,9 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val, row) => {
return `${row.root} (${row.rootShortName}) ${row.nodeName} (${row.nodeShortName}${row.posMasterNo})`;
},
},
{
name: "dateOfBirth",
@ -98,6 +110,9 @@ const columns = ref<QTableProps["columns"]>([
field: "dateOfBirth",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return date2Thai(row.dateOfBirth);
},
},
{
name: "typeCommand",
@ -125,6 +140,9 @@ const columns = ref<QTableProps["columns"]>([
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return date2Thai(row.createdAt);
},
},
{
name: "status",
@ -134,6 +152,9 @@ const columns = ref<QTableProps["columns"]>([
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return statusText(row.status);
},
},
]);
const visibleColumns = ref<string[]>([
@ -345,7 +366,7 @@ onMounted(async () => {
<d-table
:columns="columns"
:rows="rows"
row-key="citizenId"
row-key="id"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>
@ -487,27 +508,6 @@ onMounted(async () => {
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'fullname'">
{{
props.row.firstName
? `${props.row.prefix ?? ""}${
props.row.firstName ?? ""
} ${props.row.lastName ?? ""}`
: "-"
}}
</div>
<div v-else-if="col.name == 'status'">
{{ props.row.status ? statusText(props.row.status) : "-" }}
</div>
<div v-else-if="col.name == 'dateOfBirth'">
{{
props.row.dateOfBirth
? date2Thai(props.row.dateOfBirth)
: "-"
}}
</div>
<div v-else-if="col.name == 'organizationName'">
<div class="col-4">
@ -532,12 +532,6 @@ onMounted(async () => {
</div>
</div>
<div v-else-if="col.name == 'createdAt'">
{{
props.row.createdAt ? date2Thai(props.row.createdAt) : "-"
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>

View file

@ -95,6 +95,13 @@ const columns = ref<QTableProps["columns"]>([
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return `${
row.firstName
? `${row.prefix ?? ""}${row.firstName ?? ""} ${row.lastName ?? ""}`
: "-"
}`;
},
},
{
name: "organizationName",
@ -104,6 +111,9 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val, row) => {
return `${row.root} (${row.rootShortName}) ${row.nodeName} (${row.nodeShortName}${row.posMasterNo})`;
},
},
{
name: "dateOfBirth",
@ -113,6 +123,9 @@ const columns = ref<QTableProps["columns"]>([
field: "dateOfBirth",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return date2Thai(row.dateOfBirth);
},
},
{
name: "typeCommand",
@ -138,6 +151,9 @@ const columns = ref<QTableProps["columns"]>([
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return date2Thai(row.createdAt);
},
},
{
name: "status",
@ -147,6 +163,9 @@ const columns = ref<QTableProps["columns"]>([
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return statusText(row.status);
},
},
]);
@ -343,7 +362,7 @@ onMounted(async () => {
<d-table
:columns="columns"
:rows="rows"
row-key="citizenId"
row-key="id"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>
@ -460,26 +479,7 @@ onMounted(async () => {
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'fullname'">
{{
props.row.firstName
? `${props.row.prefix ?? ""}${
props.row.firstName ?? ""
} ${props.row.lastName ?? ""}`
: "-"
}}
</div>
<div v-else-if="col.name == 'status'">
{{ props.row.status ? statusText(props.row.status) : "-" }}
</div>
<div v-else-if="col.name == 'dateOfBirth'">
{{
props.row.dateOfBirth
? date2Thai(props.row.dateOfBirth)
: "-"
}}
</div>
<div v-else-if="col.name == 'organizationName'">
<div class="col-4">
<div class="text-weight-medium">
@ -502,11 +502,7 @@ onMounted(async () => {
</div>
</div>
</div>
<div v-else-if="col.name == 'createdAt'">
{{
props.row.createdAt ? date2Thai(props.row.createdAt) : "-"
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>