แก้ บัญชีแสดงวันลา
This commit is contained in:
parent
f70afa2fca
commit
5fb493bbd9
1 changed files with 105 additions and 11 deletions
|
|
@ -46,6 +46,7 @@ const dateMonth = ref<DataDateMonthObject>({
|
||||||
});
|
});
|
||||||
|
|
||||||
const dateWeek = ref<Date[]>(getCurrentWeek());
|
const dateWeek = ref<Date[]>(getCurrentWeek());
|
||||||
|
const date = ref<Date>(new Date());
|
||||||
|
|
||||||
const typeReport = ref<string>("");
|
const typeReport = ref<string>("");
|
||||||
const optionReport = ref<DataOption[]>([]);
|
const optionReport = ref<DataOption[]>([]);
|
||||||
|
|
@ -67,19 +68,25 @@ const optionReportMain = ref<DataOption[]>([
|
||||||
|
|
||||||
const employeeClass = ref<string>("officer");
|
const employeeClass = ref<string>("officer");
|
||||||
const yearType = ref<string>("FULL");
|
const yearType = ref<string>("FULL");
|
||||||
|
const leaveType = ref<string>("DAY");
|
||||||
const employeeClassMain = ref<DataOption[]>([
|
const employeeClassMain = ref<DataOption[]>([
|
||||||
{ id: "officer", name: "ข้าราชการ กทม. สามัญ" },
|
{ id: "officer", name: "ข้าราชการ กทม. สามัญ" },
|
||||||
{ id: "employee", name: "ลูกจ้างประจำ กทม." },
|
{ id: "employee", name: "ลูกจ้างประจำ กทม." },
|
||||||
]);
|
]);
|
||||||
|
const leaveTypeOptionMain = ref<DataOption[]>([
|
||||||
|
{ id: "DAY", name: "รายวัน" },
|
||||||
|
{ id: "WEEKLY", name: "รายสัปดาห์" },
|
||||||
|
{ id: "MONTH", name: "รายเดือน" },
|
||||||
|
]);
|
||||||
const yearTypeOptionMain = ref<DataOption[]>([
|
const yearTypeOptionMain = ref<DataOption[]>([
|
||||||
{ id: "FULL", name: "รายปี" },
|
{ id: "FULL", name: "รายปี" },
|
||||||
{ id: "MONTH", name: "รายเดือน" },
|
{ id: "MONTH", name: "รายเดือน" },
|
||||||
{ id: "WEEKLY", name: "รายสัปดาห์" },
|
|
||||||
{ id: "FIRSTHAFT", name: "ครึ่งปีแรก" },
|
{ id: "FIRSTHAFT", name: "ครึ่งปีแรก" },
|
||||||
{ id: "SECONDHAFT", name: "ครึ่งปีหลัง" },
|
{ id: "SECONDHAFT", name: "ครึ่งปีหลัง" },
|
||||||
]);
|
]);
|
||||||
const employeeClassOption = ref<DataOption[]>(employeeClassMain.value);
|
const employeeClassOption = ref<DataOption[]>(employeeClassMain.value);
|
||||||
const yearTypeOptionOption = ref<DataOption[]>(yearTypeOptionMain.value);
|
const yearTypeOptionOption = ref<DataOption[]>(yearTypeOptionMain.value);
|
||||||
|
const leaveTypeOptionOption = ref<DataOption[]>(leaveTypeOptionMain.value);
|
||||||
|
|
||||||
const detailReport = ref<any>();
|
const detailReport = ref<any>();
|
||||||
const isReport = ref<boolean>(false);
|
const isReport = ref<boolean>(false);
|
||||||
|
|
@ -122,7 +129,11 @@ function onSelectedNode(data: any) {
|
||||||
* และเรียกข้อมูลรายงาน
|
* และเรียกข้อมูลรายงาน
|
||||||
*/
|
*/
|
||||||
async function updateLeaveday() {
|
async function updateLeaveday() {
|
||||||
switch (yearType.value) {
|
const list =
|
||||||
|
typeReport.value == "3" || typeReport.value == "4"
|
||||||
|
? leaveType.value
|
||||||
|
: yearType.value;
|
||||||
|
switch (list) {
|
||||||
case "FULL":
|
case "FULL":
|
||||||
dateStart.value = new Date(year.value - 1, 9, 1);
|
dateStart.value = new Date(year.value - 1, 9, 1);
|
||||||
dateEnd.value = new Date(year.value, 8, 30);
|
dateEnd.value = new Date(year.value, 8, 30);
|
||||||
|
|
@ -157,6 +168,12 @@ async function updateLeaveday() {
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "DAY":
|
||||||
|
dateStart.value = new Date(date.value);
|
||||||
|
dateEnd.value = new Date(date.value);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case "SECONDHAFT":
|
case "SECONDHAFT":
|
||||||
dateStart.value = new Date(year.value, 3, 1);
|
dateStart.value = new Date(year.value, 3, 1);
|
||||||
dateEnd.value = new Date(year.value, 8, 30);
|
dateEnd.value = new Date(year.value, 8, 30);
|
||||||
|
|
@ -196,6 +213,8 @@ async function fetchLeaveday(
|
||||||
? "MONTH"
|
? "MONTH"
|
||||||
: year == "HAFT"
|
: year == "HAFT"
|
||||||
? "HAFT"
|
? "HAFT"
|
||||||
|
: year == "DAY"
|
||||||
|
? "DAY"
|
||||||
: "WEEKLY",
|
: "WEEKLY",
|
||||||
startDate: dateToISO(startDate),
|
startDate: dateToISO(startDate),
|
||||||
endDate: dateToISO(endDate),
|
endDate: dateToISO(endDate),
|
||||||
|
|
@ -304,6 +323,7 @@ function clearData() {
|
||||||
org.value = "";
|
org.value = "";
|
||||||
typeReport.value = "";
|
typeReport.value = "";
|
||||||
yearType.value = "FULL";
|
yearType.value = "FULL";
|
||||||
|
leaveType.value = "DAY";
|
||||||
pdfSrc.value = undefined;
|
pdfSrc.value = undefined;
|
||||||
detailReport.value = undefined;
|
detailReport.value = undefined;
|
||||||
|
|
||||||
|
|
@ -322,7 +342,9 @@ function onSearch() {
|
||||||
updateLeaveday();
|
updateLeaveday();
|
||||||
fetchLeaveday(
|
fetchLeaveday(
|
||||||
employeeClass.value,
|
employeeClass.value,
|
||||||
yearType.value,
|
typeReport.value == "3" || typeReport.value == "4"
|
||||||
|
? leaveType.value
|
||||||
|
: yearType.value,
|
||||||
dateStart.value,
|
dateStart.value,
|
||||||
dateEnd.value
|
dateEnd.value
|
||||||
);
|
);
|
||||||
|
|
@ -338,6 +360,13 @@ function getCurrentWeek() {
|
||||||
return [firstDayOfWeek, lastDayOfWeek];
|
return [firstDayOfWeek, lastDayOfWeek];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateValue(val: string) {
|
||||||
|
if (typeReport.value == "3" || typeReport.value == "4") {
|
||||||
|
leaveType.value = val;
|
||||||
|
} else {
|
||||||
|
yearType.value = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
function formatWeekDisplay(week: Date[]) {
|
function formatWeekDisplay(week: Date[]) {
|
||||||
if (week) {
|
if (week) {
|
||||||
if (!week[0] || !week[1]) return "";
|
if (!week[0] || !week[1]) return "";
|
||||||
|
|
@ -598,19 +627,33 @@ onMounted(() => {
|
||||||
<q-select
|
<q-select
|
||||||
class="bg-white"
|
class="bg-white"
|
||||||
dense
|
dense
|
||||||
v-model="yearType"
|
:model-value="
|
||||||
:options="yearTypeOptionOption"
|
typeReport == '3' || typeReport == '4'
|
||||||
|
? leaveType
|
||||||
|
: yearType
|
||||||
|
"
|
||||||
|
:options="
|
||||||
|
typeReport == '3' || typeReport == '4'
|
||||||
|
? leaveTypeOptionOption
|
||||||
|
: yearTypeOptionOption
|
||||||
|
"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
@update:model-value="updateLeaveday"
|
@update:model-value="(value:any)=>(updateValue(value),updateLeaveday)"
|
||||||
>
|
>
|
||||||
</q-select>
|
</q-select>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="col-12"
|
class="col-12"
|
||||||
v-if="yearType !== 'MONTH' && yearType !== 'WEEKLY'"
|
v-if="
|
||||||
|
leaveType !== 'DAY' &&
|
||||||
|
leaveType !== 'MONTH' &&
|
||||||
|
leaveType !== 'WEEKLY' &&
|
||||||
|
yearType !== 'MONTH' &&
|
||||||
|
yearType !== 'WEEKLY'
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<datepicker
|
<datepicker
|
||||||
v-model="year"
|
v-model="year"
|
||||||
|
|
@ -646,7 +689,13 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="col-12"
|
class="col-12"
|
||||||
v-if="yearType !== 'MONTH' && yearType !== 'WEEKLY'"
|
v-if="
|
||||||
|
leaveType !== 'DAY' &&
|
||||||
|
leaveType !== 'MONTH' &&
|
||||||
|
leaveType !== 'WEEKLY' &&
|
||||||
|
yearType !== 'MONTH' &&
|
||||||
|
yearType !== 'WEEKLY'
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<datepicker
|
<datepicker
|
||||||
menu-class-name="modalfix"
|
menu-class-name="modalfix"
|
||||||
|
|
@ -686,7 +735,13 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="col-12"
|
class="col-12"
|
||||||
v-if="yearType !== 'MONTH' && yearType !== 'WEEKLY'"
|
v-if="
|
||||||
|
leaveType !== 'DAY' &&
|
||||||
|
leaveType !== 'MONTH' &&
|
||||||
|
leaveType !== 'WEEKLY' &&
|
||||||
|
yearType !== 'MONTH' &&
|
||||||
|
yearType !== 'WEEKLY'
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<datepicker
|
<datepicker
|
||||||
menu-class-name="modalfix"
|
menu-class-name="modalfix"
|
||||||
|
|
@ -722,7 +777,10 @@ onMounted(() => {
|
||||||
</template>
|
</template>
|
||||||
</datepicker>
|
</datepicker>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12" v-if="yearType == 'MONTH'">
|
<div
|
||||||
|
class="col-12"
|
||||||
|
v-if="leaveType == 'MONTH' && yearType == 'MONTH'"
|
||||||
|
>
|
||||||
<datepicker
|
<datepicker
|
||||||
v-model="dateMonth"
|
v-model="dateMonth"
|
||||||
:locale="'th'"
|
:locale="'th'"
|
||||||
|
|
@ -754,7 +812,10 @@ onMounted(() => {
|
||||||
</template>
|
</template>
|
||||||
</datepicker>
|
</datepicker>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12" v-if="yearType == 'WEEKLY'">
|
<div
|
||||||
|
class="col-12"
|
||||||
|
v-if="leaveType == 'WEEKLY' && yearType == 'WEEKLY'"
|
||||||
|
>
|
||||||
<datepicker
|
<datepicker
|
||||||
v-model="dateWeek"
|
v-model="dateWeek"
|
||||||
:locale="'th'"
|
:locale="'th'"
|
||||||
|
|
@ -785,6 +846,39 @@ onMounted(() => {
|
||||||
</template>
|
</template>
|
||||||
</datepicker>
|
</datepicker>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-12" v-if="leaveType == 'DAY'">
|
||||||
|
<datepicker
|
||||||
|
menu-class-name="modalfix"
|
||||||
|
v-model="date"
|
||||||
|
:locale="'th'"
|
||||||
|
autoApply
|
||||||
|
:enableTimePicker="false"
|
||||||
|
week-start="0"
|
||||||
|
@update:model-value="updateLeaveday"
|
||||||
|
>
|
||||||
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
parseInt(value + 543)
|
||||||
|
}}</template>
|
||||||
|
<template #trigger>
|
||||||
|
<q-input
|
||||||
|
class="bg-white"
|
||||||
|
dense
|
||||||
|
:model-value="date ? date2Thai(date) : null"
|
||||||
|
:label="`${'วันที่'}`"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon
|
||||||
|
name="event"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
|
</q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
</datepicker>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue