แก้ฟิลเตอร์ จากล่างขึ้นบนถึง พ้นราชการ

This commit is contained in:
setthawutttty 2024-12-03 15:28:53 +07:00
parent 35422c6963
commit e9280ca4f3
21 changed files with 260 additions and 69 deletions

View file

@ -21,7 +21,8 @@ const mixin = useCounterMixin();
const useStoreRetire = useDataStoreRetirement();
const { tab, type } = storeToRefs(useDataStoreRetirement());
const { clickTab } = useStoreRetire;
const { messageError, date2Thai, showLoader, hideLoader } = mixin;
const { messageError, date2Thai, showLoader, hideLoader, onSearchDataTable } =
mixin;
const fiscalyear = ref<number>(); //
const yearOptionsFilter = ref<any>({
@ -91,6 +92,7 @@ const columns = ref<QTableProps["columns"]>([
// ()
const currentYear = new Date().getFullYear();
const rows = ref<resMain[]>([]);
const rowsData = ref<resMain[]>([]);
const yearOptions = ref<any>([{ id: "", year: "ทั้งหมด" }]);
//
@ -101,7 +103,7 @@ async function fetchRetirement(type: string, year: any) {
.get(config.API.retirement(type, year))
.then((res) => {
let data = res.data.result;
rows.value = data.map((items: any) => ({
const listData = data.map((items: any) => ({
id: items.id,
signDate: date2Thai(items.signDate) ?? "-",
Date: date2Thai(items.createdAt),
@ -113,6 +115,9 @@ async function fetchRetirement(type: string, year: any) {
json: items.json,
document: items.document,
}));
rows.value = listData;
rowsData.value = listData;
let option: any[] = [];
data.map((items: any) => {
option.push({
@ -215,6 +220,14 @@ function typeReportChangeName(val: string) {
}
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsData.value,
columns.value ? columns.value : []
);
}
watch(type, () => {
fetchRetirement(type.value, currentYear);
});
@ -309,6 +322,7 @@ onMounted(async () => {
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -336,7 +350,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword.trim()"
row-key="name"
flat
bordered

View file

@ -26,10 +26,12 @@ const {
hideLoader,
success,
dialogConfirm,
onSearchDataTable
} = mixin;
/** คอลัมน์ */
const rows = ref<ResponseItems[]>([]);
const rowsData = ref<ResponseItems[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -186,6 +188,7 @@ async function fecthlist() {
});
});
rows.value = list;
rowsData.value = list;
console.log(rows.value);
filters.value = list;
@ -279,6 +282,14 @@ function openModalCalendar(rows: any) {
daterow.value = convertThaiDateToNumeric(rows.datetext);
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsData.value,
columns.value ? columns.value : []
);
}
/** HOOK */
onMounted(async () => {
await fecthlist();
@ -319,6 +330,7 @@ onMounted(async () => {
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -344,7 +356,6 @@ onMounted(async () => {
<d-table
:columns="columns"
:rows="rows"
:filter="filterKeyword.trim()"
row-key="id"
:visible-columns="visibleColumns"
>

View file

@ -13,10 +13,11 @@ import { checkPermission } from "@/utils/permissions";
const $q = useQuasar();
const router = useRouter();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, findOrgName } = mixin;
const { showLoader, hideLoader, messageError, date2Thai, findOrgName ,onSearchDataTable} = mixin;
/** คอลัมน์ */
const rows = ref<any[]>([]);
const rowsData = ref<any[]>([]);
const pagination = ref({
sortBy: "createdAt",
descending: true,
@ -118,6 +119,7 @@ async function fectListDecased() {
.then((res) => {
const data = res.data.result;
rows.value = data;
rowsData.value = data;
})
.catch((e) => {
messageError($q, e);
@ -135,6 +137,14 @@ function nextPage(id: string) {
router.push("/retirement/deceased/" + id);
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsData.value,
columns.value ? columns.value : []
);
}
/**Hook */
onMounted(() => {
fectListDecased();
@ -159,6 +169,7 @@ onMounted(() => {
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -185,7 +196,6 @@ onMounted(() => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword.trim()"
row-key="fullname"
flat
bordered

View file

@ -25,7 +25,7 @@ const {
showLoader,
hideLoader,
success,
onSearchDataTable,
dialogRemove,
} = mixin;
const { statusText } = transferStore;
@ -48,7 +48,9 @@ const filterRef = ref<any>(null);
//
const rows = ref<ResponseData[]>([]);
const rowsData = ref<ResponseData[]>([]);
const rows2 = ref<ResponseData[]>([]);
const rowsData2 = ref<ResponseData[]>([]);
const filters = ref<ResponseData[]>([]);
const columns = ref<QTableProps["columns"]>([
{
@ -145,6 +147,7 @@ function openModalOrder() {
r.date
);
rows2.value = row;
rowsData2.value = row;
}
//
@ -155,6 +158,7 @@ async function getData() {
.then((res: any) => {
const data = res.data.result;
rows.value = data;
rowsData.value = data;
filters.value = data;
})
.catch((e) => {
@ -191,6 +195,14 @@ function closeModal() {
modal.value = false;
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsData.value,
columns.value ? columns.value : []
);
}
onMounted(async () => {
await getData();
});
@ -225,6 +237,7 @@ onMounted(async () => {
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -251,7 +264,6 @@ onMounted(async () => {
<d-table
:columns="columns"
:rows="rows"
:filter="filterKeyword.trim()"
row-key="id"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
@ -345,7 +357,8 @@ onMounted(async () => {
<DialogSendToCommand
v-model:modal="modal"
:closeModal="closeModal"
:rows2="rows2"
v-model:rows="rows2"
v-model:rowsData="rowsData2"
v-model:filterKeyword2="filterKeyword2"
:fecthlistRecevice="getData"
/>