Merge branch 'develop' into warunee-dev
# Conflicts: # src/modules/07_insignia/storeAllocate.ts
This commit is contained in:
commit
7d2ea59231
11 changed files with 243 additions and 457 deletions
97
src/modules/07_insignia/storeBrrow.ts
Normal file
97
src/modules/07_insignia/storeBrrow.ts
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref, } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
date2Thai,
|
||||
} = mixin;
|
||||
|
||||
export const useBrrowDataStore = defineStore("insigniaBrrow", () => {
|
||||
const insignia = ref<string>('')
|
||||
const insigniaOp = ref<any[]>([{ name: "ทั้งหมด", id: "", type: "" }])
|
||||
const insigniaType = ref<any>()
|
||||
const rows = ref<any>([])
|
||||
const listInsignia = ref<any>([])
|
||||
|
||||
const fetchDataInsignia = async (data: any) => {
|
||||
insignia.value = ''
|
||||
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) => {
|
||||
rows.value = [];
|
||||
let list = await data.map((e: any) => ({
|
||||
id: e.id,
|
||||
citizenId: e.citizenId,
|
||||
prefix: e.prefix,
|
||||
position: e.position,
|
||||
status: status(e.status),
|
||||
name: e.fullName,
|
||||
type: e.requestInsignia,
|
||||
requestInsigniaId: e.requestInsigniaId,
|
||||
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,
|
||||
borrowOrganization: e.borrowOrganization,
|
||||
borrowDate: e.borrowDate !== null ? date2Thai(e.borrowDate) : '-',
|
||||
returnOrganization: e.returnOrganization,
|
||||
returnDate: e.returnDate !== null ? date2Thai(e.returnDate) : '-',
|
||||
returnReason: e.returnReason !== null ? e.returnReason : '-',
|
||||
}));
|
||||
rows.value = list
|
||||
listInsignia.value = list
|
||||
// selectInvoice(invoiceType.value)
|
||||
}
|
||||
|
||||
const status = (val: string) => {
|
||||
switch (val) {
|
||||
case "PENDING":
|
||||
return "รอบันทึกข้อมูล";
|
||||
case "REJECT":
|
||||
return "ยกเลิก";
|
||||
case "DELETE":
|
||||
return "ลบ";
|
||||
case "DONE":
|
||||
return "บันทึกลง ก.พ. 7 แล้ว";
|
||||
}
|
||||
}
|
||||
|
||||
const selectInsignia = () => {
|
||||
console.log(insignia.value);
|
||||
rows.value = listInsignia.value.filter((e: any) => e.insigniaId === insignia.value)
|
||||
}
|
||||
|
||||
const profileType = (val: string) => {
|
||||
switch (val) {
|
||||
case "officer":
|
||||
return "ข้าราชการ กทม.สามัญ";
|
||||
case "employee":
|
||||
return "ลูกจ้างประจำ";
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
rows,
|
||||
listInsignia,
|
||||
insignia,
|
||||
insigniaOp,
|
||||
insigniaType,
|
||||
fetchDatainsigniaType,
|
||||
fetchDataInsignia,
|
||||
selectInsignia,
|
||||
profileType,
|
||||
fetchlistinsignia,
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue