แก้โครงฟอร์มลา

This commit is contained in:
Warunee Tamkoo 2024-01-04 15:17:42 +07:00
parent 346ba79606
commit 2c351bbb15
46 changed files with 8182 additions and 11803 deletions

View file

@ -80,7 +80,6 @@ export const useLeaveStore = defineStore("Leave", () => {
code: "LV-000",
},
];
console.log(typeOptionsMain.value);
const optionType = data.map((e: TypeLeave) => ({
id: e.id,
@ -99,6 +98,7 @@ export const useLeaveStore = defineStore("Leave", () => {
/** สถานะของการลา */
const statusOptionsMain = ref<any[]>([
{ id: "ALL", name: "ทั้งหมด" },
{ id: "DRAFT", name: "แบบร่าง" },
{ id: "NEW", name: "ใหม่" },
{ id: "PENDING", name: "กำลังดำเนินการ" },
{ id: "APPROVE", name: "อนุมัติ " },
@ -133,8 +133,9 @@ export const useLeaveStore = defineStore("Leave", () => {
break;
}
}
/** รายการประเภทการลาของ ลาไปศึกษา ฝึกอบรม ปฎิบัติการวิจัย หรือดูงาน*/
const optionsSpecific = ref([
const optionsSpecific = ref<OptionData[]>([
{ id: "s0", name: "ลาไปศึกษาต่อ", code: "s0" },
{ id: "s1", name: "ลาฝึกอบรม", code: "s1" },
{ id: "s2", name: "ลาปฎิบัติการวิจัย", code: "s2" },
@ -142,18 +143,19 @@ export const useLeaveStore = defineStore("Leave", () => {
]);
/** รายการประเภทการลาของ ลาอุปสมบทหรือลาประกอบพิธีฮัจญ์*/
const optionsOrdination = ref([
{ id: "0", name: "ลาอุปสมบท", code: "0" },
{ id: "1", name: "ลาประกอบพิธีฮัจญ์", code: "1" },
const optionsOrdination = ref<OptionData[]>([
{ id: 'b1', name: "ลาอุปสมบท", code: 'b1' },
{ id: 'b2', name: "ลาประกอบพิธีฮัจญ์", code: 'b2' },
]);
/** data table filter & column ของรายการลา */
const visibleColumns = ref<String[]>([
const visibleColumns = ref<string[]>([
"no",
"leaveTypeName",
"dateSendLeave",
"status",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -192,6 +194,7 @@ export const useLeaveStore = defineStore("Leave", () => {
style: "font-size: 14px; width:10%;",
},
]);
/**
*
* @param item
@ -265,6 +268,7 @@ export const useLeaveStore = defineStore("Leave", () => {
const salaryText = ref<string>(""); //เงินเดือนปัจจุบัน(ภาษาไทย)
const leaveLast = ref<any>();
const restDayCurrentTotal = ref<string>("");
//ดึงข้อมูล profile จาก API
async function fetchProfile() {
await http
@ -286,10 +290,7 @@ export const useLeaveStore = defineStore("Leave", () => {
dateAppoint.value = data.dateAppoint;
salary.value = data.salary;
salaryText.value = data.salaryText;
leaveLast.value =
date2Thai(data.leaveLast) !== "0001-01-01T00:00:00"
? date2Thai(data.leaveLast)
: "-";
leaveLast.value = data.leaveLast != "0001-01-01T00:00:00" ? date2Thai(data.leaveLast) : "-";
restDayCurrentTotal.value = data.restDayCurrentTotal;
})
.catch((e: any) => {
@ -297,6 +298,46 @@ export const useLeaveStore = defineStore("Leave", () => {
});
}
async function fetchProfileOld(data: any) {
dateSendLeave.value = data.dateSendLeave;
typeLeave.value = data.leaveTypeName;
dear.value = data.dear;
fullName.value = data.fullName;
positionName.value = data.positionName;
positionLevelName.value = data.positionLevelName;
organizationName.value = data.organizationName;
leaveLimit.value = data.leaveLimit;
leaveTotal.value = data.leaveTotal;
leaveRemain.value = data.leaveRemain;
restDayTotalOld.value = data.restDayTotalOld;
birthDate.value = data.birthDate;
dateAppoint.value = data.dateAppoint;
salary.value = data.salary;
salaryText.value = data.salaryText;
leaveLast.value = data.leaveLast != "0001-01-01T00:00:00" ? date2Thai(data.leaveLast) : "-";
restDayCurrentTotal.value = data.restDayCurrentTotal;
}
function resetForm2() {
dateSendLeave.value = undefined;
leaveTypeName.value = "";
dear.value = "";
fullName.value = "";
positionName.value = "";
positionLevelName.value = "";
organizationName.value = "";
leaveLimit.value = 0;
leaveTotal.value = 0;
leaveRemain.value = 0;
restDayTotalOld.value = 0;
birthDate.value = undefined;
dateAppoint.value = undefined;
salary.value = 0;
salaryText.value = "";
leaveLast.value = undefined;
restDayCurrentTotal.value = "";
}
return {
tabValue,
typeOptions,
@ -340,5 +381,7 @@ export const useLeaveStore = defineStore("Leave", () => {
leaveLast,
restDayCurrentTotal,
convertStatud,
resetForm2,
fetchProfileOld,
};
});