diff --git a/src/modules/07_insignia/components/2_Manage/Tab1.vue b/src/modules/07_insignia/components/2_Manage/Tab1.vue
index d84677865..7c8af9609 100644
--- a/src/modules/07_insignia/components/2_Manage/Tab1.vue
+++ b/src/modules/07_insignia/components/2_Manage/Tab1.vue
@@ -607,7 +607,12 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
:outlined="true"
:hide-dropdown-icon="false"
style="min-width: 150px"
- @update:model-value="DataStore.searchFilterTable"
+ @update:model-value="
+ DataStore.searchDataTable(
+ DataStore.typeinsignia,
+ DataStore.employeeClass
+ )
+ "
/>
{
:borderless="false"
style="min-width: 150px"
@update:model-value="
- DataStore.selectEmployeeClass(DataStore.employeeClass)
+ DataStore.searchDataTable(
+ DataStore.typeinsignia,
+ DataStore.employeeClass
+ )
"
/>
diff --git a/src/modules/07_insignia/components/2_Manage/Tab2.vue b/src/modules/07_insignia/components/2_Manage/Tab2.vue
index 06bb1aa3d..769b20258 100644
--- a/src/modules/07_insignia/components/2_Manage/Tab2.vue
+++ b/src/modules/07_insignia/components/2_Manage/Tab2.vue
@@ -246,7 +246,12 @@ const closeReson = () => {
:outlined="true"
:hide-dropdown-icon="false"
style="min-width: 150px"
- @update:model-value="DataStore.searchFilterTable"
+ @update:model-value="
+ DataStore.searchDataTable(
+ DataStore.typeinsignia,
+ DataStore.employeeClass
+ )
+ "
/>
{
:borderless="false"
style="min-width: 150px"
@update:model-value="
- DataStore.selectEmployeeClass(DataStore.employeeClass)
+ DataStore.searchDataTable(
+ DataStore.typeinsignia,
+ DataStore.employeeClass
+ )
"
/>
diff --git a/src/modules/07_insignia/components/2_Manage/Tab3.vue b/src/modules/07_insignia/components/2_Manage/Tab3.vue
index f3b70d90b..6aa4cc83c 100644
--- a/src/modules/07_insignia/components/2_Manage/Tab3.vue
+++ b/src/modules/07_insignia/components/2_Manage/Tab3.vue
@@ -243,7 +243,12 @@ const closeReson = () => {
:outlined="true"
:hide-dropdown-icon="false"
style="min-width: 150px"
- @update:model-value="DataStore.searchFilterTable"
+ @update:model-value="
+ DataStore.searchDataTable(
+ DataStore.typeinsignia,
+ DataStore.employeeClass
+ )
+ "
/>
{
:borderless="false"
style="min-width: 150px"
@update:model-value="
- DataStore.selectEmployeeClass(DataStore.employeeClass)
+ DataStore.searchDataTable(
+ DataStore.typeinsignia,
+ DataStore.employeeClass
+ )
"
/>
diff --git a/src/modules/07_insignia/store.ts b/src/modules/07_insignia/store.ts
index f229b8450..31faded03 100644
--- a/src/modules/07_insignia/store.ts
+++ b/src/modules/07_insignia/store.ts
@@ -15,7 +15,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
const agency = ref("");
let rows = ref([]);
const listinsignia = ref([]);
- const typeinsignia = ref("all");
+ const typeinsignia = ref("all");
let typeinsigniaOptions = ref([{ id: "all", name: "ทั้งหมด" }]);
const employeeClass = ref("all");
const employeeClassOps = ref([{ name: "ทั้งหมด", id: "all" }, { name: "ข้าราชการ กทม.สามัญ", id: "officer" }, { name: "ลูกจ้างประจำ", id: "perm" }])
@@ -48,6 +48,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
}));
rows.value = await datalist
listinsignia.value = await datalist;
+ searchDataTable(typeinsignia.value, employeeClass.value)
filtertypeInsignia();
} else rows.value = [];
};
@@ -77,53 +78,20 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
id: type,
name: type,
};
- // typeinsigniaOptions.value = [{ id: "all", name: "ทั้งหมด" }]
typeinsigniaOptions.value.push(listtype);
}
} else typeinsigniaOptions.value = [{ id: "all", name: "ทั้งหมด" }];
};
+ const searchDataTable = async (type: string, employeeClass: string) => {
+ if (type !== 'all' && employeeClass !== 'all') {
+ rows.value = listinsignia.value.filter((e: any) => e.insigniaType === type && e.employeeType === profileType(employeeClass))
+ } else if (type !== 'all' && employeeClass === 'all') {
+ rows.value = listinsignia.value.filter((e: any) => e.insigniaType === type)
+ } else if (type === 'all' && employeeClass !== 'all') {
+ rows.value = listinsignia.value.filter((e: any) => e.employeeType === profileType(employeeClass))
+ }
+
- const searchFilterTable = async () => {
- console.log(employeeClass.value);
- if (employeeClass.value === "all") {
- if (typeinsignia.value !== undefined && typeinsignia.value !== null) {
- if (typeinsignia.value === "all") {
- rows.value = listinsignia.value;
- } else {
- rows.value = listinsignia.value.filter(
- (e: any) => e.insigniaSend === typeinsignia.value
- );
- }
- }
- } else {
- if (typeinsignia.value !== undefined && typeinsignia.value !== null) {
- if (typeinsignia.value === "all") {
- rows.value = listinsignia.value.filter((e: any) => e.employeeType === profileType(employeeClass.value))
- } else {
- rows.value = listinsignia.value.filter(
- (e: any) => e.insigniaSend === typeinsignia.value && e.employeeType === profileType(employeeClass.value)
- );
- }
- }
- }
- };
- const selectEmployeeClass = (employeeClass: string) => {
- if (typeinsignia.value !== "all") {
- if (employeeClass !== "all") {
- let list = listinsignia.value.filter((e: any) => e.employeeType === profileType(employeeClass) && e.insigniaSend === typeinsignia.value)
- rows.value = list
- } else {
- let list = listinsignia.value.filter((e: any) => e.insigniaSend === typeinsignia.value)
- rows.value = list
- }
- } else if (typeinsignia.value == "all") {
- if (employeeClass !== "all") {
- let list = listinsignia.value.filter((e: any) => e.employeeType === profileType(employeeClass))
- rows.value = list
- } else {
- rows.value = listinsignia.value
- }
- }
}
const convertOcid = (oc: string) => {
let ocdata = optionsTypeOc.value.find((e: any) => e.name === oc)
@@ -149,12 +117,11 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
agency,
fetchData,
fetchOption,
- searchFilterTable,
+ searchDataTable,
setTypeandTitle,
convertOcid,
typeReport,
titleReport,
- selectEmployeeClass,
employeeClass,
employeeClassOps,
fetchDataInsignia,
diff --git a/src/modules/07_insignia/storeResult.ts b/src/modules/07_insignia/storeResult.ts
index 4d90aab16..1a67817ee 100644
--- a/src/modules/07_insignia/storeResult.ts
+++ b/src/modules/07_insignia/storeResult.ts
@@ -56,8 +56,6 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
}));
rows.value = alllist
listInsignia.value = alllist
- // selectInvoice(invoiceType.value)
- // console.log(invoiceType.value, employeeClass.value);
searchData(invoiceType.value, employeeClass.value);
}
@@ -73,28 +71,6 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
rows.value = list
}
}
- // const selectInvoice = (invoice: string) => {
- // if (employeeClass.value !== 'all') {
- // if (invoice !== "all") {
- // let list = listInsignia.value.filter((e: any) => convertDatepay(e.datepay) === invoice && e.employeeType === profileType(employeeClass.value))
- // rows.value = list
- // } else rows.value = listInsignia.value.filter((e: any) => e.employeeType === profileType(employeeClass.value))
- // }
- // else {
- // if (invoice !== 'all') {
- // rows.value = listInsignia.value.filter((e: any) => convertDatepay(e.datepay) === invoice)
- // } else rows.value = listInsignia.value
- // }
- // }
- // const selectEmployeeClass = (employeeClass: string) => {
- // if (employeeClass == "officer") {
- // let list = listInsignia.value.filter((e: any) => e.employeeType === "ข้าราชการ กทม.สามัญ")
- // rows.value = list
- // } else if (employeeClass === "perm") {
- // let list = listInsignia.value.filter((e: any) => e.employeeType === "ลูกจ้างประจำ")
- // rows.value = list
- // } else rows.value = listInsignia.value
- // }
const status = (val: string) => {
switch (val) {
case "PENDING":