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

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

@ -41,6 +41,7 @@ const {
messageError,
success,
dialogMessageNotify,
onSearchDataTable,
} = mixin;
/**
@ -795,6 +796,14 @@ watch(
}
);
function onSearch() {
DataStore.rows = onSearchDataTable(
filterKeyword.value,
DataStore.rowsData,
columns.value ? columns.value : []
);
}
/** Hook*/
onMounted(async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
@ -853,6 +862,7 @@ onMounted(async () => {
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -1010,7 +1020,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="DataStore.rows"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -4,6 +4,7 @@ import { onMounted, ref, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
import { useCounterMixin } from "@/stores/mixin";
/** import Type*/
import type { QTableProps } from "quasar";
@ -13,6 +14,8 @@ import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
import DialogInformation from "@/components/Dialogs/Information.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
const mixin = useCounterMixin()
const { onSearchDataTable } = mixin
/** useStore*/
const roleDataStore = useroleUserDataStore();
const DataStore = useInsigniaDataStore();
@ -254,6 +257,14 @@ function clearInsigniaFilters(name: string) {
}
}
function onSearch() {
DataStore.rows = onSearchDataTable(
filterKeyword.value,
DataStore.rowsData,
columns.value ? columns.value : []
);
}
/*** Hook*/
onMounted(async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
@ -316,6 +327,7 @@ watch(
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -440,7 +452,6 @@ watch(
ref="table"
:columns="columns"
:rows="DataStore.rows"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -3,6 +3,7 @@ import { onMounted, ref, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useCounterMixin } from "@/stores/mixin";
/** import Type*/
import type { QTableProps } from "quasar";
@ -12,6 +13,8 @@ import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
import DialogInformation from "@/components/Dialogs/Information.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
const mixin = useCounterMixin();
const { onSearchDataTable } = mixin;
/** useStore*/
const DataStore = useInsigniaDataStore();
@ -251,6 +254,22 @@ function clearInsigniaFilters(name: string) {
}
}
function onSearch() {
DataStore.rows = onSearchDataTable(
filterKeyword.value,
DataStore.rowsData,
columns.value ? columns.value : []
);
}
watch(
() => DataStore.typeOc,
async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
}
);
/** Hook*/
onMounted(async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
@ -267,14 +286,6 @@ onMounted(async () => {
}
}
});
watch(
() => DataStore.typeOc,
async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
}
);
</script>
<template>
@ -314,6 +325,7 @@ watch(
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -434,7 +446,6 @@ watch(
ref="table"
:columns="columns"
:rows="DataStore.rows"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -31,6 +31,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
const typeOc = ref<string>("");
const agency = ref<string>("");
const rows = ref<DataManageList[]>([]);
const rowsData = ref<DataManageList[]>([]);
const listinsignia = ref<DataManageList[]>([]);
const typeinsignia = ref<string>("all");
const typeinsigniaOptions = ref<OptionData[]>([
@ -119,12 +120,15 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
}
rows.value = datalist;
rowsData.value = datalist;
listinsignia.value = item;
searchDataTable(typeinsignia.value, employeeClass.value);
filtertypeInsignia();
} else rows.value = [];
} else {
rows.value = [];
rowsData.value = [];
}
}
/**
* function
* @param data
@ -187,21 +191,28 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
typeinsignia.value = type;
employeeClass.value = employeeClasstype;
if (type !== "all" && employeeClasstype !== "all") {
rows.value = listinsignia.value.filter(
const listData = listinsignia.value.filter(
(e: DataManageList) =>
e.insigniaCheck === type &&
e.employeeType === profileType(employeeClasstype)
);
rows.value = listData;
rowsData.value = listData;
} else if (type !== "all" && employeeClasstype === "all") {
rows.value = listinsignia.value.filter(
const listData = listinsignia.value.filter(
(e: DataManageList) => e.insigniaCheck === type
);
rows.value = listData;
rowsData.value = listData;
} else if (type === "all" && employeeClasstype !== "all") {
rows.value = listinsignia.value.filter(
const listData = listinsignia.value.filter(
(e: DataManageList) => e.employeeType === profileType(employeeClasstype)
);
rows.value = listData;
rowsData.value = listData;
} else if (type === "all" && employeeClasstype === "all") {
rows.value = listinsignia.value;
rowsData.value = listinsignia.value;
}
}
@ -252,6 +263,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
mainTab,
typeOc,
rows,
rowsData,
typeinsigniaOptions,
typeinsignia,
agency,

View file

@ -25,10 +25,12 @@ const {
showLoader,
hideLoader,
dialogRemove,
onSearchDataTable,
} = mixin;
/** Table */
const rows = ref<FormProprsalsRound2[]>([]); //
const rowsData = ref<FormProprsalsRound2[]>([]); //
const filterKeyword = ref<string>(""); //
const filterRef = ref<HTMLInputElement | null>(null);
const columns = ref<QTableProps["columns"]>([
@ -110,7 +112,7 @@ async function fetchData() {
.get(config.API.listRoundInsignia(), { params: { path: "ROUND" } })
.then(async (res) => {
const data = res.data.result;
rows.value = await data.map((e: FormProprsalsRound2) => ({
const listData = await data.map((e: FormProprsalsRound2) => ({
period_id: e.period_id,
period_name: e.period_name,
period_year: e.period_year + 543,
@ -124,6 +126,9 @@ async function fetchData() {
period_status: e.period_status,
statusRoyal: storeInsignia.convertStatus(e.period_status),
}));
rows.value = listData;
rowsData.value = listData;
})
.catch((e) => {
messageError($q, e);
@ -176,6 +181,14 @@ function onOpenFormDetail(action: string = "", id: string = "") {
roundId.value = id;
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsData.value,
columns.value ? columns.value : []
);
}
/**
* ทำงานเม Componenets กเรยกใชงาน
*/
@ -213,6 +226,7 @@ onMounted(async () => {
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -238,7 +252,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword.trim()"
row-key="Order"
flat
bordered