updated ระบบลา
This commit is contained in:
parent
cab7450748
commit
e4cb83a9b3
6 changed files with 51 additions and 28 deletions
|
|
@ -89,8 +89,9 @@ async function fetchDataCalendar(type: string) {
|
||||||
];
|
];
|
||||||
|
|
||||||
filterLists.value = [];
|
filterLists.value = [];
|
||||||
for (let i = 1; i <= double_name.length; i++) {
|
|
||||||
const name = double_name[i - 1];
|
for (let i = 0; i < double_name.length; i++) {
|
||||||
|
const name = double_name[i];
|
||||||
const filterName = {
|
const filterName = {
|
||||||
id: name,
|
id: name,
|
||||||
name: convertKeycloakId(name),
|
name: convertKeycloakId(name),
|
||||||
|
|
@ -98,7 +99,9 @@ async function fetchDataCalendar(type: string) {
|
||||||
};
|
};
|
||||||
|
|
||||||
filterLists.value.push(filterName);
|
filterLists.value.push(filterName);
|
||||||
type === "onMounted" && filterVal.value.push(name);
|
if (type === "onMounted") {
|
||||||
|
filterVal.value.push(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const eventData = filterVal.value.map((item: any) => {
|
const eventData = filterVal.value.map((item: any) => {
|
||||||
return mainData.value
|
return mainData.value
|
||||||
|
|
@ -115,7 +118,7 @@ async function fetchDataCalendar(type: string) {
|
||||||
});
|
});
|
||||||
const allEventData = [].concat(...eventData);
|
const allEventData = [].concat(...eventData);
|
||||||
calendarOptions.value.events = allEventData;
|
calendarOptions.value.events = allEventData;
|
||||||
await fetchDataHoliday(calendarOptions.value.events);
|
fetchDataHoliday(calendarOptions.value.events);
|
||||||
})
|
})
|
||||||
|
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -141,8 +144,6 @@ async function fetchDataHoliday(optionsCalendaMain: any) {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res);
|
|
||||||
|
|
||||||
const dataNormal = res.data.result.normal;
|
const dataNormal = res.data.result.normal;
|
||||||
const data = dataNormal;
|
const data = dataNormal;
|
||||||
const event = data.map((e: any) => ({
|
const event = data.map((e: any) => ({
|
||||||
|
|
@ -220,6 +221,7 @@ watch(
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const user = await tokenParsed();
|
const user = await tokenParsed();
|
||||||
keycloakId.value = user?.sub;
|
keycloakId.value = user?.sub;
|
||||||
|
leaveStore.leaveTypeList();
|
||||||
await fetchDataCalendar("onMounted");
|
await fetchDataCalendar("onMounted");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ const formDataReject = reactive<FormReject>({
|
||||||
leaveTotal: 0, //จำนวนวันที่ลา
|
leaveTotal: 0, //จำนวนวันที่ลา
|
||||||
leaveStartDate: new Date(), //วัน เดือน ปีเริ่มต้นลา
|
leaveStartDate: new Date(), //วัน เดือน ปีเริ่มต้นลา
|
||||||
leaveEndDate: new Date(), //วัน เดือน ปีสิ้นสุดลา
|
leaveEndDate: new Date(), //วัน เดือน ปีสิ้นสุดลา
|
||||||
|
leaveDirectorComment: "", //ความคิดเห็นของผู้บังคับบัญชา
|
||||||
});
|
});
|
||||||
|
|
||||||
const formData = reactive<FremData>({
|
const formData = reactive<FremData>({
|
||||||
|
|
@ -195,6 +196,7 @@ async function fetchDetailDeleteLeave(paramsId: string) {
|
||||||
formDataReject.leaveTotal = data.leaveTotal;
|
formDataReject.leaveTotal = data.leaveTotal;
|
||||||
formDataReject.leaveStartDate = data.leaveStartDate;
|
formDataReject.leaveStartDate = data.leaveStartDate;
|
||||||
formDataReject.leaveEndDate = data.leaveEndDate;
|
formDataReject.leaveEndDate = data.leaveEndDate;
|
||||||
|
formDataReject.leaveDirectorComment = data.leaveDirectorComment;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -778,7 +780,7 @@ async function checkOfficer() {
|
||||||
{{
|
{{
|
||||||
formDataReject.status == "NEW"
|
formDataReject.status == "NEW"
|
||||||
? "-"
|
? "-"
|
||||||
: formDataReject.leaveReasonDelete
|
: formDataReject.leaveDirectorComment
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -73,14 +73,15 @@ async function fecthLeaveList() {
|
||||||
/** function เรียกข้อมูลสถานะ*/
|
/** function เรียกข้อมูลสถานะ*/
|
||||||
async function fetchOption() {
|
async function fetchOption() {
|
||||||
if (leaveStore.dataToobar.length == 0) {
|
if (leaveStore.dataToobar.length == 0) {
|
||||||
await http
|
leaveStore.leaveTypeList();
|
||||||
.get(config.API.leaveType())
|
// await http
|
||||||
.then((res) => {
|
// .get(config.API.leaveType())
|
||||||
leaveStore.leaveTypeOption(res.data.result);
|
// .then((res) => {
|
||||||
})
|
// leaveStore.leaveTypeOption(res.data.result);
|
||||||
.catch((err) => {
|
// })
|
||||||
messageError($q, err);
|
// .catch((err) => {
|
||||||
});
|
// messageError($q, err);
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,14 +73,15 @@ async function fecthLeaveList() {
|
||||||
/** function เรียกข้อมูลสถานะ*/
|
/** function เรียกข้อมูลสถานะ*/
|
||||||
async function fetchOption() {
|
async function fetchOption() {
|
||||||
if (leaveStore.dataToobar.length == 0) {
|
if (leaveStore.dataToobar.length == 0) {
|
||||||
await http
|
leaveStore.leaveTypeList();
|
||||||
.get(config.API.leaveType())
|
// await http
|
||||||
.then((res) => {
|
// .get(config.API.leaveType())
|
||||||
leaveStore.leaveTypeOption(res.data.result);
|
// .then((res) => {
|
||||||
})
|
// leaveStore.leaveTypeOption(res.data.result);
|
||||||
.catch((err) => {
|
// })
|
||||||
messageError($q, err);
|
// .catch((err) => {
|
||||||
});
|
// messageError($q, err);
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,9 @@ interface FormData {
|
||||||
status: string;
|
status: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RowsType{
|
interface RowsType {
|
||||||
commanders:SeqTypeRow[]
|
commanders: SeqTypeRow[];
|
||||||
approvers:SeqTypeRow[]
|
approvers: SeqTypeRow[];
|
||||||
}
|
}
|
||||||
interface SeqTypeRow {
|
interface SeqTypeRow {
|
||||||
seq: number;
|
seq: number;
|
||||||
|
|
@ -80,6 +80,7 @@ interface FormReject {
|
||||||
leaveTotal: number; //จำนวนวันที่ลา
|
leaveTotal: number; //จำนวนวันที่ลา
|
||||||
leaveStartDate: Date; //วัน เดือน ปีเริ่มต้นลา
|
leaveStartDate: Date; //วัน เดือน ปีเริ่มต้นลา
|
||||||
leaveEndDate: Date; //วัน เดือน ปีสิ้นสุดลา
|
leaveEndDate: Date; //วัน เดือน ปีสิ้นสุดลา
|
||||||
|
leaveDirectorComment?: string; //ความคิดเห็นของผู้บังคับบัญชา
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ResCalendar {
|
interface ResCalendar {
|
||||||
|
|
@ -103,5 +104,5 @@ export type {
|
||||||
FormReject,
|
FormReject,
|
||||||
ResCalendar,
|
ResCalendar,
|
||||||
SeqTypeRow,
|
SeqTypeRow,
|
||||||
RowsType
|
RowsType,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ import type {
|
||||||
ListLeave,
|
ListLeave,
|
||||||
} from "@/modules/09_leave/interface/response/leave";
|
} from "@/modules/09_leave/interface/response/leave";
|
||||||
import type { FremData } from "@/modules/09_leave/interface/request/leave";
|
import type { FremData } from "@/modules/09_leave/interface/request/leave";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { date2Thai } = mixin;
|
const { date2Thai } = mixin;
|
||||||
|
|
@ -162,6 +164,19 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function ข้อมูลประเภทการลา*/
|
||||||
|
async function leaveTypeList() {
|
||||||
|
if (leaveType.value.length == 0) {
|
||||||
|
await http.get(config.API.leaveType()).then((res) => {
|
||||||
|
leaveType.value = res.data.result;
|
||||||
|
leaveTypeOption(res.data.result);
|
||||||
|
return res.data.result;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return leaveType.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function colorType(val: string) {
|
function colorType(val: string) {
|
||||||
const dataType = leaveType.value.find((item: any) => item.id === val);
|
const dataType = leaveType.value.find((item: any) => item.id === val);
|
||||||
switch (dataType.code) {
|
switch (dataType.code) {
|
||||||
|
|
@ -191,7 +206,7 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
function leaveTypeOption(val: any) {
|
function leaveTypeOption(val: any) {
|
||||||
dataToobar.value = val.map((e: any) => ({
|
dataToobar.value = leaveType.value.map((e: any) => ({
|
||||||
id: e.id,
|
id: e.id,
|
||||||
name: e.name,
|
name: e.name,
|
||||||
code: e.code,
|
code: e.code,
|
||||||
|
|
@ -214,5 +229,6 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
||||||
colorType,
|
colorType,
|
||||||
converstType,
|
converstType,
|
||||||
leaveTypeOption,
|
leaveTypeOption,
|
||||||
|
leaveTypeList,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue