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

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-28 14:45:47 +07:00
parent 4ca00ceadb
commit 91bb279158
7 changed files with 95 additions and 396 deletions

View file

@ -7,80 +7,43 @@ const {
date2Thai,
} = mixin;
export const useResultDataStore = defineStore("insigniaResult", () => {
export const useAllocateDataStore = defineStore("insigniaallocate", () => {
const insigniaName = ref<string>('')
const insignia = ref<string>('')
const insigniaOp = ref<any[]>([{ name: "ทั้งหมด", id: "", type: "" }])
const insigniaOp2 = ref<any[]>([])
const insigniaType = ref<any>()
const invoiceType = ref<string>('all')
const invoiceTypeop = ref<any>([{ name: "ทั้งหมด", id: "all" }, { name: "ใบกำกับที่ค้างจ่าย", id: "noDate" }, { name: "ใบกำกับที่จ่ายแล้ว", id: "haveDate" }])
const rows = ref<any>([])
const listInsignia = ref<any>([])
const fetchDatainsignia = async (data: any) => {
insignia.value = ''
invoiceType.value = 'all'
insigniaOp.value = [{ name: "ทั้งหมด", id: "", type: "" }]
data.forEach((e: any) => {
insigniaOp.value.push({ name: e.name, id: e.id, type: e.insigniaType.id })
});
}
const fetchDatainsigniaType = async (data: any) => {
insigniaType.value = data.map((e: any) => ({ name: e.id, label: e.name }))
}
const fetchlistinsignia = async (data: any) => {
const listinsignia = async (data: any) => {
rows.value = [];
let alllist = await data.map((e: any) => ({
let list = await data.map((e: any) => ({
id: e.id,
citizenId: e.citizenId,
prefix: e.prefix,
position: e.position,
status: status(e.status),
dateReceive: date2Thai(e.dateReceive),
name: e.fullName,
type: e.requestInsignia,
employeeType: profileType(e.profileType),
profileType: e.profileType,
page: e.page,
number: e.no,
vatnumber: e.number,
datepay: date2Thai(e.datePayment),
typepay: e.typePayment,
address: e.address,
}));
rows.value = alllist
listInsignia.value = alllist
selectInvoice(invoiceType.value)
insignia: e.insignia,
insigniaId: e.insigniaId,
total: e.total,
allocate: e.allocate,
remain: e.remain,
year: e.year,
}))
rows.value = list
listInsignia.value = list
}
const selectInvoice = (invoice: string) => {
console.log(invoice);
if (invoice === "noDate") {
let list = listInsignia.value.filter((e: any) => e.datepay === null)
rows.value = list
} else if (invoice === "haveDate") {
let list = listInsignia.value.filter((e: any) => e.datepay !== null)
rows.value = list
} else rows.value = listInsignia.value
const selectInsignia = () => {
console.log(insignia.value);
rows.value = listInsignia.value.filter((e: any) => e.insigniaId === insignia.value)
}
const status = (val: string) => {
switch (val) {
case "PENDING":
return "รอบันทึกข้อมูล";
case "REJECT":
return "ยกเลิก";
case "DELETE":
return "ลบ";
case "DONE":
return "บันทึกลง ก.พ. 7 แล้ว";
}
}
const profileType = (val: string) => {
switch (val) {
case "officer":
@ -89,21 +52,16 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
return "ลูกจ้างประจำ";
}
}
return {
rows,
insignia,
insigniaOp,
insigniaOp2,
insigniaType,
invoiceType,
invoiceTypeop,
fetchDatainsignia,
fetchDatainsigniaType,
status,
listinsignia,
selectInsignia,
profileType,
fetchlistinsignia,
selectInvoice,
insigniaName
};
});