filter dateAppoint

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-19 17:39:45 +07:00
parent 78de1bd91e
commit 438aa09866
4 changed files with 27 additions and 25 deletions

View file

@ -23,7 +23,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { messageError } = mixin; const { messageError, date2Thai } = mixin;
const store = useRegistryNewDataStore(); const store = useRegistryNewDataStore();
const router = useRouter(); const router = useRouter();
@ -60,62 +60,52 @@ const columns = ref<QTableProps["columns"]>([
name: "no", name: "no",
align: "left", align: "left",
label: "ลำดับ", label: "ลำดับ",
sortable: true, sortable: false,
field: "no", field: "no",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "fullName", name: "fullName",
align: "left", align: "left",
label: "ชื่อ-นามสกุล", label: "ชื่อ-นามสกุล",
sortable: true, sortable: false,
field: "fullName", field: "fullName",
headerStyle: "font-size: 14px; min-width: 200px", headerStyle: "font-size: 14px; min-width: 200px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "posNo", name: "posNo",
align: "left", align: "left",
label: "ตำแหน่งเลขที่", label: "ตำแหน่งเลขที่",
sortable: true, sortable: false,
field: "posNo", field: "posNo",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "position", name: "position",
align: "left", align: "left",
label: "ตำแหน่งในสายงาน", label: "ตำแหน่งในสายงาน",
sortable: true, sortable: false,
field: "position", field: "position",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "posPath", name: "posPath",
align: "left", align: "left",
label: "ตำแหน่งประเภท", label: "ตำแหน่งประเภท",
sortable: true, sortable: false,
field: "posType", field: "posType",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "posLevel", name: "posLevel",
align: "left", align: "left",
label: "ระดับ", label: "ระดับ",
sortable: true, sortable: false,
field: "posLevel", field: "posLevel",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
@ -124,19 +114,27 @@ const columns = ref<QTableProps["columns"]>([
? row.posTypeShortName + " " + row.posLevel ? row.posTypeShortName + " " + row.posLevel
: row.posLevel; : row.posLevel;
}, },
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "org", name: "org",
align: "left", align: "left",
label: "สังกัด", label: "สังกัด",
sortable: true, sortable: false,
field: "org", field: "org",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => },
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), {
name: "dateAppoint",
align: "left",
label: "วันที่บรรจุ",
sortable: false,
field: "dateAppoint",
headerStyle: "font-size: 14px",
format(val, row) {
return date2Thai(val);
},
style: "font-size: 14px",
}, },
// { // {
// name: "year", // name: "year",
@ -170,6 +168,7 @@ const visibleColumns = ref<string[]>([
"posType", "posType",
"posLevel", "posLevel",
"org", "org",
"dateAppoint",
]); ]);
const pagination = ref({ const pagination = ref({
page: formFilter.value.page, page: formFilter.value.page,

View file

@ -58,6 +58,8 @@ interface QueryParams {
isAll?: boolean; isAll?: boolean;
retireType?: string | null; retireType?: string | null;
dateAppoint?: string; dateAppoint?: string;
sortBy?: string;
sort?: string;
} }
interface FormChangeName { interface FormChangeName {

View file

@ -132,8 +132,8 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
]); ]);
const displayOrderOps = ref<DataOption[]>([ const displayOrderOps = ref<DataOption[]>([
{ id: "ASC", name: "เรียงตามวันที่บรรจุแต่งตั้ง (ล่าสุด-เก่า)" }, { id: "DESC", name: "เรียงตามวันที่บรรจุแต่งตั้ง (ล่าสุด-เก่า)" },
{ id: "DESC", name: "เรียงตามวันที่บรรจุแต่งตั้ง (เก่า-ล่าสุด)" }, { id: "ASC", name: "เรียงตามวันที่บรรจุแต่งตั้ง (เก่า-ล่าสุด)" },
]); ]);
return { return {

View file

@ -129,7 +129,8 @@ async function fetchDataPerson() {
} }
if (store.formFilter.dateAppoint) { if (store.formFilter.dateAppoint) {
queryParams.dateAppoint = store.formFilter.dateAppoint; queryParams.sortBy = "profile.dateAppoint";
queryParams.sort = store.formFilter.dateAppoint;
} }
await http await http