Merge branch 'develop' into devTee
This commit is contained in:
commit
743401b19e
5 changed files with 98 additions and 45 deletions
|
|
@ -77,18 +77,18 @@ const dateMonth = ref<DataDateMonthObject>({
|
|||
const mainData = ref<ResCalendar[]>([]);
|
||||
|
||||
/** function เรียกข้อมูล Calendar*/
|
||||
async function fetchDataCalendar() {
|
||||
async function fetchDataCalendar(type: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.leaveCalendar(), {
|
||||
year: dateMonth.value.year,
|
||||
})
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
mainData.value = res.data.result;
|
||||
|
||||
const double_name = [
|
||||
...new Set(mainData.value.map((item: ResCalendar) => item.keycloakId)),
|
||||
];
|
||||
|
||||
filterLists.value = [];
|
||||
for (let i = 1; i <= double_name.length; i++) {
|
||||
const name = double_name[i - 1];
|
||||
|
|
@ -99,23 +99,24 @@ async function fetchDataCalendar() {
|
|||
};
|
||||
|
||||
filterLists.value.push(filterName);
|
||||
filterVal.value.push(name);
|
||||
type === "onMounted" && filterVal.value.push(name);
|
||||
}
|
||||
|
||||
const data = mainData.value.filter(
|
||||
(e: any) => e.keycloakId === keycloakId.value
|
||||
);
|
||||
const event = data.map((e: any) => ({
|
||||
id: e.id,
|
||||
title: `${e.fullName} (${e.leaveTypeName}) `,
|
||||
start: e.leaveStartDate,
|
||||
end: moment(e.leaveEndDate).format("YYYY-MM-DD") + " 23:59:59",
|
||||
allDay: false,
|
||||
color: leaveStore.colorType(e.leaveTypeId),
|
||||
textColor: "black",
|
||||
}));
|
||||
|
||||
calendarOptions.value.events = event;
|
||||
const eventData = filterVal.value.map((item: any) => {
|
||||
return mainData.value
|
||||
.filter((e: ResCalendar) => e.keycloakId === item)
|
||||
.map((e: ResCalendar) => ({
|
||||
id: e.id,
|
||||
title: `${e.fullName} (${e.leaveTypeName}) `,
|
||||
start: e.leaveStartDate,
|
||||
end: moment(e.leaveEndDate).format("YYYY-MM-DD") + " 23:59:59",
|
||||
color: leaveStore.colorType(e.leaveTypeId),
|
||||
textColor: "black",
|
||||
allDay: false,
|
||||
}));
|
||||
});
|
||||
const allEventData = [].concat(...eventData);
|
||||
calendarOptions.value.events = allEventData;
|
||||
await fetchDataHoliday(calendarOptions.value.events);
|
||||
})
|
||||
|
||||
.catch((err) => {
|
||||
|
|
@ -129,6 +130,40 @@ async function fetchDataCalendar() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch วันหยุดในปฏิทิน
|
||||
*/
|
||||
async function fetchDataHoliday(optionsCalendaMain: any) {
|
||||
await http
|
||||
.get(
|
||||
config.API.listHolidayHistoryYearMonth(
|
||||
dateMonth.value.year,
|
||||
dateMonth.value.month + 1
|
||||
)
|
||||
)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
|
||||
const dataNormal = res.data.result.normal;
|
||||
const data = dataNormal;
|
||||
const event = data.map((e: any) => ({
|
||||
id: e.id,
|
||||
title: `${e.name} `,
|
||||
start: e.holidayDate,
|
||||
end: new Date(
|
||||
new Date(e.holidayDate).setHours(23, 59, 59)
|
||||
).toISOString(),
|
||||
allDay: e.holidayDate === e.holidayDate ? true : false,
|
||||
color: " #CCE5FF",
|
||||
textColor: "#0080FF",
|
||||
}));
|
||||
calendarOptions.value.events = [...optionsCalendaMain, ...event];
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function convert ชื่อ
|
||||
* @param id profile
|
||||
|
|
@ -146,7 +181,7 @@ const filterVal = ref<any>([]);
|
|||
|
||||
watch(
|
||||
() => filterVal.value,
|
||||
() => {
|
||||
async () => {
|
||||
const eventData = filterVal.value.map((item: any) => {
|
||||
return mainData.value
|
||||
.filter((e: ResCalendar) => e.keycloakId === item)
|
||||
|
|
@ -162,6 +197,7 @@ watch(
|
|||
});
|
||||
const allEventData = [].concat(...eventData);
|
||||
calendarOptions.value.events = allEventData;
|
||||
await fetchDataHoliday(calendarOptions.value.events);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -173,12 +209,12 @@ function redirectToDetail(id: string) {
|
|||
* เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้
|
||||
*/
|
||||
onMounted(async () => {
|
||||
await fetchDataCalendar();
|
||||
await fetchDataCalendar("onMounted");
|
||||
});
|
||||
|
||||
/** function เปลี่ยน calendar*/
|
||||
async function changCalendar() {
|
||||
await fetchDataCalendar();
|
||||
await fetchDataCalendar("chang");
|
||||
}
|
||||
|
||||
const monthYearThai = (val: DataDateMonthObject) => {
|
||||
|
|
@ -282,6 +318,15 @@ const monthYearThai = (val: DataDateMonthObject) => {
|
|||
/>
|
||||
<span class="text-caption">{{ item.name }}</span>
|
||||
</div>
|
||||
<div class="items-center col-3">
|
||||
<q-icon
|
||||
size="10px"
|
||||
name="mdi-circle"
|
||||
class="q-mr-xs"
|
||||
style="color: #cce5ff"
|
||||
/>
|
||||
<span class="text-caption">วันหยุดในปฏิทิน</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -32,17 +32,18 @@ async function fetchSigner() {
|
|||
.get(config.API.evaluationSigner(id.value, 1))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
formCommand.elementaryFullName =
|
||||
data == null ? "" : data.commanderFullname;
|
||||
formCommand.elementaryPosition =
|
||||
data == null ? "" : data.commanderPosition;
|
||||
formCommand.abovelevelFullname =
|
||||
data == null ? "" : data.commanderAboveFullname;
|
||||
formCommand.abovelevelPosition =
|
||||
data == null ? "" : data.commanderAbovePosition;
|
||||
|
||||
author.value = data.author;
|
||||
subject.value = data.subject;
|
||||
if (data) {
|
||||
formCommand.elementaryFullName =
|
||||
data == null ? "" : data.commanderFullname;
|
||||
formCommand.elementaryPosition =
|
||||
data == null ? "" : data.commanderPosition;
|
||||
formCommand.abovelevelFullname =
|
||||
data == null ? "" : data.commanderAboveFullname;
|
||||
formCommand.abovelevelPosition =
|
||||
data == null ? "" : data.commanderAbovePosition;
|
||||
author.value = data.author;
|
||||
subject.value = data.subject;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -69,6 +70,7 @@ onMounted(async () => {
|
|||
<div class="col-xs-12 col-sm-12 row">
|
||||
<div class="row col-12 q-col-gutter-md q-pa-sm">
|
||||
<q-input
|
||||
readonly
|
||||
dense
|
||||
class="col-xs-12 col-sm-6"
|
||||
outlined
|
||||
|
|
|
|||
|
|
@ -218,8 +218,10 @@ async function fetchDataSigner() {
|
|||
.get(config.API.evaluationSigner(id.value, 1))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
author.value = data.author;
|
||||
subject.value = data.subject;
|
||||
if (data) {
|
||||
author.value = data.author;
|
||||
subject.value = data.subject;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
|
|||
|
|
@ -56,13 +56,15 @@ async function getSigner() {
|
|||
.get(config.API.evaluationSigner(id.value, 2))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
formCommand.elementaryFullName = data.commanderFullnameDoc2;
|
||||
formCommand.elementaryPosition = data.commanderPositionDoc2;
|
||||
formCommand.abovelevelFullname = data.commanderAboveFullnameDoc2;
|
||||
formCommand.abovelevelPosition = data.commanderAbovePositionDoc2;
|
||||
author.value = data.authorDoc2;
|
||||
subject.value = data.subjectDoc2;
|
||||
assignedPosition.value = data.assignedPosition;
|
||||
if (data) {
|
||||
formCommand.elementaryFullName = data.commanderFullnameDoc2;
|
||||
formCommand.elementaryPosition = data.commanderPositionDoc2;
|
||||
formCommand.abovelevelFullname = data.commanderAboveFullnameDoc2;
|
||||
formCommand.abovelevelPosition = data.commanderAbovePositionDoc2;
|
||||
author.value = data.authorDoc2;
|
||||
subject.value = data.subjectDoc2;
|
||||
assignedPosition.value = data.assignedPosition;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
// messageError($q, e);
|
||||
|
|
|
|||
|
|
@ -330,9 +330,11 @@ async function fetchDataSigner() {
|
|||
.get(config.API.evaluationSigner(id.value, 2))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
author.value = data.authorDoc2;
|
||||
subject.value = data.subjectDoc2;
|
||||
assignedPosition.value = data.assignedPosition;
|
||||
if (data) {
|
||||
author.value = data.authorDoc2;
|
||||
subject.value = data.subjectDoc2;
|
||||
assignedPosition.value = data.assignedPosition;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue