form หน้ารายละเอียดการลา

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-09 17:20:10 +07:00
parent 853f925d92
commit bfe73c0efc
14 changed files with 1524 additions and 202 deletions

View file

@ -2,6 +2,7 @@ import { defineStore } from "pinia";
import { ref, onMounted } from "vue";
import { useCounterMixin } from "@/stores/mixin";
/** importType*/
import type { DataOption } from "@/modules/09_leave/interface/index/Main";
import type { QTableProps } from "quasar";
import type { DataRows } from "@/modules/09_leave/interface/response/leave";
@ -9,11 +10,13 @@ import type { ListsData } from "@/modules/09_leave/interface/request/leave";
const mixin = useCounterMixin();
const { date2Thai, showLoader, hideLoader } = mixin;
export const useLeavelistDataStore = defineStore("leave", () => {
//TABMENU
/** TABMENU*/
const amounttab1 = ref<number>(0);
const amounttab2 = ref<number>(0);
//ข้อมูลในตาราง
/**ข้อมูลใน Table*/
const mainData = ref<any>([]);
const rows = ref<DataRows[]>([]);
const selectStatus = ref<string>("PENDING");
@ -34,6 +37,10 @@ export const useLeavelistDataStore = defineStore("leave", () => {
];
const leaveOps = ref<any>(leaveOp);
const statusOps = ref<any>(statusOp);
/**
* fetchList
* @param data Page
*/
async function fetchList(data: ListsData[]) {
let datalist = data.map((e: ListsData) => ({
id: e.id,
@ -49,18 +56,22 @@ export const useLeavelistDataStore = defineStore("leave", () => {
amounttab2.value = datalist.length;
await searchDataFn(selectType.value, selectStatus.value);
}
//filter table
/**ref ของการค้นหาข้อมูล */
const selectYear = ref<string>("all");
const selectType = ref<string>("all");
const optionYear = ref<DataOption[]>([{ id: "all", name: "ทั้งหมด" }]);
const optionType = ref<DataOption[]>([]);
const optionStatus = ref<DataOption[]>([]);
const optionTypeMain = ref<DataOption[]>([]);
const optionStatusMain = ref<DataOption[]>([]);
const filterTable = ref<string>("");
/**
* Table
* @param type
* @param status
*/
function searchDataFn(type: string, status: string) {
// selectYear.value = selectYear.value || "all"
type = type || "all";
status = status || "all";
// showLoader()
@ -132,6 +143,10 @@ export const useLeavelistDataStore = defineStore("leave", () => {
loadTable.value = false;
}, 500);
}
/**
*
*/
function clearFilter() {
selectYear.value = "all";
selectType.value = "all";
@ -139,7 +154,12 @@ export const useLeavelistDataStore = defineStore("leave", () => {
filterTable.value = "";
}
// filter option
/**
* Option Filter
* @param val
* @param update Function
* @param name Select
*/
function filterOption(val: string, update: any, name: string) {
update(() => {
const needle = val.toLowerCase();
@ -155,7 +175,10 @@ export const useLeavelistDataStore = defineStore("leave", () => {
});
}
// convertSatatus
/**
*
* @param val
*/
function convertSatatus(val: string) {
switch (val) {
case "NEW":
@ -168,6 +191,11 @@ export const useLeavelistDataStore = defineStore("leave", () => {
return "ไม่อนุมัติ";
}
}
/**
*
* @param val
*/
function convertLeave(val: string) {
switch (val) {
case "leave1":
@ -180,8 +208,29 @@ export const useLeavelistDataStore = defineStore("leave", () => {
return "ลาไปช่วยเหลือภริยาที่คลอดบุตร";
case "leave5":
return "ลาพักผ่อน";
case "leave6":
return "ลาอุปสมบท";
case "leave7":
return "ลาประกอบพิธีฮัจย์";
case "leave8":
return "ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล";
case "leave9":
return "ลาไปศึกษา";
case "leave10":
return "ลาไปฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน";
case "leave11":
return "ลาไปปฏิบัติงานในองค์การระหว่างประเทศ";
case "leave12":
return "ลาติดตามคู่สมรส";
case "leave13":
return "ลาไปฟื้นฟูสมรรถภาพด้านอาชีพ";
}
}
/**
*
* @param val
*/
function convertLeaveDaytype(val: string) {
switch (val) {
case "allday":