filter ==> ข้อมูลเกี่ยวกับบุคคล

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-12 13:32:48 +07:00
parent 404a47e78b
commit 6152fa3bef
11 changed files with 82 additions and 45 deletions

View file

@ -173,12 +173,13 @@ onMounted(async () => {
borderless
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="
store.onSearchData(filterKeyword, TABLE_COLUMNS)
"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -202,7 +203,6 @@ onMounted(async () => {
ref="table"
:columns="TABLE_COLUMNS"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -172,12 +172,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -201,7 +200,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -172,12 +172,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -201,7 +200,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -172,12 +172,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -201,7 +200,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -171,12 +171,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -200,7 +199,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -172,12 +172,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -201,7 +200,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -183,12 +183,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -212,7 +211,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -186,12 +186,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -215,7 +214,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -15,8 +15,14 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const router = useRouter();
const route = useRoute();
const { messageError, showLoader, hideLoader, success, date2Thai } =
useCounterMixin();
const {
messageError,
showLoader,
hideLoader,
success,
date2Thai,
onSearchDataTable,
} = useCounterMixin();
/**
* Table
@ -82,6 +88,7 @@ const dialog = ref<boolean>(false); // เพิ่มข้อมูล,แก
const dialogStatus = ref<string>(""); // ,
const personalName = ref<string>("เขต/อำเภอ"); //label input
const rows = ref<FormDistrict[]>([]); // /
const rowsMain = ref<FormDistrict[]>([]); // /
const provinceName = ref<string>(""); //
/**
@ -99,12 +106,13 @@ async function fetchData() {
const list = data.map((e: FormDistrict) => ({
...e,
createdAt: e.createdAt ? date2Thai(new Date(e.createdAt)) : "",
createdAt: e.createdAt ? date2Thai(new Date(e.createdAt),false,true) : "",
lastUpdatedAt: e.lastUpdatedAt
? date2Thai(new Date(e.lastUpdatedAt))
? date2Thai(new Date(e.lastUpdatedAt),false,true)
: "",
}));
rows.value = list;
rowsMain.value = list;
})
.catch((err) => {
messageError($q, err);
@ -168,6 +176,14 @@ function nextPage(idSub: string) {
router.push(`/master-data/personal/sub-district/${id.value}/${idSub}`);
}
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns ? columns : []
);
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการระดบการเขต/อำเภอ
@ -217,7 +233,12 @@ onMounted(async () => {
dense
v-model="filterKeyword"
label="ค้นหา"
></q-input>
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
@ -238,7 +259,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -15,8 +15,14 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const router = useRouter();
const route = useRoute();
const { messageError, showLoader, hideLoader, success, date2Thai } =
useCounterMixin();
const {
messageError,
showLoader,
hideLoader,
success,
date2Thai,
onSearchDataTable,
} = useCounterMixin();
/**
* Table
@ -88,6 +94,7 @@ const visibleColumns = ref<string[]>([
const id = ref<string>(route.params.id as string); // /
const rows = ref<FormSubDistrict[]>([]); // /
const rowsMain = ref<FormSubDistrict[]>([]); // /
const editId = ref<string>(""); // id /
const filterKeyword = ref<string>(""); //
const dialog = ref<boolean>(false); // ,
@ -111,12 +118,15 @@ async function fetchData() {
subdistrict.value = await res.data.result.name;
const list = data.map((e: FormSubDistrict) => ({
...e,
createdAt: e.createdAt ? date2Thai(new Date(e.createdAt)) : "",
createdAt: e.createdAt
? date2Thai(new Date(e.createdAt), false, true)
: "",
lastUpdatedAt: e.lastUpdatedAt
? date2Thai(new Date(e.lastUpdatedAt))
? date2Thai(new Date(e.lastUpdatedAt), false, true)
: "",
}));
rows.value = list;
rowsMain.value = list;
})
.catch((err) => {
messageError($q, err);
@ -173,6 +183,14 @@ async function editData(idRow: string) {
});
}
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns ? columns : []
);
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการแขวง/ตำบล
@ -223,7 +241,12 @@ onMounted(async () => {
dense
v-model="filterKeyword"
label="ค้นหา"
></q-input>
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
@ -244,7 +267,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -7,10 +7,11 @@ import type {
DataRow,
} from "../interface/response/personal/personal";
const { date2Thai } = useCounterMixin();
const { date2Thai, onSearchDataTable } = useCounterMixin();
export const usePersonalDataStore = defineStore("PersonalData", () => {
const row = ref<DataRow[]>([]); // ข้อมูลในตาราง
const rowMain = ref<DataRow[]>([]); // ข้อมูลในตาราง
const currentTab = ref<string>("list_prefix"); // Tab ปัจจุบัน
/**
@ -19,6 +20,7 @@ export const usePersonalDataStore = defineStore("PersonalData", () => {
*/
async function save(data: DataResponse[]) {
row.value = [];
rowMain.value = [];
const list = data.map((e) => ({
...e,
createdAt: e.createdAt ? date2Thai(e.createdAt, false, true) : "-",
@ -26,12 +28,19 @@ export const usePersonalDataStore = defineStore("PersonalData", () => {
? date2Thai(e.lastUpdatedAt, false, true)
: "-",
}));
row.value = list;
rowMain.value = list;
}
function onSearchData(keyword: string, columns: any = []) {
row.value = onSearchDataTable(keyword, rowMain.value, columns);
}
return {
save,
row,
currentTab,
onSearchData,
};
});