ปรับ filte Table ข้อมูลทะเบียนประวัติ
This commit is contained in:
parent
7ab17d378f
commit
2b36b70715
26 changed files with 841 additions and 682 deletions
|
|
@ -27,19 +27,19 @@ const {
|
|||
messageError,
|
||||
hideLoader,
|
||||
showLoader,
|
||||
onSearchDataTable,
|
||||
} = useCounterMixin();
|
||||
|
||||
const profileId = ref<string>(route.params.id.toString());
|
||||
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
/** props*/
|
||||
const isLeave = defineModel<boolean>("isLeave", {
|
||||
required: true,
|
||||
});
|
||||
|
||||
/** ข้อมูลการจ้าง*/
|
||||
const rows = ref<Employment[]>([]);
|
||||
const rowsMain = ref<Employment[]>([]);
|
||||
const filter = ref<string>("");
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
|
|
@ -103,6 +103,7 @@ async function fetchListEmployment() {
|
|||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
rows.value = data;
|
||||
rowsMain.value = data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -201,6 +202,7 @@ function onDeleteEmployment(id: string) {
|
|||
/** ประวัติข้อมูลการจ้าง*/
|
||||
const modalHistory = ref<boolean>(false);
|
||||
const rowsHistory = ref<EmploymentHistory[]>([]);
|
||||
const rowsHistoryMain = ref<EmploymentHistory[]>([]);
|
||||
const filterHistory = ref<string>("");
|
||||
|
||||
/**
|
||||
|
|
@ -215,6 +217,7 @@ function onClickHistory(id: string) {
|
|||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
rowsHistory.value = data;
|
||||
rowsHistoryMain.value = data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -224,6 +227,22 @@ function onClickHistory(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
function serchDataTable() {
|
||||
rows.value = onSearchDataTable(
|
||||
filter.value,
|
||||
rowsMain.value,
|
||||
columns.value ? columns.value.slice(0, 2) : []
|
||||
);
|
||||
}
|
||||
|
||||
function serchDataTableHistory() {
|
||||
rowsHistory.value = onSearchDataTable(
|
||||
filterHistory.value,
|
||||
rowsHistoryMain.value,
|
||||
columns.value ? columns.value : []
|
||||
);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
profileId.value && fetchListEmployment();
|
||||
});
|
||||
|
|
@ -247,7 +266,13 @@ onMounted(() => {
|
|||
|
||||
<q-space />
|
||||
<div class="q-gutter-sm" style="display: flex">
|
||||
<q-input outlined dense v-model="filter" label="ค้นหา" debounce="300">
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
v-model="filter"
|
||||
label="ค้นหา"
|
||||
@keydown.enter.pervent="serchDataTable"
|
||||
>
|
||||
<template v-slot:append> <q-icon name="search" /> </template
|
||||
></q-input>
|
||||
|
||||
|
|
@ -275,7 +300,6 @@ onMounted(() => {
|
|||
ref="table"
|
||||
:columns="columns?.slice(0, 2)"
|
||||
:rows="rows"
|
||||
:filter="filter.trim()"
|
||||
row-key="dateEmployment"
|
||||
:paging="true"
|
||||
dense
|
||||
|
|
@ -436,7 +460,7 @@ onMounted(() => {
|
|||
v-model="filterHistory"
|
||||
outlined
|
||||
placeholder="ค้นหา"
|
||||
debounce="300"
|
||||
@keydown.enter.pervent="serchDataTableHistory"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
|
|
@ -466,7 +490,6 @@ onMounted(() => {
|
|||
:rows="rowsHistory"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
:filter="filterHistory.trim()"
|
||||
>
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue