filter ==> ข้อมูลตำแหน่งข้าราชการ ฯ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-12 13:48:39 +07:00
parent 6152fa3bef
commit a8576f902c
6 changed files with 52 additions and 19 deletions

View file

@ -344,7 +344,8 @@ onMounted(async () => {
</div> </div>
<div class="col-xs-12 col-md-2"> <div class="col-xs-12 col-md-2">
<q-btn <q-btn
class="full-width" outline
class="full-width full-height"
color="primary" color="primary"
icon="search" icon="search"
label="ค้นหา" label="ค้นหา"

View file

@ -15,8 +15,14 @@ import dialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar(); const $q = useQuasar();
const router = useRouter(); const router = useRouter();
const store = usePositionTypeDataStore(); const store = usePositionTypeDataStore();
const { dialogConfirm, success, messageError, showLoader, hideLoader } = const {
useCounterMixin(); dialogConfirm,
success,
messageError,
showLoader,
hideLoader,
onSearchDataTable,
} = useCounterMixin();
// Table // Table
const filterKeyword = ref<string>(""); // const filterKeyword = ref<string>(""); //
@ -93,7 +99,6 @@ const posTypeRank = ref<number | null>(null); // ระดับตำแหน
/** /**
* งขอมลรายการประเภทตำแหน * งขอมลรายการประเภทตำแหน
*
* นทกขอมลรายการประเภทตำแหนงใน Store positionTypeStore * นทกขอมลรายการประเภทตำแหนงใน Store positionTypeStore
*/ */
async function fetchData() { async function fetchData() {
@ -113,7 +118,6 @@ async function fetchData() {
/** /**
* นยนการบนทกขอมลประเภทตำแหน * นยนการบนทกขอมลประเภทตำแหน
*
* dialogStatus เป 'create' จะทำการเพมขอมลรายการประเภทตำแหน าไมจะทำการแกไขขอม * dialogStatus เป 'create' จะทำการเพมขอมลรายการประเภทตำแหน าไมจะทำการแกไขขอม
* เมอบนทกขอมลเสรจจะเรยก function fetchData() เพอดงขอมลรายการประเภทตำแหนงใหม * เมอบนทกขอมลเสรจจะเรยก function fetchData() เพอดงขอมลรายการประเภทตำแหนงใหม
* *
@ -152,7 +156,6 @@ function onSubmit() {
/** /**
* popup ฟอรมประเภทตำแหน * popup ฟอรมประเภทตำแหน
*
* และเคลยรวแปรในฟอรมประเภทตำแหน * และเคลยรวแปรในฟอรมประเภทตำแหน
*/ */
function closeDialog() { function closeDialog() {
@ -169,6 +172,14 @@ function onclickDetail(id: string) {
router.push(`/master-data/position/level/${id}`); router.push(`/master-data/position/level/${id}`);
} }
function serchDataTable() {
store.row = onSearchDataTable(
filterKeyword.value,
store.rowMain,
columns ? columns : []
);
}
/** /**
* hook ทำงานเม Components กเรยกใชงาน * hook ทำงานเม Components กเรยกใชงาน
*/ */
@ -198,12 +209,11 @@ onMounted(async () => {
<q-input <q-input
dense dense
outlined outlined
clearable
v-model="filterKeyword" v-model="filterKeyword"
placeholder="ค้นหา" placeholder="ค้นหา"
@clear="filterKeyword = ''" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append v-if="filterKeyword === ''"> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
</template> </template>
</q-input> </q-input>
@ -227,7 +237,6 @@ onMounted(async () => {
ref="table" ref="table"
:columns="columns" :columns="columns"
:rows="store.row" :rows="store.row"
:filter="filterKeyword"
row-key="name" row-key="name"
flat flat
bordered bordered

View file

@ -12,10 +12,12 @@ import type { RowListForm } from "@/modules/01_metadata/interface/request/positi
import DialogAdd from "@/modules/01_metadata/components/position/DialogFormExecutive.vue"; import DialogAdd from "@/modules/01_metadata/components/position/DialogFormExecutive.vue";
const $q = useQuasar(); const $q = useQuasar();
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin(); const { showLoader, hideLoader, messageError, date2Thai, onSearchDataTable } =
useCounterMixin();
// Table // Table
const rows = ref<RowListForm[]>([]); // const rows = ref<RowListForm[]>([]); //
const rowsMain = ref<RowListForm[]>([]); //
const filterKeyword = ref<string>(""); // const filterKeyword = ref<string>(""); //
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"no", "no",
@ -104,6 +106,7 @@ async function getData() {
.then(async (res) => { .then(async (res) => {
const data = await res.data.result; const data = await res.data.result;
rows.value = data; rows.value = data;
rowsMain.value = data;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -130,6 +133,14 @@ function editPopUp(data: RowListForm) {
isEdit.value = true; isEdit.value = true;
} }
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** /**
* hook ทำงานเม Components กเรยกใชงาน * hook ทำงานเม Components กเรยกใชงาน
*/ */
@ -157,12 +168,11 @@ onMounted(async () => {
<q-input <q-input
dense dense
outlined outlined
clearable
v-model="filterKeyword" v-model="filterKeyword"
placeholder="ค้นหา" placeholder="ค้นหา"
@clear="filterKeyword = ''" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append v-if="filterKeyword === ''"> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
</template> </template>
</q-input> </q-input>
@ -185,7 +195,6 @@ onMounted(async () => {
ref="table" ref="table"
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
:filter="filterKeyword"
row-key="id" row-key="id"
flat flat
bordered bordered

View file

@ -25,6 +25,7 @@ const {
hideLoader, hideLoader,
messageError, messageError,
success, success,
onSearchDataTable,
} = useCounterMixin(); } = useCounterMixin();
//table //table
@ -236,6 +237,14 @@ function closeDialog() {
dialog.value = false; dialog.value = false;
} }
function serchDataTable() {
store.row = onSearchDataTable(
filterKeyword.value,
store.rowMain,
columns ? columns : []
);
}
/** /**
* hook ทำงานเม Components กเรยกใชงาน * hook ทำงานเม Components กเรยกใชงาน
*/ */
@ -284,12 +293,11 @@ onMounted(async () => {
<q-input <q-input
dense dense
outlined outlined
clearable
v-model="filterKeyword" v-model="filterKeyword"
placeholder="ค้นหา" placeholder="ค้นหา"
@clear="filterKeyword = ''" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append v-if="filterKeyword === ''"> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
</template> </template>
</q-input> </q-input>
@ -313,7 +321,6 @@ onMounted(async () => {
ref="table" ref="table"
:columns="columns" :columns="columns"
:rows="store.row" :rows="store.row"
:filter="filterKeyword"
row-key="name" row-key="name"
flat flat
bordered bordered

View file

@ -13,6 +13,8 @@ const { date2Thai } = useCounterMixin();
export const usePositionDataStore = defineStore("PositionData", () => { export const usePositionDataStore = defineStore("PositionData", () => {
const pathLocation = ref<string>("list_position"); const pathLocation = ref<string>("list_position");
const row = ref<DataRow[]>([]); const row = ref<DataRow[]>([]);
const rowMain = ref<DataRow[]>([]);
function save(data: DataResponse[], posTypeName: string) { function save(data: DataResponse[], posTypeName: string) {
const list = data.map((e) => ({ const list = data.map((e) => ({
...e, ...e,
@ -29,11 +31,13 @@ export const usePositionDataStore = defineStore("PositionData", () => {
: "-", : "-",
})) satisfies DataRow[]; })) satisfies DataRow[];
row.value = list; row.value = list;
rowMain.value = list;
} }
return { return {
save, save,
row, row,
rowMain,
pathLocation, pathLocation,
}; };
}); });

View file

@ -12,6 +12,7 @@ const { date2Thai } = useCounterMixin();
export const usePositionTypeDataStore = defineStore("PositionTypeData", () => { export const usePositionTypeDataStore = defineStore("PositionTypeData", () => {
const row = ref<DataRow[]>([]); const row = ref<DataRow[]>([]);
const rowMain = ref<DataRow[]>([]);
/** /**
* row.value * row.value
@ -28,9 +29,11 @@ export const usePositionTypeDataStore = defineStore("PositionTypeData", () => {
: "-", : "-",
})) satisfies DataRow[]; })) satisfies DataRow[];
row.value = list; row.value = list;
rowMain.value = list;
} }
return { return {
save, save,
row, row,
rowMain,
}; };
}); });