From b7ed1e659f64a4d2b7f2d7cf3531cc9c649e06ac Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 25 Feb 2025 16:46:42 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=A2=E0=B8=B7=E0=B8=A1-=E0=B8=84=E0=B8=B7?= =?UTF-8?q?=E0=B8=99=E0=B9=80=E0=B8=84=E0=B8=A3=E0=B8=B7=E0=B9=88=E0=B8=AD?= =?UTF-8?q?=E0=B8=87=E0=B8=A3=E0=B8=B2=E0=B8=8A=E0=B8=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/DialogHistoryPos.vue | 29 ++++++++++-- src/modules/07_insignia/storeBrrow.ts | 47 ++++++++++--------- 2 files changed, 51 insertions(+), 25 deletions(-) diff --git a/src/modules/02_organization/components/DialogHistoryPos.vue b/src/modules/02_organization/components/DialogHistoryPos.vue index 675956f26..b0fb0fc32 100644 --- a/src/modules/02_organization/components/DialogHistoryPos.vue +++ b/src/modules/02_organization/components/DialogHistoryPos.vue @@ -55,6 +55,8 @@ const columns = ref([ field: "fullname", headerStyle: "font-size: 14px", style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { name: "orgShortName", @@ -64,6 +66,8 @@ const columns = ref([ field: "orgShortName", headerStyle: "font-size: 14px", style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { name: "posMasterNoPrefix", @@ -73,6 +77,8 @@ const columns = ref([ field: "posMasterNoPrefix", headerStyle: "font-size: 14px", style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { name: "posMasterNo", @@ -82,6 +88,10 @@ const columns = ref([ field: "posMasterNo", headerStyle: "font-size: 14px", style: "font-size: 14px", + sort: (a: string, b: string) => + a + .toString() + .localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { name: "posMasterNoSuffix", @@ -91,6 +101,8 @@ const columns = ref([ field: "posMasterNoSuffix", headerStyle: "font-size: 14px", style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { name: "position", @@ -100,6 +112,8 @@ const columns = ref([ field: "position", headerStyle: "font-size: 14px", style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { name: "posType", @@ -120,6 +134,8 @@ const columns = ref([ }, headerStyle: "font-size: 14px", style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { @@ -133,19 +149,27 @@ const columns = ref([ format(val, row) { return !val ? "-" : val; }, + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { name: "lastUpdatedAt", align: "left", label: "วันที่แก้ไข", field: "lastUpdatedAt", + sortable: true, format(val, row) { return date2Thai(val); }, 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", +}); /** * function เรียกข้อมูลประวัติตำแหน่ง @@ -167,9 +191,7 @@ function fetchHistoryPos(id: string) { }); } -/** - * ดูการเปลี่ยนแปลง modal เมื่อเป็น true จะเรียกเรียกข้อมูลประวัติตำแหน่ง - */ +/** ดูการเปลี่ยนแปลง modal เมื่อเป็น true จะเรียกเรียกข้อมูลประวัติตำแหน่ง*/ watch( () => modal.value, () => { @@ -198,6 +220,7 @@ watch( :columns="columns" row-key="id" no-data-label="ไม่มีข้อมูล" + v-model:pagination="pagination" >