ปรับ filte Table ข้อมูลทะเบียนประวัติ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-04 15:15:36 +07:00
parent 7ab17d378f
commit 2b36b70715
26 changed files with 841 additions and 682 deletions

View file

@ -27,15 +27,14 @@ const {
date2Thai,
messageError,
dialogConfirm,
onSearchDataTable,
} = useCounterMixin();
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
/**
* props
*/
/** props*/
const isLeave = defineModel<boolean>("isLeave", {
required: true,
});
@ -69,7 +68,7 @@ const formData = reactive<FormEmployee>({
});
/** function fetch ข้อมูลลูกจ้างชั่วคราว*/
function fetchData() {
async function fetchData() {
showLoader();
http
.get(config.API.informationEmployee(profileId.value))
@ -148,6 +147,7 @@ function onSubmit() {
const modalHistory = ref<boolean>(false);
const filter = ref<string>("");
const rows = ref<EmployeeHistory[]>([]);
const rowsMain = ref<EmployeeHistory[]>([]);
const columns = ref<QTableColumn[]>([
{
name: "positionEmployeeGroupId",
@ -286,6 +286,7 @@ function onClickHistory() {
new Date(b.lastUpdatedAt).getTime() -
new Date(a.lastUpdatedAt).getTime()
);
rowsMain.value = rows.value;
})
.catch((err) => {
messageError($q, err);
@ -295,6 +296,14 @@ function onClickHistory() {
});
}
function serchDataTable() {
rows.value = onSearchDataTable(
filter.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
onMounted(() => {
profileId.value && fetchData();
});
@ -593,7 +602,7 @@ onMounted(() => {
ref="filterRef"
outlined
placeholder="ค้นหา"
debounce="300"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
@ -623,7 +632,6 @@ onMounted(() => {
:rows="rows"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
:filter="filter.trim()"
>
>
<template v-slot:header="props">