ปรับแก้ไขเครื่องราช

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-01 13:54:08 +07:00
parent 64152f72d9
commit 7611d51974
11 changed files with 386 additions and 71 deletions

View file

@ -6,6 +6,7 @@ const mixin = useCounterMixin();
const { date2Thai } = mixin;
export const useInsigniaDataStore = defineStore("insignia", () => {
const isLock = ref<boolean>(false)
let optionsTypeOc = ref<any>([]);
let typeOc = ref<string>("");
const agency = ref<string>("");
@ -13,6 +14,8 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
const listinsignia = ref<any>([]);
const typeinsignia = ref<number | string>("all");
let typeinsigniaOptions = ref<any>([{ id: "all", name: "ทั้งหมด" }]);
const employeeClass = ref<string>("all");
const employeeClassOps = ref<any>([{ name: "ทั้งหมด", id: "all" }, { name: "ข้าราชการ กทม.สามัญ", id: "officer" }, { name: "ลูกจ้างประจำ", id: "perm" }])
const typeReport = ref<string>("");
const titleReport = ref<string>("");
@ -23,8 +26,10 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
};
const fetchData = async (data: any) => {
console.log(data);
if (data !== null) {
rows.value = await data.map((e: any) => ({
let datalist = await data.map((e: any) => ({
id: e.id,
citizenId: e.citizenId,
profileId: e.profileId,
@ -38,8 +43,10 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
insigniaLevel: e.level,
dateSend: date2Thai(e.requestDate),
requestNote: e.requestNote,
employeeType: profileType(e.profileType),
}));
listinsignia.value = await rows.value;
rows.value = await datalist
listinsignia.value = await datalist;
filtertypeInsignia();
} else rows.value = [];
};
@ -81,6 +88,29 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
}
}
};
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 convertOcid = (oc: string) => {
let ocdata = optionsTypeOc.value.find((e: any) => e.name === oc)
if (ocdata) {
return ocdata.id
} else return ""
}
const profileType = (val: string) => {
switch (val) {
case "officer":
return "ข้าราชการ กทม.สามัญ";
case "employee":
return "ลูกจ้างประจำ";
}
}
return {
optionsTypeOc,
@ -93,7 +123,12 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
fetchOption,
searchFilterTable,
setTypeandTitle,
convertOcid,
typeReport,
titleReport,
selectEmployeeClass,
employeeClass,
employeeClassOps,
isLock
};
});