Merge branch 'develop' into NiceDev
This commit is contained in:
commit
f441925464
6 changed files with 954 additions and 1216 deletions
|
|
@ -21,6 +21,7 @@ export default {
|
||||||
leaveStats: () => `${leave}/user/summary`,
|
leaveStats: () => `${leave}/user/summary`,
|
||||||
leaveUser: () => `${leave}/user`,
|
leaveUser: () => `${leave}/user`,
|
||||||
leaveUserId: (id: string) => `${leave}/user/${id}`,
|
leaveUserId: (id: string) => `${leave}/user/${id}`,
|
||||||
|
leaveUserSendId: (id: string) => `${leave}/user/send/${id}`,
|
||||||
leaveProfile: () => `${leave}/user/profile`,
|
leaveProfile: () => `${leave}/user/profile`,
|
||||||
leaveCheck: () => `${leave}/user/check`,
|
leaveCheck: () => `${leave}/user/check`,
|
||||||
leaveReport: (id: string) => `${leave}/report/${id}`,
|
leaveReport: (id: string) => `${leave}/report/${id}`,
|
||||||
|
|
|
||||||
|
|
@ -1,83 +1,82 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue"
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar"
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http"
|
||||||
import config from "@/app.config";
|
import config from "@/app.config"
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router"
|
||||||
|
|
||||||
/** import type*/
|
/** import type*/
|
||||||
import type { LeaveType } from "@/modules/05_leave/interface/response/leave";
|
import type { LeaveType } from "@/modules/05_leave/interface/response/leave"
|
||||||
|
|
||||||
/** import componest*/
|
/** import componest*/
|
||||||
import DialogDetail from "@/modules/05_leave/components/DialogDetail.vue";
|
import DialogDetail from "@/modules/05_leave/components/DialogDetail.vue"
|
||||||
import Table from "@/modules/05_leave/components/Table.vue";
|
import Table from "@/modules/05_leave/components/Table.vue"
|
||||||
|
|
||||||
/** import stort*/
|
/** import stort*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin"
|
||||||
import { useLeaveStore } from "@/modules/05_leave/store";
|
import { useLeaveStore } from "@/modules/05_leave/store"
|
||||||
|
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin()
|
||||||
const { showLoader, hideLoader, messageError, date2Thai, monthYear2Thai } =
|
const { showLoader, hideLoader, messageError, date2Thai, monthYear2Thai } = mixin
|
||||||
mixin;
|
const LeaveData = useLeaveStore()
|
||||||
const LeaveData = useLeaveStore();
|
const router = useRouter()
|
||||||
const router = useRouter();
|
const route = useRoute()
|
||||||
const route = useRoute();
|
const $q = useQuasar()
|
||||||
const $q = useQuasar();
|
|
||||||
|
|
||||||
/** filter */
|
/** filter */
|
||||||
const year = ref<number>(new Date().getFullYear());
|
const year = ref<number>(new Date().getFullYear())
|
||||||
const type = ref<string>("00000000-0000-0000-0000-000000000000");
|
const type = ref<string>("00000000-0000-0000-0000-000000000000")
|
||||||
const status = ref<string>("ALL");
|
const status = ref<string>("ALL")
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("")
|
||||||
|
|
||||||
/** pagination*/
|
/** pagination*/
|
||||||
const maxPage = ref<number>(1);
|
const maxPage = ref<number>(1)
|
||||||
const page = ref<number>(1);
|
const page = ref<number>(1)
|
||||||
const pageSize = ref<number>(10);
|
const pageSize = ref<number>(10)
|
||||||
|
|
||||||
/** function เรียกข้อมูลการลา*/
|
/** function เรียกข้อมูลการลา*/
|
||||||
async function fetchDataTable() {
|
async function fetchDataTable() {
|
||||||
showLoader();
|
showLoader()
|
||||||
const body = {
|
const body = {
|
||||||
year: year.value, //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
year: year.value, //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
||||||
type: type.value, //*Id ประเภทการลา
|
type: type.value, //*Id ประเภทการลา
|
||||||
status: status.value, //*สถานะการของลา
|
status: status.value, //*สถานะการของลา
|
||||||
page: page.value.toString(), //*หน้า
|
page: page.value.toString(), //*หน้า
|
||||||
pageSize: pageSize.value.toString(), //*จำนวนแถวต่อหน้า
|
pageSize: pageSize.value.toString(), //*จำนวนแถวต่อหน้า
|
||||||
keyword: filter.value, //keyword ค้นหา
|
keyword: filter.value, //keyword ค้นหา
|
||||||
};
|
}
|
||||||
await http
|
await http
|
||||||
.post(config.API.leaveTableList(), body)
|
.post(config.API.leaveTableList(), body)
|
||||||
.then((res) => {
|
.then(res => {
|
||||||
const data = res.data.result.data;
|
const data = res.data.result.data
|
||||||
LeaveData.fetchListLeave(data);
|
LeaveData.fetchListLeave(data)
|
||||||
maxPage.value = Math.ceil(res.data.result.total / pageSize.value);
|
maxPage.value = Math.ceil(res.data.result.total / pageSize.value)
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
messageError($q, err);
|
messageError($q, err)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader()
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const leaveType = ref<LeaveType[]>();
|
const leaveType = ref<LeaveType[]>()
|
||||||
/** function เรียกประเภทการลา */
|
/** function เรียกประเภทการลา */
|
||||||
async function fectOptionType() {
|
async function fectOptionType() {
|
||||||
await http
|
await http
|
||||||
.get(config.API.leaveType())
|
.get(config.API.leaveType())
|
||||||
.then(async (res) => {
|
.then(async res => {
|
||||||
leaveType.value = res.data.result;
|
leaveType.value = res.data.result
|
||||||
LeaveData.fetchLeaveType(res.data.result);
|
LeaveData.fetchLeaveType(res.data.result)
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
messageError($q, err);
|
messageError($q, err)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const modal = ref<boolean>(false);
|
const modal = ref<boolean>(false)
|
||||||
const leaveId = ref<string>("");
|
const leaveId = ref<string>("")
|
||||||
const leaveStatus = ref<string>("");
|
const leaveStatus = ref<string>("")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function openPopupDateail
|
* function openPopupDateail
|
||||||
|
|
@ -85,18 +84,18 @@ const leaveStatus = ref<string>("");
|
||||||
* @param status การลา
|
* @param status การลา
|
||||||
*/
|
*/
|
||||||
const onClickView = async (id: string, status: string) => {
|
const onClickView = async (id: string, status: string) => {
|
||||||
modal.value = true;
|
modal.value = true
|
||||||
leaveId.value = id;
|
leaveId.value = id
|
||||||
leaveStatus.value = status;
|
leaveStatus.value = status
|
||||||
};
|
}
|
||||||
|
|
||||||
const onClickEdit = async (id: string) => {
|
const onClickEdit = async (id: string) => {
|
||||||
router.push(`/leave/edit/${id}`);
|
router.push(`/leave/edit/${id}`)
|
||||||
};
|
}
|
||||||
|
|
||||||
/** function closePopup*/
|
/** function closePopup*/
|
||||||
async function onClickClose() {
|
async function onClickClose() {
|
||||||
modal.value = false;
|
modal.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -107,13 +106,13 @@ async function onClickClose() {
|
||||||
* @param k คำค้นหา
|
* @param k คำค้นหา
|
||||||
*/
|
*/
|
||||||
async function updateFilterTable(y: number, t: string, s: string, k: string) {
|
async function updateFilterTable(y: number, t: string, s: string, k: string) {
|
||||||
if (t && s) {
|
if (t && s) {
|
||||||
year.value = await y;
|
year.value = await y
|
||||||
type.value = await t;
|
type.value = await t
|
||||||
status.value = await s;
|
status.value = await s
|
||||||
filter.value = await k;
|
filter.value = await k
|
||||||
await fetchDataTable();
|
await fetchDataTable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -122,152 +121,96 @@ async function updateFilterTable(y: number, t: string, s: string, k: string) {
|
||||||
* @param ps แถวต่อหน้า
|
* @param ps แถวต่อหน้า
|
||||||
*/
|
*/
|
||||||
async function updatePagination(p: number, ps: number) {
|
async function updatePagination(p: number, ps: number) {
|
||||||
(page.value = await p), (pageSize.value = await ps);
|
;(page.value = await p), (pageSize.value = await ps)
|
||||||
await fetchDataTable();
|
await fetchDataTable()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้
|
* เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้
|
||||||
*/
|
*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchDataTable();
|
await fetchDataTable()
|
||||||
await fectOptionType();
|
await fectOptionType()
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<Table
|
<Table
|
||||||
:rows="LeaveData.rows"
|
:rows="LeaveData.rows"
|
||||||
:columns="LeaveData.columns"
|
:columns="LeaveData.columns"
|
||||||
:visible-columns="LeaveData.visibleColumns"
|
:visible-columns="LeaveData.visibleColumns"
|
||||||
v-model:inputfilter="filter"
|
v-model:inputfilter="filter"
|
||||||
v-model:inputvisible="LeaveData.visibleColumns"
|
v-model:inputvisible="LeaveData.visibleColumns"
|
||||||
:inputShow="true"
|
:inputShow="true"
|
||||||
:grid="$q.screen.gt.xs ? false : true"
|
:grid="$q.screen.gt.xs ? false : true"
|
||||||
@update:filter="updateFilterTable"
|
@update:filter="updateFilterTable"
|
||||||
@update:Pagination="updatePagination"
|
@update:Pagination="updatePagination"
|
||||||
:maxPage="maxPage"
|
:maxPage="maxPage"
|
||||||
:pageSize="pageSize"
|
:pageSize="pageSize"
|
||||||
:leaveType="leaveType"
|
:leaveType="leaveType"
|
||||||
>
|
>
|
||||||
<template #columns="props">
|
<template #columns="props">
|
||||||
<q-tr :props="props" class="cursor-pointer">
|
<q-tr :props="props" class="cursor-pointer">
|
||||||
<q-td
|
<q-td key="no" :props="props" @click="onClickView(props.row.id, props.row.status)">
|
||||||
key="no"
|
{{ (page - 1) * pageSize + props.rowIndex + 1 }}
|
||||||
:props="props"
|
</q-td>
|
||||||
@click="onClickView(props.row.id, props.row.status)"
|
<q-td key="leaveTypeName" :props="props" @click="onClickView(props.row.id, props.row.status)">
|
||||||
>
|
{{ props.row.leaveTypeName }}
|
||||||
{{ (page - 1) * pageSize + props.rowIndex + 1 }}
|
</q-td>
|
||||||
</q-td>
|
<q-td key="dateLeave" :props="props">
|
||||||
<q-td
|
{{ props.row.dateLeave }}
|
||||||
key="leaveTypeName"
|
</q-td>
|
||||||
:props="props"
|
<q-td key="dateSendLeave" :props="props" @click="onClickView(props.row.id, props.row.status)">
|
||||||
@click="onClickView(props.row.id, props.row.status)"
|
{{ props.row.dateSendLeave }}
|
||||||
>
|
</q-td>
|
||||||
{{ props.row.leaveTypeName }}
|
|
||||||
</q-td>
|
|
||||||
<q-td
|
|
||||||
key="dateSendLeave"
|
|
||||||
:props="props"
|
|
||||||
@click="onClickView(props.row.id, props.row.status)"
|
|
||||||
>
|
|
||||||
{{ props.row.dateSendLeave }}
|
|
||||||
</q-td>
|
|
||||||
|
|
||||||
<q-td key="status" :props="props">
|
<q-td key="status" :props="props">
|
||||||
<div class="col-12 row items-center">
|
<div class="col-12 row items-center">
|
||||||
<div @click="onClickView(props.row.id, props.row.status)">
|
<div @click="onClickView(props.row.id, props.row.status)">
|
||||||
<q-icon
|
<q-icon v-if="props.row.status == 'DRAFT'" size="10px" color="light-grey" name="mdi-circle" class="q-mr-sm" />
|
||||||
v-if="props.row.status == 'DRAFT'"
|
<q-icon v-if="props.row.status == 'APPROVE'" size="10px" color="light-green" name="mdi-circle" class="q-mr-sm" />
|
||||||
size="10px"
|
<q-icon v-else-if="props.row.status == 'REJECT'" size="10px" color="red-6" name="mdi-circle" class="q-mr-sm" />
|
||||||
color="light-grey"
|
<q-icon v-else-if="props.row.status == 'PENDING'" size="10px" color="light-blue-14" name="mdi-circle" class="q-mr-sm" />
|
||||||
name="mdi-circle"
|
<q-icon v-else-if="props.row.status == 'NEW'" size="10px" color="orange" name="mdi-circle" class="q-mr-sm" />
|
||||||
class="q-mr-sm"
|
<q-icon v-if="props.row.status == 'DELETE'" size="10px" color="grey-10" name="mdi-circle" class="q-mr-sm" />
|
||||||
/>
|
|
||||||
<q-icon
|
|
||||||
v-if="props.row.status == 'APPROVE'"
|
|
||||||
size="10px"
|
|
||||||
color="light-green"
|
|
||||||
name="mdi-circle"
|
|
||||||
class="q-mr-sm"
|
|
||||||
/>
|
|
||||||
<q-icon
|
|
||||||
v-else-if="props.row.status == 'REJECT'"
|
|
||||||
size="10px"
|
|
||||||
color="red-6"
|
|
||||||
name="mdi-circle"
|
|
||||||
class="q-mr-sm"
|
|
||||||
/>
|
|
||||||
<q-icon
|
|
||||||
v-else-if="props.row.status == 'PENDING'"
|
|
||||||
size="10px"
|
|
||||||
color="light-blue-14"
|
|
||||||
name="mdi-circle"
|
|
||||||
class="q-mr-sm"
|
|
||||||
/>
|
|
||||||
<q-icon
|
|
||||||
v-else-if="props.row.status == 'NEW'"
|
|
||||||
size="10px"
|
|
||||||
color="orange"
|
|
||||||
name="mdi-circle"
|
|
||||||
class="q-mr-sm"
|
|
||||||
/>
|
|
||||||
<q-icon
|
|
||||||
v-if="props.row.status == 'DELETE'"
|
|
||||||
size="10px"
|
|
||||||
color="grey-10"
|
|
||||||
name="mdi-circle"
|
|
||||||
class="q-mr-sm"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<span class="q-pr-md">{{ props.row.statusConvert }}</span>
|
<span class="q-pr-md">{{ props.row.statusConvert }}</span>
|
||||||
</div>
|
</div>
|
||||||
<q-space />
|
<q-space />
|
||||||
|
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="
|
v-if="props.row.status != 'DELETE' && props.row.status != 'REJECT' && props.row.status != 'CANCEL'"
|
||||||
props.row.status != 'DELETE' &&
|
flat
|
||||||
props.row.status != 'REJECT' &&
|
icon="mdi-dots-vertical"
|
||||||
props.row.status != 'CANCEL'
|
color="grey-8"
|
||||||
"
|
for="#cancel"
|
||||||
flat
|
dense
|
||||||
icon="mdi-dots-vertical"
|
round
|
||||||
color="grey-8"
|
unelevated
|
||||||
for="#cancel"
|
>
|
||||||
dense
|
<q-menu>
|
||||||
round
|
<q-list>
|
||||||
unelevated
|
<q-item clickable v-close-popup @click="onClickView(props.row.id, 'CANCEL')">
|
||||||
>
|
<q-item-section>
|
||||||
<q-menu>
|
<q-item-label>ขอยกเลิก</q-item-label>
|
||||||
<q-list>
|
</q-item-section>
|
||||||
<q-item
|
</q-item>
|
||||||
clickable
|
<q-item
|
||||||
v-close-popup
|
v-if="
|
||||||
@click="onClickView(props.row.id, 'CANCEL')"
|
(props.row.status != 'DELETE' && props.row.status != 'REJECT' && props.row.status != 'CANCEL' && props.row.status == 'NEW') || props.row.status == 'DRAFT'
|
||||||
>
|
"
|
||||||
<q-item-section>
|
clickable
|
||||||
<q-item-label>ขอยกเลิก</q-item-label>
|
v-close-popup
|
||||||
</q-item-section>
|
@click="onClickEdit(props.row.id)"
|
||||||
</q-item>
|
>
|
||||||
<q-item
|
<q-item-section>
|
||||||
v-if="
|
<q-item-label>แก้ไข</q-item-label>
|
||||||
props.row.status != 'DELETE' &&
|
</q-item-section>
|
||||||
props.row.status != 'REJECT' &&
|
</q-item>
|
||||||
props.row.status != 'CANCEL' &&
|
</q-list>
|
||||||
props.row.status == 'NEW'
|
</q-menu>
|
||||||
"
|
</q-btn>
|
||||||
clickable
|
|
||||||
v-close-popup
|
|
||||||
@click="onClickEdit(props.row.id)"
|
|
||||||
>
|
|
||||||
<q-item-section>
|
|
||||||
<q-item-label>แก้ไข</q-item-label>
|
|
||||||
</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</q-list>
|
|
||||||
</q-menu>
|
|
||||||
</q-btn>
|
|
||||||
|
|
||||||
<!-- <q-btn
|
<!-- <q-btn
|
||||||
v-if="props.row.status != 'DELETE' && props.row.status != 'REJECT' && props.row.status != 'CANCEL'"
|
v-if="props.row.status != 'DELETE' && props.row.status != 'REJECT' && props.row.status != 'CANCEL'"
|
||||||
label="ขอยกเลิก"
|
label="ขอยกเลิก"
|
||||||
@click="onClickView(props.row.id, 'CANCEL')"
|
@click="onClickView(props.row.id, 'CANCEL')"
|
||||||
|
|
@ -288,18 +231,11 @@ onMounted(async () => {
|
||||||
dense
|
dense
|
||||||
color="primary"
|
color="primary"
|
||||||
/> -->
|
/> -->
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
|
|
||||||
<DialogDetail
|
<DialogDetail :modal="modal" :leaveId="leaveId" :leaveStatus="leaveStatus" :onClickClose="onClickClose" :leaveType="leaveType" :fetchDataTable="fetchDataTable" />
|
||||||
:modal="modal"
|
|
||||||
:leaveId="leaveId"
|
|
||||||
:leaveStatus="leaveStatus"
|
|
||||||
:onClickClose="onClickClose"
|
|
||||||
:leaveType="leaveType"
|
|
||||||
:fetchDataTable="fetchDataTable"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ interface ListLeave {
|
||||||
id: string //*Id การยื่นขอลา
|
id: string //*Id การยื่นขอลา
|
||||||
leaveTypeName: string //Name ประเภทการลา
|
leaveTypeName: string //Name ประเภทการลา
|
||||||
leaveTypeId: string //Id ประเภทการลา
|
leaveTypeId: string //Id ประเภทการลา
|
||||||
|
leaveStartDate: Date
|
||||||
|
leaveEndDate: Date
|
||||||
fullName: string //คำนำหน้า ชื่อ นามสกุล คนขอลา
|
fullName: string //คำนำหน้า ชื่อ นามสกุล คนขอลา
|
||||||
dateSendLeave: Date | null //วันที่ยื่นใบลา
|
dateSendLeave: Date | null //วันที่ยื่นใบลา
|
||||||
status: string //สถานะการของลา
|
status: string //สถานะการของลา
|
||||||
|
|
|
||||||
|
|
@ -1,400 +1,392 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia"
|
||||||
import { ref } from "vue";
|
import { ref } from "vue"
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar"
|
||||||
|
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar"
|
||||||
import type {
|
import type { OptionData, TypeLeave } from "@/modules/05_leave/interface/index/main"
|
||||||
OptionData,
|
import type { ListLeave, ListLeaveTable } from "@/modules/05_leave/interface/response/leave"
|
||||||
TypeLeave,
|
import http from "@/plugins/http"
|
||||||
} from "@/modules/05_leave/interface/index/main";
|
import config from "@/app.config"
|
||||||
import type {
|
|
||||||
ListLeave,
|
|
||||||
ListLeaveTable,
|
|
||||||
} from "@/modules/05_leave/interface/response/leave";
|
|
||||||
import http from "@/plugins/http";
|
|
||||||
import config from "@/app.config";
|
|
||||||
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin"
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin()
|
||||||
const { date2Thai, messageError } = mixin;
|
const { date2Thai, messageError } = mixin
|
||||||
const $q = useQuasar();
|
const $q = useQuasar()
|
||||||
|
|
||||||
export const useLeaveStore = defineStore("Leave", () => {
|
export const useLeaveStore = defineStore("Leave", () => {
|
||||||
const tabValue = ref<string>("calendar");
|
const tabValue = ref<string>("calendar")
|
||||||
const typeLeave = ref<string | undefined>("");
|
const typeLeave = ref<string | undefined>("")
|
||||||
const LeaveType = ref<string | null>("0");
|
const LeaveType = ref<string | null>("0")
|
||||||
const LeaveStatus = ref<string | null>("0");
|
const LeaveStatus = ref<string | null>("0")
|
||||||
const fiscalYearyear = ref<Number | null>(new Date().getFullYear());
|
const fiscalYearyear = ref<Number | null>(new Date().getFullYear())
|
||||||
const rows = ref<ListLeaveTable[]>([]);
|
const rows = ref<ListLeaveTable[]>([])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function เรียกข้อมูลรายการลา Table
|
* function เรียกข้อมูลรายการลา Table
|
||||||
* @param data ข้อมูลรายการลา Table
|
* @param data ข้อมูลรายการลา Table
|
||||||
*/
|
*/
|
||||||
async function fetchListLeave(data: ListLeave[]) {
|
async function fetchListLeave(data: ListLeave[]) {
|
||||||
let datalist: ListLeaveTable[] = data.map((e: ListLeave) => ({
|
let datalist: ListLeaveTable[] = data.map((e: ListLeave) => ({
|
||||||
id: e.id,
|
id: e.id,
|
||||||
leaveTypeName: e.leaveTypeName,
|
leaveTypeName: e.leaveTypeName,
|
||||||
leaveTypeId: e.leaveTypeId,
|
leaveTypeId: e.leaveTypeId,
|
||||||
fullName: e.fullName,
|
fullName: e.fullName,
|
||||||
dateSendLeave: e.dateSendLeave && date2Thai(e.dateSendLeave),
|
dateSendLeave: e.dateSendLeave && date2Thai(e.dateSendLeave),
|
||||||
status: e.status,
|
dateLeave: date2Thai(e.leaveStartDate) + " - " + date2Thai(e.leaveEndDate),
|
||||||
statusConvert: convertStatud(e.status),
|
status: e.status,
|
||||||
isDelete: e.isDelete,
|
statusConvert: convertStatud(e.status),
|
||||||
}));
|
isDelete: e.isDelete,
|
||||||
rows.value = datalist;
|
}))
|
||||||
}
|
rows.value = datalist
|
||||||
|
}
|
||||||
|
|
||||||
//ฟังก์ชั่นแปลง Status
|
//ฟังก์ชั่นแปลง Status
|
||||||
function convertStatud(val: string) {
|
function convertStatud(val: string) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "DRAFT":
|
case "DRAFT":
|
||||||
return "แบบร่าง";
|
return "แบบร่าง"
|
||||||
case "NEW":
|
case "NEW":
|
||||||
return "ใหม่";
|
return "ใหม่"
|
||||||
case "PENDING":
|
case "PENDING":
|
||||||
return "กำลังดำเนินการ";
|
return "กำลังดำเนินการ"
|
||||||
case "APPROVE":
|
case "APPROVE":
|
||||||
return "อนุมัติ";
|
return "อนุมัติ"
|
||||||
case "REJECT":
|
case "REJECT":
|
||||||
return "ไม่อนุมัติ";
|
return "ไม่อนุมัติ"
|
||||||
case "DELETE":
|
case "DELETE":
|
||||||
return "ยกเลิก";
|
return "ยกเลิก"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ประเภทการลา */
|
/** ประเภทการลา */
|
||||||
const typeOptions = ref<OptionData[]>([]);
|
const typeOptions = ref<OptionData[]>([])
|
||||||
const typeId = ref<string | undefined>("");
|
const typeId = ref<string | undefined>("")
|
||||||
const typeOptionsMain = ref<OptionData[]>([]);
|
const typeOptionsMain = ref<OptionData[]>([])
|
||||||
const typeOptionsAdd = ref<OptionData[]>([]);
|
const typeOptionsAdd = ref<OptionData[]>([])
|
||||||
/** รายการข้อมูลประเภทใบลา */
|
/** รายการข้อมูลประเภทใบลา */
|
||||||
const options = ref<OptionData[]>([]);
|
const options = ref<OptionData[]>([])
|
||||||
/**
|
/**
|
||||||
* function เรียกข้อมูลประเภทการลา
|
* function เรียกข้อมูลประเภทการลา
|
||||||
* @param data ประเภทการลา
|
* @param data ประเภทการลา
|
||||||
*/
|
*/
|
||||||
async function fetchLeaveType(data: TypeLeave[]) {
|
async function fetchLeaveType(data: TypeLeave[]) {
|
||||||
typeOptionsMain.value = [
|
typeOptionsMain.value = [
|
||||||
{
|
{
|
||||||
id: "00000000-0000-0000-0000-000000000000",
|
id: "00000000-0000-0000-0000-000000000000",
|
||||||
name: "ทั้งหมด",
|
name: "ทั้งหมด",
|
||||||
code: "LV-000",
|
code: "LV-000",
|
||||||
},
|
},
|
||||||
];
|
]
|
||||||
|
|
||||||
const optionType = data.map((e: TypeLeave) => ({
|
const optionType = data.map((e: TypeLeave) => ({
|
||||||
id: e.id,
|
id: e.id,
|
||||||
name: e.name,
|
name: e.name,
|
||||||
code: e.code,
|
code: e.code,
|
||||||
}));
|
}))
|
||||||
|
|
||||||
typeOptionsMain.value.push(...optionType);
|
typeOptionsMain.value.push(...optionType)
|
||||||
typeOptions.value = typeOptionsMain.value;
|
typeOptions.value = typeOptionsMain.value
|
||||||
|
|
||||||
typeOptionsAdd.value = [];
|
typeOptionsAdd.value = []
|
||||||
typeOptionsAdd.value.push(...optionType);
|
typeOptionsAdd.value.push(...optionType)
|
||||||
options.value = typeOptionsAdd.value;
|
options.value = typeOptionsAdd.value
|
||||||
}
|
}
|
||||||
|
|
||||||
/** สถานะของการลา */
|
/** สถานะของการลา */
|
||||||
const statusOptionsMain = ref<any[]>([
|
const statusOptionsMain = ref<any[]>([
|
||||||
{ id: "ALL", name: "ทั้งหมด" },
|
{ id: "ALL", name: "ทั้งหมด" },
|
||||||
{ id: "DRAFT", name: "แบบร่าง" },
|
{ id: "DRAFT", name: "แบบร่าง" },
|
||||||
{ id: "NEW", name: "ใหม่" },
|
{ id: "NEW", name: "ใหม่" },
|
||||||
{ id: "PENDING", name: "กำลังดำเนินการ" },
|
{ id: "PENDING", name: "กำลังดำเนินการ" },
|
||||||
{ id: "APPROVE", name: "อนุมัติ " },
|
{ id: "APPROVE", name: "อนุมัติ " },
|
||||||
{ id: "REJECT", name: "ไม่อนุมัติ" },
|
{ id: "REJECT", name: "ไม่อนุมัติ" },
|
||||||
{ id: "DELETE", name: "ยกเลิก" },
|
{ id: "DELETE", name: "ยกเลิก" },
|
||||||
]);
|
])
|
||||||
const statusOptions = ref<any[]>(statusOptionsMain.value);
|
const statusOptions = ref<any[]>(statusOptionsMain.value)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function ต้นหาข้อมูลของ Option
|
* function ต้นหาข้อมูลของ Option
|
||||||
* @param val ค่าที่ต้องการฟิลเตอร์
|
* @param val ค่าที่ต้องการฟิลเตอร์
|
||||||
* @param update อัพเดทค่า
|
* @param update อัพเดทค่า
|
||||||
* @param refData ดาต้าที่ต้องการฟิลเตอร์
|
* @param refData ดาต้าที่ต้องการฟิลเตอร์
|
||||||
*/
|
*/
|
||||||
function filterOption(val: any, update: Function, refData: string) {
|
function filterOption(val: any, update: Function, refData: string) {
|
||||||
switch (refData) {
|
switch (refData) {
|
||||||
case "LeaveTypeOption":
|
case "LeaveTypeOption":
|
||||||
update(() => {
|
update(() => {
|
||||||
typeOptions.value = typeOptionsMain.value.filter(
|
typeOptions.value = typeOptionsMain.value.filter((v: any) => v.name.indexOf(val) > -1)
|
||||||
(v: any) => v.name.indexOf(val) > -1
|
})
|
||||||
);
|
break
|
||||||
});
|
case "LeaveStatusOption":
|
||||||
break;
|
update(() => {
|
||||||
case "LeaveStatusOption":
|
statusOptions.value = statusOptionsMain.value.filter((v: any) => v.name.indexOf(val) > -1)
|
||||||
update(() => {
|
})
|
||||||
statusOptions.value = statusOptionsMain.value.filter(
|
break
|
||||||
(v: any) => v.name.indexOf(val) > -1
|
default:
|
||||||
);
|
break
|
||||||
});
|
}
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** รายการประเภทการลาของ ลาไปศึกษา ฝึกอบรม ปฎิบัติการวิจัย หรือดูงาน*/
|
/** รายการประเภทการลาของ ลาไปศึกษา ฝึกอบรม ปฎิบัติการวิจัย หรือดูงาน*/
|
||||||
const optionsSpecific = ref<OptionData[]>([
|
const optionsSpecific = ref<OptionData[]>([
|
||||||
{ id: "s1", name: "ลาไปศึกษาต่อ", code: "s1" },
|
{ id: "s1", name: "ลาไปศึกษาต่อ", code: "s1" },
|
||||||
{ id: "s2", name: "ลาฝึกอบรม/ปฎิบัติการวิจัย/ดูงาน", code: "s2" },
|
{ id: "s2", name: "ลาฝึกอบรม/ปฎิบัติการวิจัย/ดูงาน", code: "s2" },
|
||||||
]);
|
])
|
||||||
|
|
||||||
/** รายการประเภทการลาของ ลาอุปสมบทหรือลาประกอบพิธีฮัจญ์*/
|
/** รายการประเภทการลาของ ลาอุปสมบทหรือลาประกอบพิธีฮัจญ์*/
|
||||||
const optionsOrdination = ref<OptionData[]>([
|
const optionsOrdination = ref<OptionData[]>([
|
||||||
{ id: "b1", name: "ลาอุปสมบท", code: "b1" },
|
{ id: "b1", name: "ลาอุปสมบท", code: "b1" },
|
||||||
{ id: "b2", name: "ลาประกอบพิธีฮัจญ์", code: "b2" },
|
{ id: "b2", name: "ลาประกอบพิธีฮัจญ์", code: "b2" },
|
||||||
]);
|
])
|
||||||
|
|
||||||
/** data table filter & column ของรายการลา */
|
/** data table filter & column ของรายการลา */
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>(["no", "leaveTypeName", "dateSendLeave", "status", "dateLeave"])
|
||||||
"no",
|
|
||||||
"leaveTypeName",
|
|
||||||
"dateSendLeave",
|
|
||||||
"status",
|
|
||||||
]);
|
|
||||||
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "no",
|
name: "no",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ลำดับ",
|
label: "ลำดับ",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "no",
|
field: "no",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px; width:5%;",
|
style: "font-size: 14px; width:5%;",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "leaveTypeName",
|
name: "leaveTypeName",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ประเภทการลา",
|
label: "ประเภทการลา",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "leaveTypeName",
|
field: "leaveTypeName",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px; width:15%;",
|
style: "font-size: 14px; width:15%;",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "dateSendLeave",
|
name: "dateLeave",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "วันที่ยื่นใบลา",
|
label: "วันที่ลา",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "dateSendLeave",
|
field: "dateLeave",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px; width:15%;",
|
style: "font-size: 14px; width:15%;",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "status",
|
name: "dateSendLeave",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "สถานะ",
|
label: "วันที่ยื่นใบลา",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "status",
|
field: "dateSendLeave",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px; width:10%;",
|
style: "font-size: 14px; width:15%;",
|
||||||
},
|
},
|
||||||
]);
|
|
||||||
|
|
||||||
/**
|
{
|
||||||
*ฟังก์ชั่นแปลงประเภทแบบฟอร์มลา
|
name: "status",
|
||||||
* @param item ประเภทแบบฟอร์ม
|
align: "left",
|
||||||
* @param subitem ประเภทแบบฟอร์มย่อย
|
label: "สถานะ",
|
||||||
*/
|
sortable: true,
|
||||||
function typeConvert(item: string, subitem: any) {
|
field: "status",
|
||||||
// console.log('first',item)
|
headerStyle: "font-size: 14px",
|
||||||
// if (item !== "LV-006" && item !== "LV-008") {
|
style: "font-size: 14px; width:10%;",
|
||||||
typeLeave.value = convertSubtitle(item);
|
},
|
||||||
// } else if (item === "LV-006") {
|
])
|
||||||
// typeLeave.value = convertSubtitleInfo(subitem);
|
|
||||||
// } else if (item === "LV-008") {
|
|
||||||
// typeLeave.value = convertSubtitleInfo2(subitem);
|
|
||||||
// }
|
|
||||||
typeId.value = convertId(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*ฟังก์ชั่นแปลงประเภทแบบฟอร์มลา ลาอุปสมบท/ลาประกอบพิธีฮัจญ์
|
*ฟังก์ชั่นแปลงประเภทแบบฟอร์มลา
|
||||||
* @param val ค่า string
|
* @param item ประเภทแบบฟอร์ม
|
||||||
* @returns ส่งค่าที่แปลงแล้ว
|
* @param subitem ประเภทแบบฟอร์มย่อย
|
||||||
*/
|
*/
|
||||||
function convertSubtitle(val: string) {
|
function typeConvert(item: string, subitem: any) {
|
||||||
return options.value.find((x) => x.code == val)?.name;
|
// console.log('first',item)
|
||||||
}
|
// if (item !== "LV-006" && item !== "LV-008") {
|
||||||
|
typeLeave.value = convertSubtitle(item)
|
||||||
|
// } else if (item === "LV-006") {
|
||||||
|
// typeLeave.value = convertSubtitleInfo(subitem);
|
||||||
|
// } else if (item === "LV-008") {
|
||||||
|
// typeLeave.value = convertSubtitleInfo2(subitem);
|
||||||
|
// }
|
||||||
|
typeId.value = convertId(item)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*ฟังก์ชั่นแปลงประเภทแบบฟอร์มลา ลาอุปสมบท/ลาประกอบพิธีฮัจญ์ ย่อย
|
*ฟังก์ชั่นแปลงประเภทแบบฟอร์มลา ลาอุปสมบท/ลาประกอบพิธีฮัจญ์
|
||||||
* @param val ค่า string
|
* @param val ค่า string
|
||||||
* @returns ส่งค่าที่แปลงแล้ว
|
* @returns ส่งค่าที่แปลงแล้ว
|
||||||
*/
|
*/
|
||||||
function convertSubtitleInfo(val: string) {
|
function convertSubtitle(val: string) {
|
||||||
return optionsOrdination.value.find((x) => x.id == val)?.name;
|
return options.value.find(x => x.code == val)?.name
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*ฟังก์ชั่นแปลง ลาไปศึกษา ฝึกอบรม ปฎิบัติการวิจัย หรือดูงาน
|
*ฟังก์ชั่นแปลงประเภทแบบฟอร์มลา ลาอุปสมบท/ลาประกอบพิธีฮัจญ์ ย่อย
|
||||||
* @param val ค่า string
|
* @param val ค่า string
|
||||||
* @returns ส่งค่าที่แปลงแล้ว
|
* @returns ส่งค่าที่แปลงแล้ว
|
||||||
*/
|
*/
|
||||||
function convertSubtitleInfo2(val: string) {
|
function convertSubtitleInfo(val: string) {
|
||||||
return optionsSpecific.value.find((x) => x.id == val)?.name;
|
return optionsOrdination.value.find(x => x.id == val)?.name
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*ฟังก์ชั่นหา id จาก api
|
*ฟังก์ชั่นแปลง ลาไปศึกษา ฝึกอบรม ปฎิบัติการวิจัย หรือดูงาน
|
||||||
* @param val ค่า string
|
* @param val ค่า string
|
||||||
* @returns ส่งค่าที่แปลงแล้ว
|
* @returns ส่งค่าที่แปลงแล้ว
|
||||||
*/
|
*/
|
||||||
function convertId(val: string) {
|
function convertSubtitleInfo2(val: string) {
|
||||||
return options.value.find((x) => x.code == val)?.id;
|
return optionsSpecific.value.find(x => x.id == val)?.name
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*ตัวแปร profile ที่จะส่งออก
|
*ฟังก์ชั่นหา id จาก api
|
||||||
*/
|
* @param val ค่า string
|
||||||
const dateSendLeave = ref<Date>(); //วันที่ยื่นใบลา
|
* @returns ส่งค่าที่แปลงแล้ว
|
||||||
const leaveTypeName = ref<string>(""); //Name ประเภทการลา
|
*/
|
||||||
const dear = ref<string>(""); //เรียน
|
function convertId(val: string) {
|
||||||
const fullName = ref<string>(""); //คำนำหน้า ชื่อ นามสกุล ผู้ยื่นขอ
|
return options.value.find(x => x.code == val)?.id
|
||||||
const positionName = ref<string>(""); //ตำแหน่งผู้ยื่นขอ
|
}
|
||||||
const positionLevelName = ref<string>(""); //ระดับผู้ยื่นขอ
|
|
||||||
const organizationName = ref<string>(""); //สังกัดผู้ยื่นขอ
|
|
||||||
const leaveLimit = ref<number>(0); //โควต้าลา(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
|
||||||
const leaveTotal = ref<number>(0); //ลาไปแล้ว(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
|
||||||
const leaveRemain = ref<number>(0); //คงเหลือโควต้า(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
|
||||||
const restDayTotalOld = ref<number>(0); //จำนวนวันลาพักผ่อนสะสม จากปีที่ผ่านมา
|
|
||||||
const birthDate = ref<Date>(); //วันเกิด
|
|
||||||
const dateAppoint = ref<Date>(); //วันที่เข้ารับราชการ
|
|
||||||
const salary = ref<number>(0); //เงินเดือนปัจจุบัน
|
|
||||||
const salaryText = ref<string>(""); //เงินเดือนปัจจุบัน(ภาษาไทย)
|
|
||||||
const leaveLast = ref<any>();
|
|
||||||
const restDayCurrentTotal = ref<string>("");
|
|
||||||
|
|
||||||
//ดึงข้อมูล profile จาก API
|
/**
|
||||||
async function fetchProfile() {
|
*ตัวแปร profile ที่จะส่งออก
|
||||||
await http
|
*/
|
||||||
.post(config.API.leaveProfile(), { type: typeId.value })
|
const dateSendLeave = ref<Date>() //วันที่ยื่นใบลา
|
||||||
.then((res: any) => {
|
const leaveTypeName = ref<string>("") //Name ประเภทการลา
|
||||||
const data = res.data.result;
|
const dear = ref<string>("") //เรียน
|
||||||
dateSendLeave.value = data.dateSendLeave;
|
const fullName = ref<string>("") //คำนำหน้า ชื่อ นามสกุล ผู้ยื่นขอ
|
||||||
leaveTypeName.value = data.leaveTypeName;
|
const positionName = ref<string>("") //ตำแหน่งผู้ยื่นขอ
|
||||||
dear.value = data.dear;
|
const positionLevelName = ref<string>("") //ระดับผู้ยื่นขอ
|
||||||
fullName.value = data.fullName;
|
const organizationName = ref<string>("") //สังกัดผู้ยื่นขอ
|
||||||
positionName.value = data.positionName;
|
const leaveLimit = ref<number>(0) //โควต้าลา(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
||||||
positionLevelName.value = data.positionLevelName;
|
const leaveTotal = ref<number>(0) //ลาไปแล้ว(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
||||||
organizationName.value = data.organizationName;
|
const leaveRemain = ref<number>(0) //คงเหลือโควต้า(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
||||||
leaveLimit.value = data.leaveLimit;
|
const restDayTotalOld = ref<number>(0) //จำนวนวันลาพักผ่อนสะสม จากปีที่ผ่านมา
|
||||||
leaveTotal.value = data.leaveTotal;
|
const birthDate = ref<Date>() //วันเกิด
|
||||||
leaveRemain.value = data.leaveRemain;
|
const dateAppoint = ref<Date>() //วันที่เข้ารับราชการ
|
||||||
restDayTotalOld.value = data.restDayTotalOld;
|
const salary = ref<number>(0) //เงินเดือนปัจจุบัน
|
||||||
birthDate.value = data.birthDate;
|
const salaryText = ref<string>("") //เงินเดือนปัจจุบัน(ภาษาไทย)
|
||||||
dateAppoint.value = data.dateAppoint;
|
const leaveLast = ref<any>()
|
||||||
salary.value = data.salary ? data.salary.toLocaleString("th-TH") : "";
|
const restDayCurrentTotal = ref<string>("")
|
||||||
salaryText.value = data.salaryText;
|
|
||||||
leaveLast.value =
|
|
||||||
data.leaveLast != "0001-01-01T00:00:00"
|
|
||||||
? date2Thai(data.leaveLast)
|
|
||||||
: "-";
|
|
||||||
restDayCurrentTotal.value = data.restDayCurrentTotal;
|
|
||||||
})
|
|
||||||
.catch((e: any) => {
|
|
||||||
messageError($q, e);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetchProfileOld(data: any) {
|
//ดึงข้อมูล profile จาก API
|
||||||
await http
|
async function fetchProfile() {
|
||||||
.post(config.API.leaveProfile(), { type: typeId.value })
|
await http
|
||||||
.then((res: any) => {
|
.post(config.API.leaveProfile(), { type: typeId.value })
|
||||||
const data = res.data.result;
|
.then((res: any) => {
|
||||||
leaveLimit.value = data.leaveLimit;
|
const data = res.data.result
|
||||||
leaveTotal.value = data.leaveTotal;
|
dateSendLeave.value = data.dateSendLeave
|
||||||
leaveRemain.value = data.leaveRemain;
|
leaveTypeName.value = data.leaveTypeName
|
||||||
restDayTotalOld.value = data.restDayTotalOld; //จำนวนวันลาพักผ่อนสะสม จากปีที่ผ่านมา
|
dear.value = data.dear
|
||||||
birthDate.value = data.birthDate; // วันเกิด
|
fullName.value = data.fullName
|
||||||
dateAppoint.value = data.dateAppoint; // วันที่รับราชการ
|
positionName.value = data.positionName
|
||||||
salary.value = data.salary ? data.salary.toLocaleString("th-TH") : "";
|
positionLevelName.value = data.positionLevelName
|
||||||
salaryText.value = data.salaryText;
|
organizationName.value = data.organizationName
|
||||||
})
|
leaveLimit.value = data.leaveLimit
|
||||||
.catch((e: any) => {
|
leaveTotal.value = data.leaveTotal
|
||||||
messageError($q, e);
|
leaveRemain.value = data.leaveRemain
|
||||||
});
|
restDayTotalOld.value = data.restDayTotalOld
|
||||||
|
birthDate.value = data.birthDate
|
||||||
|
dateAppoint.value = data.dateAppoint
|
||||||
|
salary.value = data.salary ? data.salary.toLocaleString("th-TH") : ""
|
||||||
|
salaryText.value = data.salaryText
|
||||||
|
leaveLast.value = data.leaveLast != "0001-01-01T00:00:00" ? date2Thai(data.leaveLast) : "-"
|
||||||
|
restDayCurrentTotal.value = data.restDayCurrentTotal
|
||||||
|
})
|
||||||
|
.catch((e: any) => {
|
||||||
|
messageError($q, e)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
dateSendLeave.value = data.dateSendLeave;
|
async function fetchProfileOld(data: any) {
|
||||||
typeLeave.value = data.leaveTypeName;
|
await http
|
||||||
dear.value = data.dear;
|
.post(config.API.leaveProfile(), { type: typeId.value })
|
||||||
fullName.value = data.fullName;
|
.then((res: any) => {
|
||||||
positionName.value = data.positionName;
|
const data = res.data.result
|
||||||
positionLevelName.value = data.positionLevelName;
|
leaveLimit.value = data.leaveLimit
|
||||||
organizationName.value = data.organizationName;
|
leaveTotal.value = data.leaveTotal
|
||||||
leaveLast.value =
|
leaveRemain.value = data.leaveRemain
|
||||||
data.leaveLast != "0001-01-01T00:00:00" ? date2Thai(data.leaveLast) : "-";
|
restDayTotalOld.value = data.restDayTotalOld //จำนวนวันลาพักผ่อนสะสม จากปีที่ผ่านมา
|
||||||
restDayCurrentTotal.value = data.restDayCurrentTotal;
|
birthDate.value = data.birthDate // วันเกิด
|
||||||
}
|
dateAppoint.value = data.dateAppoint // วันที่รับราชการ
|
||||||
|
salary.value = data.salary ? data.salary.toLocaleString("th-TH") : ""
|
||||||
|
salaryText.value = data.salaryText
|
||||||
|
})
|
||||||
|
.catch((e: any) => {
|
||||||
|
messageError($q, e)
|
||||||
|
})
|
||||||
|
|
||||||
function resetForm2() {
|
dateSendLeave.value = data.dateSendLeave
|
||||||
dateSendLeave.value = undefined;
|
typeLeave.value = data.leaveTypeName
|
||||||
leaveTypeName.value = "";
|
dear.value = data.dear
|
||||||
dear.value = "";
|
fullName.value = data.fullName
|
||||||
fullName.value = "";
|
positionName.value = data.positionName
|
||||||
positionName.value = "";
|
positionLevelName.value = data.positionLevelName
|
||||||
positionLevelName.value = "";
|
organizationName.value = data.organizationName
|
||||||
organizationName.value = "";
|
leaveLast.value = data.leaveLast != "0001-01-01T00:00:00" ? date2Thai(data.leaveLast) : "-"
|
||||||
leaveLimit.value = 0;
|
restDayCurrentTotal.value = data.restDayCurrentTotal
|
||||||
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 {
|
function resetForm2() {
|
||||||
tabValue,
|
dateSendLeave.value = undefined
|
||||||
typeOptions,
|
leaveTypeName.value = ""
|
||||||
optionsSpecific,
|
dear.value = ""
|
||||||
statusOptions,
|
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 = ""
|
||||||
|
}
|
||||||
|
|
||||||
visibleColumns,
|
return {
|
||||||
columns,
|
tabValue,
|
||||||
rows,
|
typeOptions,
|
||||||
LeaveType,
|
optionsSpecific,
|
||||||
LeaveStatus,
|
statusOptions,
|
||||||
|
|
||||||
fiscalYearyear,
|
visibleColumns,
|
||||||
options,
|
columns,
|
||||||
optionsOrdination,
|
rows,
|
||||||
typeConvert,
|
LeaveType,
|
||||||
typeLeave,
|
LeaveStatus,
|
||||||
typeId,
|
|
||||||
|
|
||||||
fetchListLeave,
|
fiscalYearyear,
|
||||||
fetchLeaveType,
|
options,
|
||||||
filterOption,
|
optionsOrdination,
|
||||||
fetchProfile,
|
typeConvert,
|
||||||
|
typeLeave,
|
||||||
|
typeId,
|
||||||
|
|
||||||
//ส่งออกตัวแปร profileที่ได้จาก Api
|
fetchListLeave,
|
||||||
dateSendLeave,
|
fetchLeaveType,
|
||||||
leaveTypeName,
|
filterOption,
|
||||||
dear,
|
fetchProfile,
|
||||||
fullName,
|
|
||||||
positionName,
|
//ส่งออกตัวแปร profileที่ได้จาก Api
|
||||||
positionLevelName,
|
dateSendLeave,
|
||||||
organizationName,
|
leaveTypeName,
|
||||||
leaveLimit, //โควต้าลา(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
dear,
|
||||||
leaveTotal, //ลาไปแล้ว(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
fullName,
|
||||||
leaveRemain, //คงเหลือโควต้า(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
positionName,
|
||||||
restDayTotalOld,
|
positionLevelName,
|
||||||
birthDate,
|
organizationName,
|
||||||
dateAppoint,
|
leaveLimit, //โควต้าลา(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
||||||
salary,
|
leaveTotal, //ลาไปแล้ว(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
||||||
salaryText,
|
leaveRemain, //คงเหลือโควต้า(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
||||||
leaveLast,
|
restDayTotalOld,
|
||||||
restDayCurrentTotal,
|
birthDate,
|
||||||
convertStatud,
|
dateAppoint,
|
||||||
resetForm2,
|
salary,
|
||||||
fetchProfileOld,
|
salaryText,
|
||||||
};
|
leaveLast,
|
||||||
});
|
restDayCurrentTotal,
|
||||||
|
convertStatud,
|
||||||
|
resetForm2,
|
||||||
|
fetchProfileOld,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,235 +1,164 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue"
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar"
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router"
|
||||||
import { useLeaveStore } from "@/modules/05_leave/store";
|
import { useLeaveStore } from "@/modules/05_leave/store"
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http"
|
||||||
import config from "@/app.config";
|
import config from "@/app.config"
|
||||||
import type { QForm } from "quasar";
|
import type { QForm } from "quasar"
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin"
|
||||||
|
|
||||||
import FormPart2 from "@/modules/05_leave/components/FormLeave/Form.vue";
|
import FormPart2 from "@/modules/05_leave/components/FormLeave/Form.vue"
|
||||||
import SickForm from "@/modules/05_leave/components/FormLeave/01_SickForm.vue";
|
import SickForm from "@/modules/05_leave/components/FormLeave/01_SickForm.vue"
|
||||||
import FormBirth from "@/modules/05_leave/components/FormLeave/03_Birth.vue";
|
import FormBirth from "@/modules/05_leave/components/FormLeave/03_Birth.vue"
|
||||||
import HelpWifeBirthForm from "@/modules/05_leave/components/FormLeave/04_HelpWifeBirthForm.vue";
|
import HelpWifeBirthForm from "@/modules/05_leave/components/FormLeave/04_HelpWifeBirthForm.vue"
|
||||||
import VacationForm from "@/modules/05_leave/components/FormLeave/05_VacationForm.vue";
|
import VacationForm from "@/modules/05_leave/components/FormLeave/05_VacationForm.vue"
|
||||||
import OrdinationForm from "@/modules/05_leave/components/FormLeave/06_OrdinationForm.vue";
|
import OrdinationForm from "@/modules/05_leave/components/FormLeave/06_OrdinationForm.vue"
|
||||||
import HajjForm from "@/modules/05_leave/components/FormLeave/07_HajjForm.vue";
|
import HajjForm from "@/modules/05_leave/components/FormLeave/07_HajjForm.vue"
|
||||||
import MilitaryForm from "@/modules/05_leave/components/FormLeave/08_MilitaryForm.vue";
|
import MilitaryForm from "@/modules/05_leave/components/FormLeave/08_MilitaryForm.vue"
|
||||||
import StudyForm from "@/modules/05_leave/components/FormLeave/09_StudyForm.vue";
|
import StudyForm from "@/modules/05_leave/components/FormLeave/09_StudyForm.vue"
|
||||||
import TrainForm from "@/modules/05_leave/components/FormLeave/10_TrainForm.vue";
|
import TrainForm from "@/modules/05_leave/components/FormLeave/10_TrainForm.vue"
|
||||||
import WorkInternationalForm from "@/modules/05_leave/components/FormLeave/11_WorkInternationalForm.vue";
|
import WorkInternationalForm from "@/modules/05_leave/components/FormLeave/11_WorkInternationalForm.vue"
|
||||||
import FollowSpouseForm from "@/modules/05_leave/components/FormLeave/12_FollowSpouseForm.vue";
|
import FollowSpouseForm from "@/modules/05_leave/components/FormLeave/12_FollowSpouseForm.vue"
|
||||||
import RehabilitationForm from "@/modules/05_leave/components/FormLeave/13_RehabilitationForm.vue";
|
import RehabilitationForm from "@/modules/05_leave/components/FormLeave/13_RehabilitationForm.vue"
|
||||||
|
|
||||||
const dataStore = useLeaveStore();
|
const dataStore = useLeaveStore()
|
||||||
const { fetchLeaveType } = dataStore;
|
const { fetchLeaveType } = dataStore
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin()
|
||||||
const { dialogConfirm, success, messageError, showLoader, hideLoader } = mixin;
|
const { dialogConfirm, success, messageError, showLoader, hideLoader } = mixin
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter()
|
||||||
const route = useRoute();
|
const route = useRoute()
|
||||||
const myform = ref<QForm | null>(null);
|
const myform = ref<QForm | null>(null)
|
||||||
const $q = useQuasar();
|
const $q = useQuasar()
|
||||||
|
|
||||||
const model = ref<string>("");
|
const model = ref<string>("")
|
||||||
const modelSpecific = ref<string>("");
|
const modelSpecific = ref<string>("")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ดึงค่าประเภทการลาจาก Api
|
* ดึงค่าประเภทการลาจาก Api
|
||||||
*/
|
*/
|
||||||
async function fectOptionType() {
|
async function fectOptionType() {
|
||||||
await http
|
await http
|
||||||
.get(config.API.leaveType())
|
.get(config.API.leaveType())
|
||||||
.then(async (res) => {
|
.then(async res => {
|
||||||
const data = res.data.result;
|
const data = res.data.result
|
||||||
await fetchLeaveType(data);
|
await fetchLeaveType(data)
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
messageError($q, err);
|
messageError($q, err)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function inputEdit(val: boolean) {
|
function inputEdit(val: boolean) {
|
||||||
return {
|
return {
|
||||||
"full-width cursor-pointer ": val,
|
"full-width cursor-pointer ": val,
|
||||||
"full-width cursor-pointer inputgreen": !val,
|
"full-width cursor-pointer inputgreen": !val,
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit(postData: FormData) {
|
function onSubmit(postData: FormData) {
|
||||||
dialogConfirm($q, async () => {
|
dialogConfirm($q, async () => {
|
||||||
showLoader();
|
showLoader()
|
||||||
await http
|
await http
|
||||||
.post(config.API.leaveUser(), postData)
|
.post(config.API.leaveUser(), postData)
|
||||||
.then(() => {
|
.then(res => {
|
||||||
// router.push(`/leave/edit/${id}`);
|
router.push(`/leave/edit/${res.data.result.id}`)
|
||||||
router.push("/leave");
|
success($q, "บันทึกสำเร็จ")
|
||||||
success($q, "บันทึกสำเร็จ");
|
})
|
||||||
})
|
.catch((e: any) => {
|
||||||
.catch((e: any) => {
|
messageError($q, e)
|
||||||
messageError($q, e);
|
})
|
||||||
})
|
.finally(() => {
|
||||||
.finally(() => {
|
hideLoader()
|
||||||
hideLoader();
|
})
|
||||||
});
|
})
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (dataStore.options.length == 0) {
|
if (dataStore.options.length == 0) {
|
||||||
await fectOptionType();
|
await fectOptionType()
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="col-12 row justify-center">
|
<div class="col-12 row justify-center">
|
||||||
<div class="col-xs-12 col-sm-12 col-md-11">
|
<div class="col-xs-12 col-sm-12 col-md-11">
|
||||||
<div class="toptitle text-white col-12 row items-center">
|
<div class="toptitle text-white col-12 row items-center">
|
||||||
<q-btn
|
<q-btn to="/leave" icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm" />
|
||||||
to="/leave"
|
<div>สร้างใบลา</div>
|
||||||
icon="mdi-arrow-left"
|
</div>
|
||||||
unelevated
|
|
||||||
round
|
|
||||||
dense
|
|
||||||
flat
|
|
||||||
color="primary"
|
|
||||||
class="q-mr-sm"
|
|
||||||
/>
|
|
||||||
<div>สร้างใบลา</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<q-form ref="myform" class="col-12">
|
<q-form ref="myform" class="col-12">
|
||||||
<q-card bordered>
|
<q-card bordered>
|
||||||
<div class="col-12 row q-col-gutter-md q-pa-md">
|
<div class="col-12 row q-col-gutter-md q-pa-md">
|
||||||
<div class="col-xs-12 col-sm-12">
|
<div class="col-xs-12 col-sm-12">
|
||||||
<div style="display: flex; align-items: center">
|
<div style="display: flex; align-items: center">
|
||||||
<q-icon
|
<q-icon name="mdi-numeric-1-circle" size="20px" color="primary" />
|
||||||
name="mdi-numeric-1-circle"
|
<div class="q-pl-sm text-weight-bold text-dark">เลือกประเภทการลา</div>
|
||||||
size="20px"
|
</div>
|
||||||
color="primary"
|
<div class="q-py-sm q-px-lg">
|
||||||
/>
|
<div class="row">
|
||||||
<div class="q-pl-sm text-weight-bold text-dark">
|
<q-select
|
||||||
เลือกประเภทการลา
|
dense
|
||||||
</div>
|
class="col-12 col-sm-6 col-md-4 inputgreen"
|
||||||
</div>
|
outlined
|
||||||
<div class="q-py-sm q-px-lg">
|
v-model="model"
|
||||||
<div class="row">
|
:options="dataStore.options"
|
||||||
<q-select
|
option-value="code"
|
||||||
dense
|
option-label="name"
|
||||||
class="col-12 col-sm-6 col-md-4 inputgreen"
|
emit-value
|
||||||
outlined
|
map-options
|
||||||
v-model="model"
|
prefix="ประเภทใบลา :"
|
||||||
:options="dataStore.options"
|
@update:model-value="dataStore.typeConvert(model, null), (modelSpecific = ''), dataStore.fetchProfile()"
|
||||||
option-value="code"
|
/>
|
||||||
option-label="name"
|
</div>
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
prefix="ประเภทใบลา :"
|
|
||||||
@update:model-value="
|
|
||||||
dataStore.typeConvert(model, null),
|
|
||||||
(modelSpecific = ''),
|
|
||||||
dataStore.fetchProfile()
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row q-mt-sm">
|
<div class="row q-mt-sm">
|
||||||
<div
|
<div class="col-12 col-sm-6 col-md-3" v-if="model === 'LV-006' || model === 'LV-008'">
|
||||||
class="col-12 col-sm-6 col-md-3"
|
<q-select
|
||||||
v-if="model === 'LV-006' || model === 'LV-008'"
|
dense
|
||||||
>
|
outlined
|
||||||
<q-select
|
v-model="modelSpecific"
|
||||||
dense
|
:options="model === 'LV-006' ? dataStore.optionsOrdination : dataStore.optionsSpecific"
|
||||||
outlined
|
option-value="code"
|
||||||
v-model="modelSpecific"
|
option-label="name"
|
||||||
:options="
|
emit-value
|
||||||
model === 'LV-006'
|
map-options
|
||||||
? dataStore.optionsOrdination
|
prefix="ประเภทการลา :"
|
||||||
: dataStore.optionsSpecific
|
@update:model-value="dataStore.typeConvert(model, modelSpecific)"
|
||||||
"
|
/>
|
||||||
option-value="code"
|
</div>
|
||||||
option-label="name"
|
</div>
|
||||||
emit-value
|
</div>
|
||||||
map-options
|
|
||||||
prefix="ประเภทการลา :"
|
|
||||||
@update:model-value="
|
|
||||||
dataStore.typeConvert(model, modelSpecific)
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div style="display: flex; align-items: center">
|
<div style="display: flex; align-items: center">
|
||||||
<q-icon
|
<q-icon name="mdi-numeric-2-circle" size="20px" color="primary" />
|
||||||
name="mdi-numeric-2-circle"
|
<div class="q-pl-sm text-weight-bold text-dark">ข้อมูลการลา</div>
|
||||||
size="20px"
|
</div>
|
||||||
color="primary"
|
<FormPart2 :model="model" />
|
||||||
/>
|
</div>
|
||||||
<div class="q-pl-sm text-weight-bold text-dark">
|
</div>
|
||||||
ข้อมูลการลา
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<FormPart2 :model="model" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<SickForm
|
<SickForm v-if="model === 'LV-001' || model === 'LV-002'" :on-submit="onSubmit" />
|
||||||
v-if="model === 'LV-001' || model === 'LV-002'"
|
<FormBirth v-if="model === 'LV-003'" :on-submit="onSubmit" />
|
||||||
:on-submit="onSubmit"
|
<HelpWifeBirthForm v-if="model === 'LV-004'" :on-submit="onSubmit" />
|
||||||
/>
|
<VacationForm v-if="model === 'LV-005'" :on-submit="onSubmit" />
|
||||||
<FormBirth v-if="model === 'LV-003'" :on-submit="onSubmit" />
|
<OrdinationForm v-if="model === 'LV-006' && modelSpecific == 'b1'" :on-submit="onSubmit" />
|
||||||
<HelpWifeBirthForm
|
<HajjForm v-if="model === 'LV-006' && modelSpecific == 'b2'" :on-submit="onSubmit" />
|
||||||
v-if="model === 'LV-004'"
|
<MilitaryForm v-if="model === 'LV-007'" style="width: 100%" :on-submit="onSubmit" />
|
||||||
:on-submit="onSubmit"
|
<StudyForm v-if="model === 'LV-008' && modelSpecific === 's1'" style="width: 100%" :on-submit="onSubmit" />
|
||||||
/>
|
<TrainForm v-if="model === 'LV-008' && modelSpecific != 's1' && modelSpecific != ''" :on-submit="onSubmit" />
|
||||||
<VacationForm v-if="model === 'LV-005'" :on-submit="onSubmit" />
|
<WorkInternationalForm v-if="model === 'LV-009'" :on-submit="onSubmit" />
|
||||||
<OrdinationForm
|
<FollowSpouseForm v-if="model === 'LV-010'" :on-submit="onSubmit" />
|
||||||
v-if="model === 'LV-006' && modelSpecific == 'b1'"
|
<RehabilitationForm v-if="model === 'LV-011'" :on-submit="onSubmit" />
|
||||||
:on-submit="onSubmit"
|
</div>
|
||||||
/>
|
</div>
|
||||||
<HajjForm
|
</q-card>
|
||||||
v-if="model === 'LV-006' && modelSpecific == 'b2'"
|
</q-form>
|
||||||
:on-submit="onSubmit"
|
</div>
|
||||||
/>
|
</div>
|
||||||
<MilitaryForm
|
|
||||||
v-if="model === 'LV-007'"
|
|
||||||
style="width: 100%"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
/>
|
|
||||||
<StudyForm
|
|
||||||
v-if="model === 'LV-008' && modelSpecific === 's1'"
|
|
||||||
style="width: 100%"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
/>
|
|
||||||
<TrainForm
|
|
||||||
v-if="
|
|
||||||
model === 'LV-008' &&
|
|
||||||
modelSpecific != 's1' &&
|
|
||||||
modelSpecific != ''
|
|
||||||
"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
/>
|
|
||||||
<WorkInternationalForm
|
|
||||||
v-if="model === 'LV-009'"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
/>
|
|
||||||
<FollowSpouseForm
|
|
||||||
v-if="model === 'LV-010'"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
/>
|
|
||||||
<RehabilitationForm
|
|
||||||
v-if="model === 'LV-011'"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</q-card>
|
|
||||||
</q-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,456 +1,334 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, reactive, computed } from "vue";
|
import { ref, onMounted, reactive, computed } from "vue"
|
||||||
|
|
||||||
//import form
|
//import form
|
||||||
import FormPart2 from "@/modules/05_leave/components/FormLeave/Form.vue";
|
import FormPart2 from "@/modules/05_leave/components/FormLeave/Form.vue"
|
||||||
import SickForm from "@/modules/05_leave/components/FormLeave/01_SickForm.vue";
|
import SickForm from "@/modules/05_leave/components/FormLeave/01_SickForm.vue"
|
||||||
import FormBirth from "@/modules/05_leave/components/FormLeave/03_Birth.vue";
|
import FormBirth from "@/modules/05_leave/components/FormLeave/03_Birth.vue"
|
||||||
import HelpWifeBirthForm from "@/modules/05_leave/components/FormLeave/04_HelpWifeBirthForm.vue";
|
import HelpWifeBirthForm from "@/modules/05_leave/components/FormLeave/04_HelpWifeBirthForm.vue"
|
||||||
import VacationForm from "@/modules/05_leave/components/FormLeave/05_VacationForm.vue";
|
import VacationForm from "@/modules/05_leave/components/FormLeave/05_VacationForm.vue"
|
||||||
import OrdinationForm from "@/modules/05_leave/components/FormLeave/06_OrdinationForm.vue";
|
import OrdinationForm from "@/modules/05_leave/components/FormLeave/06_OrdinationForm.vue"
|
||||||
import HajjForm from "@/modules/05_leave/components/FormLeave/07_HajjForm.vue";
|
import HajjForm from "@/modules/05_leave/components/FormLeave/07_HajjForm.vue"
|
||||||
import MilitaryForm from "@/modules/05_leave/components/FormLeave/08_MilitaryForm.vue";
|
import MilitaryForm from "@/modules/05_leave/components/FormLeave/08_MilitaryForm.vue"
|
||||||
import StudyForm from "@/modules/05_leave/components/FormLeave/09_StudyForm.vue";
|
import StudyForm from "@/modules/05_leave/components/FormLeave/09_StudyForm.vue"
|
||||||
import TrainForm from "@/modules/05_leave/components/FormLeave/10_TrainForm.vue";
|
import TrainForm from "@/modules/05_leave/components/FormLeave/10_TrainForm.vue"
|
||||||
import WorkInternationalForm from "@/modules/05_leave/components/FormLeave/11_WorkInternationalForm.vue";
|
import WorkInternationalForm from "@/modules/05_leave/components/FormLeave/11_WorkInternationalForm.vue"
|
||||||
import FollowSpouseForm from "@/modules/05_leave/components/FormLeave/12_FollowSpouseForm.vue";
|
import FollowSpouseForm from "@/modules/05_leave/components/FormLeave/12_FollowSpouseForm.vue"
|
||||||
import RehabilitationForm from "@/modules/05_leave/components/FormLeave/13_RehabilitationForm.vue";
|
import RehabilitationForm from "@/modules/05_leave/components/FormLeave/13_RehabilitationForm.vue"
|
||||||
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin"
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar"
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router"
|
||||||
import router from "@/router";
|
import router from "@/router"
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http"
|
||||||
import config from "@/app.config";
|
import config from "@/app.config"
|
||||||
import { useLeaveStore } from "@/modules/05_leave/store";
|
import { useLeaveStore } from "@/modules/05_leave/store"
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute()
|
||||||
const personalId = ref<string>(route.params.id as string);
|
const personalId = ref<string>(route.params.id as string)
|
||||||
const leaveId = ref<string>("");
|
const leaveId = ref<string>("")
|
||||||
const dataStore = useLeaveStore();
|
const dataStore = useLeaveStore()
|
||||||
const $q = useQuasar();
|
const $q = useQuasar()
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin()
|
||||||
const {
|
const { messageError, showLoader, hideLoader, dialogConfirm, success, date2Thai, dateToISO } = mixin
|
||||||
messageError,
|
|
||||||
showLoader,
|
|
||||||
hideLoader,
|
|
||||||
dialogConfirm,
|
|
||||||
success,
|
|
||||||
date2Thai,
|
|
||||||
dateToISO,
|
|
||||||
} = mixin;
|
|
||||||
|
|
||||||
const titleName = ref<string>("");
|
const titleName = ref<string>("")
|
||||||
/** Form รายละเอียดข้อมูล*/
|
/** Form รายละเอียดข้อมูล*/
|
||||||
const formData = reactive<any>({
|
const formData = reactive<any>({
|
||||||
id: "", //Id การยื่นขอลา
|
id: "", //Id การยื่นขอลา
|
||||||
leaveTypeName: "", // Name ประเภทการลา
|
leaveTypeName: "", // Name ประเภทการลา
|
||||||
leaveTypeId: "", //Id ประเภทการลา
|
leaveTypeId: "", //Id ประเภทการลา
|
||||||
fullname: "", //คำนำหน้า ชื่อ นามสกุล คนขอลา
|
fullname: "", //คำนำหน้า ชื่อ นามสกุล คนขอลา
|
||||||
dateSendLeave: null, // วันที่ยืนใบลา
|
dateSendLeave: null, // วันที่ยืนใบลา
|
||||||
status: "", //สถานะการของลา
|
status: "", //สถานะการของลา
|
||||||
leaveDateStart: null, //วันเริ่มการลา
|
leaveDateStart: null, //วันเริ่มการลา
|
||||||
leaveDateEnd: null, //วันสิ้นสุดการลา
|
leaveDateEnd: null, //วันสิ้นสุดการลา
|
||||||
leaveCount: 0, //จำนวนวันลา
|
leaveCount: 0, //จำนวนวันลา
|
||||||
leaveWrote: "", //เขียนที่
|
leaveWrote: "", //เขียนที่
|
||||||
leaveAddress: "", //สถานที่ติดต่อขณะลา
|
leaveAddress: "", //สถานที่ติดต่อขณะลา
|
||||||
leaveNumber: "", //หมายเลขที่ติดต่อขณะลา
|
leaveNumber: "", //หมายเลขที่ติดต่อขณะลา
|
||||||
leaveDetail: "", //รายละเอียดการลา
|
leaveDetail: "", //รายละเอียดการลา
|
||||||
leaveDocument: "", //อัปโหลดเอกสารประกอบรายละเอียด
|
leaveDocument: "", //อัปโหลดเอกสารประกอบรายละเอียด
|
||||||
leaveDraftDocument: "", //อัปโหลดแบบฟอร์มการลา
|
leaveDraftDocument: "", //อัปโหลดแบบฟอร์มการลา
|
||||||
leaveLastStart: null, //ลาครั้งสุดท้ายในประเภทนั้น ๆ เริ่มเมื่อวันที่(ลาป่วย ลาคลอดบุตร และลากิจส่วนตัว)(Auto)
|
leaveLastStart: null, //ลาครั้งสุดท้ายในประเภทนั้น ๆ เริ่มเมื่อวันที่(ลาป่วย ลาคลอดบุตร และลากิจส่วนตัว)(Auto)
|
||||||
leaveLastEnd: null, //ลาครั้งสุดท้ายในประเภทนั้น ๆ สิ้นสุดเมื่อวันที่(ลาป่วย ลาคลอดบุตร และลากิจส่วนตัว)(Auto)
|
leaveLastEnd: null, //ลาครั้งสุดท้ายในประเภทนั้น ๆ สิ้นสุดเมื่อวันที่(ลาป่วย ลาคลอดบุตร และลากิจส่วนตัว)(Auto)
|
||||||
leaveTotal: 0, //จำนวนวันที่ลา(Auto)
|
leaveTotal: 0, //จำนวนวันที่ลา(Auto)
|
||||||
leavebirthDate: null, //วันเดือนปีเกิด(Auto)
|
leavebirthDate: null, //วันเดือนปีเกิด(Auto)
|
||||||
leavegovernmentDate: null, //วันที่เข้ารับราชการ(Auto)
|
leavegovernmentDate: null, //วันที่เข้ารับราชการ(Auto)
|
||||||
leaveSalary: 0, //เงินเดือนปัจจุบัน(Auto)
|
leaveSalary: 0, //เงินเดือนปัจจุบัน(Auto)
|
||||||
leaveSalaryText: "", //เงินเดือนปัจจุบัน(เขียนเป็นคำอ่าน)
|
leaveSalaryText: "", //เงินเดือนปัจจุบัน(เขียนเป็นคำอ่าน)
|
||||||
leaveTypeDay: "", //ประเภทการลาในวันนั้นเช่น
|
leaveTypeDay: "", //ประเภทการลาในวันนั้นเช่น
|
||||||
wifeDayName: "", //ชื่อภรรยา(ลาไปช่วยเหลือภริยาที่คลอดบุตร)
|
wifeDayName: "", //ชื่อภรรยา(ลาไปช่วยเหลือภริยาที่คลอดบุตร)
|
||||||
wifeDayDateBorn: null, //วันที่คลอด(ลาไปช่วยเหลือภริยาที่คลอดบุตร)
|
wifeDayDateBorn: null, //วันที่คลอด(ลาไปช่วยเหลือภริยาที่คลอดบุตร)
|
||||||
restDayOldTotal: 0, //จำนวนวันลาพักผ่อนสะสม จากปีที่ผ่านมา(ลาพักผ่อน)(Auto)
|
restDayOldTotal: 0, //จำนวนวันลาพักผ่อนสะสม จากปีที่ผ่านมา(ลาพักผ่อน)(Auto)
|
||||||
restDayCurrentTotal: 0, //จำนวนวันลาพักผ่อนประจำปีปัจจุบัน(ลาพักผ่อน)(Auto)
|
restDayCurrentTotal: 0, //จำนวนวันลาพักผ่อนประจำปีปัจจุบัน(ลาพักผ่อน)(Auto)
|
||||||
ordainDayStatus: "", //เคย/ไม่เคยบวช (ให้เลือก) (ลาอุปสมบท)
|
ordainDayStatus: "", //เคย/ไม่เคยบวช (ให้เลือก) (ลาอุปสมบท)
|
||||||
ordainDayLocationName: "", //สถานที่บวช ชื่อวัด(ลาอุปสมบท)
|
ordainDayLocationName: "", //สถานที่บวช ชื่อวัด(ลาอุปสมบท)
|
||||||
ordainDayLocationAddress: "", //สถานที่บวช ที่อยู่(ลาอุปสมบท)
|
ordainDayLocationAddress: "", //สถานที่บวช ที่อยู่(ลาอุปสมบท)
|
||||||
ordainDayLocationNumber: "", //สถานที่บวช หมายเลขโทรศัพท์(ลาอุปสมบท)
|
ordainDayLocationNumber: "", //สถานที่บวช หมายเลขโทรศัพท์(ลาอุปสมบท)
|
||||||
ordainDayOrdination: null, //สถานที่บวช วันอุปสมบท(ลาอุปสมบท)
|
ordainDayOrdination: null, //สถานที่บวช วันอุปสมบท(ลาอุปสมบท)
|
||||||
ordainDayBuddhistLentName: "", //สถานที่จำพรรษา ชื่อวัด(ลาอุปสมบท)
|
ordainDayBuddhistLentName: "", //สถานที่จำพรรษา ชื่อวัด(ลาอุปสมบท)
|
||||||
ordainDayBuddhistLentAddress: "", //สถานที่จำพรรษา ที่อยู่(ลาอุปสมบท)
|
ordainDayBuddhistLentAddress: "", //สถานที่จำพรรษา ที่อยู่(ลาอุปสมบท)
|
||||||
hajjDayStatus: "", //เคย/ไม่เคยไปประกอบพิธีฮัจญ์ (ให้เลือก) (ลาประกอบพิธีฮัจญ์)
|
hajjDayStatus: "", //เคย/ไม่เคยไปประกอบพิธีฮัจญ์ (ให้เลือก) (ลาประกอบพิธีฮัจญ์)
|
||||||
absentDaySummon: "", //ได้รับหมายเรียกของ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
absentDaySummon: "", //ได้รับหมายเรียกของ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
||||||
absentDayLocation: "", //ที่ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
absentDayLocation: "", //ที่ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
||||||
absentDayRegistorDate: null, //ลงวันที่ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
absentDayRegistorDate: null, //ลงวันที่ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
||||||
absentDayGetIn: "", //ให้เข้ารับการ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
absentDayGetIn: "", //ให้เข้ารับการ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
||||||
absentDayAt: "", //ณ ที่ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
absentDayAt: "", //ณ ที่ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
||||||
studyDaySubject: "", //กรณีลาไปศึกษาต่อ ศึกษาวิชา (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
studyDaySubject: "", //กรณีลาไปศึกษาต่อ ศึกษาวิชา (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
||||||
studyDayDegreeLevel: "", //กรณีลาไปศึกษาต่อ ขั้นปริญญา (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
studyDayDegreeLevel: "", //กรณีลาไปศึกษาต่อ ขั้นปริญญา (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
||||||
studyDayUniversityName: "", //กรณีลาไปศึกษาต่อ ชื่อสถานศึกษา (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
studyDayUniversityName: "", //กรณีลาไปศึกษาต่อ ชื่อสถานศึกษา (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
||||||
studyDayTrainingSubject: "", //กรณีลาไปฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน ด้าน/หลักสูตร (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
studyDayTrainingSubject: "", //กรณีลาไปฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน ด้าน/หลักสูตร (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
||||||
studyDayTrainingName: "", //กรณีลาไปฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน ณ สถานที่ (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
studyDayTrainingName: "", //กรณีลาไปฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน ณ สถานที่ (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
||||||
studyDayCountry: "", //ประเทศ (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
studyDayCountry: "", //ประเทศ (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
||||||
studyDayScholarship: "", //ด้วยทุน (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
studyDayScholarship: "", //ด้วยทุน (ลาไปศึกษา ฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน)
|
||||||
coupleDayName: "", //ชื่อคู่สมรส (ลาติดตามคู่สมรส)
|
coupleDayName: "", //ชื่อคู่สมรส (ลาติดตามคู่สมรส)
|
||||||
coupleDayPosition: "", //ตำแหน่งคู่สมรส (ลาติดตามคู่สมรส)
|
coupleDayPosition: "", //ตำแหน่งคู่สมรส (ลาติดตามคู่สมรส)
|
||||||
coupleDayLevel: "", //ระดับคู่สมรส (ลาติดตามคู่สมรส)
|
coupleDayLevel: "", //ระดับคู่สมรส (ลาติดตามคู่สมรส)
|
||||||
coupleDayLevelCountry: "", //ไปปฏิบัติราชการ ณ ประเทศ (ลาติดตามคู่สมรส)
|
coupleDayLevelCountry: "", //ไปปฏิบัติราชการ ณ ประเทศ (ลาติดตามคู่สมรส)
|
||||||
coupleDayCountryHistory: "", //ประวัติ ประเทศ (ลาติดตามคู่สมรส)
|
coupleDayCountryHistory: "", //ประวัติ ประเทศ (ลาติดตามคู่สมรส)
|
||||||
coupleDayTotalHistory: "", //ประวัติ เป็นเวลา กี่ปี กี่เดือน กี่วัน (ลาติดตามคู่สมรส)
|
coupleDayTotalHistory: "", //ประวัติ เป็นเวลา กี่ปี กี่เดือน กี่วัน (ลาติดตามคู่สมรส)
|
||||||
coupleDayStartDateHistory: null, //ประวัติ ตั้งแต่วันที่ (ลาติดตามคู่สมรส)
|
coupleDayStartDateHistory: null, //ประวัติ ตั้งแต่วันที่ (ลาติดตามคู่สมรส)
|
||||||
coupleDayEndDateHistory: null, //ประวัติ ถึงวันที่ (ลาติดตามคู่สมรส)
|
coupleDayEndDateHistory: null, //ประวัติ ถึงวันที่ (ลาติดตามคู่สมรส)
|
||||||
coupleDaySumTotalHistory: "", //ประวัติ ในกรณีลาติดต่อกับครั้งก่อน รวมทั้งนี้ด้วย เป็นเวลา กี่ปี กี่เดือน กี่วัน (ลาติดตามคู่สมรส)
|
coupleDaySumTotalHistory: "", //ประวัติ ในกรณีลาติดต่อกับครั้งก่อน รวมทั้งนี้ด้วย เป็นเวลา กี่ปี กี่เดือน กี่วัน (ลาติดตามคู่สมรส)
|
||||||
approveStep: "",
|
approveStep: "",
|
||||||
dear: "",
|
dear: "",
|
||||||
leaveLast: "",
|
leaveLast: "",
|
||||||
});
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function เรียกข้อมูลการลา
|
* function เรียกข้อมูลการลา
|
||||||
* @param id การลา
|
* @param id การลา
|
||||||
*/
|
*/
|
||||||
async function fetchDataDetail(id: string) {
|
async function fetchDataDetail(id: string) {
|
||||||
showLoader();
|
showLoader()
|
||||||
await http
|
await http
|
||||||
.get(config.API.leaveUserId(id), {})
|
.get(config.API.leaveUserId(id), {})
|
||||||
.then(async (res) => {
|
.then(async res => {
|
||||||
const data = await res.data.result;
|
const data = await res.data.result
|
||||||
|
|
||||||
dataStore.typeId = data.leaveTypeId;
|
dataStore.typeId = data.leaveTypeId
|
||||||
|
|
||||||
titleName.value = data.fullName ?? "-";
|
titleName.value = data.fullName ?? "-"
|
||||||
formData.id = data.id ?? "-";
|
formData.id = data.id ?? "-"
|
||||||
formData.leaveTypeName = data.leaveTypeName ?? "-";
|
formData.leaveTypeName = data.leaveTypeName ?? "-"
|
||||||
formData.leaveTypeId = data.leaveTypeId ?? "-";
|
formData.leaveTypeId = data.leaveTypeId ?? "-"
|
||||||
formData.fullname = data.fullName ?? "-";
|
formData.fullname = data.fullName ?? "-"
|
||||||
formData.dateSendLeave =
|
formData.dateSendLeave = data.dateSendLeave && date2Thai(data.dateSendLeave)
|
||||||
data.dateSendLeave && date2Thai(data.dateSendLeave);
|
formData.status = data.status ?? "-"
|
||||||
formData.status = data.status ?? "-";
|
formData.leaveStartDate = data.leaveStartDate
|
||||||
formData.leaveStartDate = data.leaveStartDate;
|
// console.log(formData.leaveDateStart)
|
||||||
// console.log(formData.leaveDateStart)
|
formData.leaveEndDate = data.leaveEndDate
|
||||||
formData.leaveEndDate = data.leaveEndDate;
|
// console.log(formData.leaveDateEnd)
|
||||||
// console.log(formData.leaveDateEnd)
|
formData.leaveCount = data.leaveTotal ?? "-"
|
||||||
formData.leaveCount = data.leaveTotal ?? "-";
|
formData.leaveWrote = data.leaveWrote ?? "-"
|
||||||
formData.leaveWrote = data.leaveWrote ?? "-";
|
formData.leaveAddress = data.leaveAddress ?? "-"
|
||||||
formData.leaveAddress = data.leaveAddress ?? "-";
|
formData.leaveNumber = data.leaveNumber ?? "-"
|
||||||
formData.leaveNumber = data.leaveNumber ?? "-";
|
formData.leaveDetail = data.leaveDetail ?? "-"
|
||||||
formData.leaveDetail = data.leaveDetail ?? "-";
|
formData.leaveDocument = data.leaveDocument
|
||||||
formData.leaveDocument = data.leaveDocument;
|
formData.leaveDraftDocument = data.leaveDraftDocument
|
||||||
formData.leaveDraftDocument = data.leaveDraftDocument;
|
formData.leaveLastStart = data.leaveLastStart && date2Thai(data.leaveLastStart)
|
||||||
formData.leaveLastStart =
|
formData.leaveLastEnd = data.leaveLastStart && date2Thai(data.leaveLastEnd)
|
||||||
data.leaveLastStart && date2Thai(data.leaveLastStart);
|
formData.leaveTotal = data.leaveTotal
|
||||||
formData.leaveLastEnd =
|
formData.leavebirthDate = data.leaveBirthDate && date2Thai(data.leaveBirthDate)
|
||||||
data.leaveLastStart && date2Thai(data.leaveLastEnd);
|
formData.leavegovernmentDate = data.leaveGovernmentDate && date2Thai(data.leaveGovernmentDate)
|
||||||
formData.leaveTotal = data.leaveTotal;
|
formData.leaveSalary = data.leaveSalary ?? "-"
|
||||||
formData.leavebirthDate =
|
formData.leaveSalaryText = data.leaveSalaryText ?? "-"
|
||||||
data.leaveBirthDate && date2Thai(data.leaveBirthDate);
|
formData.wifeDayName = data.wifeDayName ?? "-"
|
||||||
formData.leavegovernmentDate =
|
formData.wifeDayDateBorn = data.wifeDayDateBorn && date2Thai(data.wifeDayDateBorn)
|
||||||
data.leaveGovernmentDate && date2Thai(data.leaveGovernmentDate);
|
formData.restDayOldTotal = data.restDayOldTotal ?? "-"
|
||||||
formData.leaveSalary = data.leaveSalary ?? "-";
|
formData.restDayCurrentTotal = data.restDayCurrentTotal ?? "-"
|
||||||
formData.leaveSalaryText = data.leaveSalaryText ?? "-";
|
formData.ordainDayStatus = data.ordainDayStatus
|
||||||
formData.wifeDayName = data.wifeDayName ?? "-";
|
formData.ordainDayLocationName = data.ordainDayLocationName ?? "-"
|
||||||
formData.wifeDayDateBorn =
|
formData.ordainDayLocationAddress = data.ordainDayLocationAddress ?? "-"
|
||||||
data.wifeDayDateBorn && date2Thai(data.wifeDayDateBorn);
|
formData.ordainDayLocationNumber = data.ordainDayLocationNumber ?? "-"
|
||||||
formData.restDayOldTotal = data.restDayOldTotal ?? "-";
|
formData.ordainDayOrdination = data.ordainDayOrdination && date2Thai(data.ordainDayOrdination)
|
||||||
formData.restDayCurrentTotal = data.restDayCurrentTotal ?? "-";
|
formData.ordainDayBuddhistLentName = data.ordainDayBuddhistLentName ?? "-"
|
||||||
formData.ordainDayStatus = data.ordainDayStatus;
|
formData.ordainDayBuddhistLentAddress = data.ordainDayBuddhistLentAddress ?? "-"
|
||||||
formData.ordainDayLocationName = data.ordainDayLocationName ?? "-";
|
formData.hajjDayStatus = data.hajjDayStatus
|
||||||
formData.ordainDayLocationAddress = data.ordainDayLocationAddress ?? "-";
|
formData.absentDaySummon = data.absentDaySummon ?? "-"
|
||||||
formData.ordainDayLocationNumber = data.ordainDayLocationNumber ?? "-";
|
formData.absentDayLocation = data.absentDayLocation ?? "-"
|
||||||
formData.ordainDayOrdination =
|
formData.absentDayRegistorDate = data.absentDayRegistorDate && date2Thai(data.absentDayRegistorDate)
|
||||||
data.ordainDayOrdination && date2Thai(data.ordainDayOrdination);
|
formData.absentDayGetIn = data.absentDayGetIn ?? "-"
|
||||||
formData.ordainDayBuddhistLentName =
|
formData.absentDayAt = data.absentDayAt ?? "-"
|
||||||
data.ordainDayBuddhistLentName ?? "-";
|
formData.studyDaySubject = data.studyDaySubject ?? "-"
|
||||||
formData.ordainDayBuddhistLentAddress =
|
formData.studyDayDegreeLevel = data.studyDayDegreeLevel ?? "-"
|
||||||
data.ordainDayBuddhistLentAddress ?? "-";
|
formData.studyDayUniversityName = data.studyDayUniversityName ?? "-"
|
||||||
formData.hajjDayStatus = data.hajjDayStatus;
|
formData.studyDayTrainingSubject = data.studyDayTrainingSubject ?? "-" ?? "-"
|
||||||
formData.absentDaySummon = data.absentDaySummon ?? "-";
|
formData.studyDayTrainingName = data.studyDayTrainingName ?? "-"
|
||||||
formData.absentDayLocation = data.absentDayLocation ?? "-";
|
formData.studyDayCountry = data.studyDayCountry ?? "-"
|
||||||
formData.absentDayRegistorDate =
|
formData.studyDayScholarship = data.studyDayScholarship ?? "-"
|
||||||
data.absentDayRegistorDate && date2Thai(data.absentDayRegistorDate);
|
formData.coupleDayName = data.coupleDayName ?? "-"
|
||||||
formData.absentDayGetIn = data.absentDayGetIn ?? "-";
|
formData.coupleDayPosition = data.coupleDayPosition ?? "-"
|
||||||
formData.absentDayAt = data.absentDayAt ?? "-";
|
formData.coupleDayLevel = data.coupleDayLevel ?? "-"
|
||||||
formData.studyDaySubject = data.studyDaySubject ?? "-";
|
formData.coupleDayLevelCountry = data.coupleDayLevelCountry ?? "-"
|
||||||
formData.studyDayDegreeLevel = data.studyDayDegreeLevel ?? "-";
|
formData.coupleDayCountryHistory = data.coupleDayCountryHistory ?? "-"
|
||||||
formData.studyDayUniversityName = data.studyDayUniversityName ?? "-";
|
formData.coupleDayTotalHistory = data.coupleDayTotalHistory ?? "-"
|
||||||
formData.studyDayTrainingSubject =
|
formData.coupleDayStartDateHistory = data.coupleDayStartDateHistory
|
||||||
data.studyDayTrainingSubject ?? "-" ?? "-";
|
formData.coupleDayEndDateHistory = data.coupleDayEndDateHistory
|
||||||
formData.studyDayTrainingName = data.studyDayTrainingName ?? "-";
|
formData.coupleDaySumTotalHistory = data.coupleDaySumTotalHistory ?? "-"
|
||||||
formData.studyDayCountry = data.studyDayCountry ?? "-";
|
formData.approveStep = data.approveStep ?? "-"
|
||||||
formData.studyDayScholarship = data.studyDayScholarship ?? "-";
|
formData.dear = data.dear ?? "-"
|
||||||
formData.coupleDayName = data.coupleDayName ?? "-";
|
formData.leaveLast = data.leaveLast ?? "-"
|
||||||
formData.coupleDayPosition = data.coupleDayPosition ?? "-";
|
// checkLeaveType(formData.leaveTypeId, formData.leaveTypeName)
|
||||||
formData.coupleDayLevel = data.coupleDayLevel ?? "-";
|
|
||||||
formData.coupleDayLevelCountry = data.coupleDayLevelCountry ?? "-";
|
|
||||||
formData.coupleDayCountryHistory = data.coupleDayCountryHistory ?? "-";
|
|
||||||
formData.coupleDayTotalHistory = data.coupleDayTotalHistory ?? "-";
|
|
||||||
formData.coupleDayStartDateHistory = data.coupleDayStartDateHistory;
|
|
||||||
formData.coupleDayEndDateHistory = data.coupleDayEndDateHistory;
|
|
||||||
formData.coupleDaySumTotalHistory = data.coupleDaySumTotalHistory ?? "-";
|
|
||||||
formData.approveStep = data.approveStep ?? "-";
|
|
||||||
formData.dear = data.dear ?? "-";
|
|
||||||
formData.leaveLast = data.leaveLast ?? "-";
|
|
||||||
// checkLeaveType(formData.leaveTypeId, formData.leaveTypeName)
|
|
||||||
|
|
||||||
dataStore.fetchProfileOld(data);
|
dataStore.fetchProfileOld(data)
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
messageError($q, err);
|
messageError($q, err)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader()
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const model = computed(() => {
|
const model = computed(() => {
|
||||||
return (
|
return dataStore.options.find(x => x.id == formData.leaveTypeId)?.code ?? ""
|
||||||
dataStore.options.find((x) => x.id == formData.leaveTypeId)?.code ?? ""
|
})
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const modelSpecific = computed(() => {
|
const modelSpecific = computed(() => {
|
||||||
const code = dataStore.options.find(
|
const code = dataStore.options.find(x => x.id == formData.leaveTypeId)?.code
|
||||||
(x) => x.id == formData.leaveTypeId
|
|
||||||
)?.code;
|
|
||||||
|
|
||||||
if (code == "LV-006" && formData.ordainDayLocationName != "") {
|
if (code == "LV-006" && formData.ordainDayLocationName != "") {
|
||||||
return "b1";
|
return "b1"
|
||||||
} else if (code == "LV-006" && formData.ordainDayLocationName == "") {
|
} else if (code == "LV-006" && formData.ordainDayLocationName == "") {
|
||||||
return "b2";
|
return "b2"
|
||||||
} else if (code == "LV-008" && formData.studyDayTrainingSubject == "") {
|
} else if (code == "LV-008" && formData.studyDayTrainingSubject == "") {
|
||||||
return "s1";
|
return "s1"
|
||||||
} else if (code == "LV-008" && formData.studyDayTrainingSubject != "") {
|
} else if (code == "LV-008" && formData.studyDayTrainingSubject != "") {
|
||||||
return "s2";
|
return "s2"
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return ""
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
function onSubmit(postData: FormData) {
|
function onSubmit(formData: FormData) {
|
||||||
dialogConfirm($q, async () => {
|
dialogConfirm($q, async () => {
|
||||||
showLoader();
|
showLoader()
|
||||||
await http
|
await http
|
||||||
.post(config.API.leaveUser(), postData)
|
.put(config.API.leaveUserId(personalId.value), formData)
|
||||||
// .put(config.API.leaveUser() + "/" + formData.id, postData)
|
// .put(config.API.leaveUser() + "/" + formData.id, postData)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
success($q, "บันทึกสำเร็จ");
|
success($q, "บันทึกสำเร็จ")
|
||||||
})
|
})
|
||||||
.catch((e: any) => {
|
.catch((e: any) => {
|
||||||
messageError($q, e);
|
messageError($q, e)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader()
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function onConfirm(id: string) {
|
function onConfirm() {
|
||||||
dialogConfirm(
|
console.log(personalId.value)
|
||||||
$q,
|
dialogConfirm(
|
||||||
async () => {
|
$q,
|
||||||
// showLoader();
|
async () => {
|
||||||
// await http
|
showLoader()
|
||||||
// .post(config.API.leaveUser() + "/" + id)
|
await http
|
||||||
// .then(() => {
|
.get(config.API.leaveUserSendId(personalId.value))
|
||||||
router.push("/leave");
|
.then(() => {
|
||||||
success($q, "ยื่นใบลาสำเร็จ");
|
// router.push("/leave")
|
||||||
// })
|
success($q, "ยื่นใบลาสำเร็จ")
|
||||||
// .catch((e: any) => {
|
})
|
||||||
// messageError($q, e);
|
.catch((e: any) => {
|
||||||
// })
|
messageError($q, e)
|
||||||
// .finally(() => {
|
})
|
||||||
// hideLoader();
|
.finally(() => {
|
||||||
// });
|
hideLoader()
|
||||||
},
|
})
|
||||||
"ยืนยันการยื่นใบลา",
|
},
|
||||||
"หากยืนยันแล้วจะไม่สามารถกลับมาแก้ไขได้ ต้องการยืนยันการยื่นใบลานี้ใช่หรือไม่"
|
"ยืนยันการยื่นใบลา",
|
||||||
);
|
"หากยืนยันแล้วจะไม่สามารถกลับมาแก้ไขได้ ต้องการยืนยันการยื่นใบลานี้ใช่หรือไม่"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**เมื่อเริ่มโหลดหน้า
|
/**เมื่อเริ่มโหลดหน้า
|
||||||
* เรียกใช้งาน fetchData เพื่อดึงข้อมูล
|
* เรียกใช้งาน fetchData เพื่อดึงข้อมูล
|
||||||
*/
|
*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchDataDetail(personalId.value);
|
fetchDataDetail(personalId.value)
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="col-12 row justify-center">
|
<div class="col-12 row justify-center">
|
||||||
<div class="col-xs-12 col-sm-12 col-md-11">
|
<div class="col-xs-12 col-sm-12 col-md-11">
|
||||||
<div class="toptitle text-white col-12 row items-center">
|
<div class="toptitle text-white col-12 row items-center">
|
||||||
<q-btn
|
<q-btn to="/leave" icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm" />
|
||||||
to="/leave"
|
<div>
|
||||||
icon="mdi-arrow-left"
|
แก้ไขใบลา
|
||||||
unelevated
|
{{ formData.leaveTypeName }} {{ personalId }}
|
||||||
round
|
</div>
|
||||||
dense
|
</div>
|
||||||
flat
|
<q-form ref="myform" class="col-12">
|
||||||
color="primary"
|
<q-card bordered>
|
||||||
class="q-mr-sm"
|
<div class="col-12 row q-col-gutter-md q-pa-md">
|
||||||
/>
|
<div class="col-xs-12 col-sm-12">
|
||||||
<div>
|
<div style="display: flex; align-items: center">
|
||||||
แก้ไขใบลา
|
<q-icon name="mdi-numeric-1-circle" size="20px" color="primary" />
|
||||||
<!-- {{ formData.leaveTypeName }} {{ leaveId }} -->
|
<div class="q-pl-sm text-weight-bold text-dark">เลือกประเภทการลา</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="q-py-sm q-px-lg">
|
||||||
<q-form ref="myform" class="col-12">
|
<div class="row">
|
||||||
<q-card bordered>
|
<q-select
|
||||||
<div class="col-12 row q-col-gutter-md q-pa-md">
|
readonly
|
||||||
<div class="col-xs-12 col-sm-12">
|
dense
|
||||||
<div style="display: flex; align-items: center">
|
class="col-12 col-sm-6 col-md-4"
|
||||||
<q-icon
|
outlined
|
||||||
name="mdi-numeric-1-circle"
|
v-model="formData.leaveTypeName"
|
||||||
size="20px"
|
option-value="code"
|
||||||
color="primary"
|
option-label="name"
|
||||||
/>
|
emit-value
|
||||||
<div class="q-pl-sm text-weight-bold text-dark">
|
map-options
|
||||||
เลือกประเภทการลา
|
prefix="ประเภทใบลา :"
|
||||||
</div>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="q-py-sm q-px-lg">
|
<div class="row q-mt-sm">
|
||||||
<div class="row">
|
<div class="col-12 col-sm-6 col-md-3" v-if="model === 'LV-006' || model === 'LV-008'">
|
||||||
<q-select
|
<q-select
|
||||||
readonly
|
readonly
|
||||||
dense
|
dense
|
||||||
class="col-12 col-sm-6 col-md-4"
|
outlined
|
||||||
outlined
|
v-model="modelSpecific"
|
||||||
v-model="formData.leaveTypeName"
|
:options="model === 'LV-006' ? dataStore.optionsOrdination : dataStore.optionsSpecific"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
prefix="ประเภทใบลา :"
|
prefix="ประเภทการลา :"
|
||||||
/>
|
@update:model-value="dataStore.typeConvert(model, modelSpecific)"
|
||||||
</div>
|
/>
|
||||||
<div class="row q-mt-sm">
|
</div>
|
||||||
<div
|
</div>
|
||||||
class="col-12 col-sm-6 col-md-3"
|
</div>
|
||||||
v-if="model === 'LV-006' || model === 'LV-008'"
|
|
||||||
>
|
|
||||||
<q-select
|
|
||||||
readonly
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
v-model="modelSpecific"
|
|
||||||
:options="
|
|
||||||
model === 'LV-006'
|
|
||||||
? dataStore.optionsOrdination
|
|
||||||
: dataStore.optionsSpecific
|
|
||||||
"
|
|
||||||
option-value="code"
|
|
||||||
option-label="name"
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
prefix="ประเภทการลา :"
|
|
||||||
@update:model-value="
|
|
||||||
dataStore.typeConvert(model, modelSpecific)
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div style="display: flex; align-items: center">
|
<div style="display: flex; align-items: center">
|
||||||
<q-icon
|
<q-icon name="mdi-numeric-2-circle" size="20px" color="primary" />
|
||||||
name="mdi-numeric-2-circle"
|
<div class="q-pl-sm text-weight-bold text-dark">ข้อมูลการลา</div>
|
||||||
size="20px"
|
</div>
|
||||||
color="primary"
|
<FormPart2 :model="model" :data="formData" :leaveTypeId="formData.leaveTypeId" />
|
||||||
/>
|
</div>
|
||||||
<div class="q-pl-sm text-weight-bold text-dark">
|
</div>
|
||||||
ข้อมูลการลา
|
<div class="col-12">
|
||||||
</div>
|
<SickForm v-if="model === 'LV-001' || model === 'LV-002'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
</div>
|
<FormBirth v-if="model === 'LV-003'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
<FormPart2
|
<HelpWifeBirthForm v-if="model === 'LV-004'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
:model="model"
|
<VacationForm v-if="model === 'LV-005'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
:data="formData"
|
<OrdinationForm v-if="model === 'LV-006' && modelSpecific === 'b1'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
:leaveTypeId="formData.leaveTypeId"
|
<HajjForm v-if="model === 'LV-006' && modelSpecific === 'b2'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
/>
|
<MilitaryForm v-if="model === 'LV-007'" style="width: 100%" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
</div>
|
<StudyForm v-if="model === 'LV-008' && modelSpecific === 's1'" style="width: 100%" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
</div>
|
<TrainForm v-if="model === 'LV-008' && modelSpecific != 's1' && modelSpecific != ''" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
<div class="col-12">
|
<WorkInternationalForm v-if="model === 'LV-009'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
<SickForm
|
<FollowSpouseForm v-if="model === 'LV-010'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
v-if="model === 'LV-001' || model === 'LV-002'"
|
<RehabilitationForm v-if="model === 'LV-011'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
:data="formData"
|
</div>
|
||||||
:on-submit="onSubmit"
|
</div>
|
||||||
:on-confirm="onConfirm"
|
</q-card>
|
||||||
/>
|
</q-form>
|
||||||
<FormBirth
|
</div>
|
||||||
v-if="model === 'LV-003'"
|
</div>
|
||||||
:data="formData"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
:on-confirm="onConfirm"
|
|
||||||
/>
|
|
||||||
<HelpWifeBirthForm
|
|
||||||
v-if="model === 'LV-004'"
|
|
||||||
:data="formData"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
:on-confirm="onConfirm"
|
|
||||||
/>
|
|
||||||
<VacationForm
|
|
||||||
v-if="model === 'LV-005'"
|
|
||||||
:data="formData"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
:on-confirm="onConfirm"
|
|
||||||
/>
|
|
||||||
<OrdinationForm
|
|
||||||
v-if="model === 'LV-006' && modelSpecific === 'b1'"
|
|
||||||
:data="formData"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
:on-confirm="onConfirm"
|
|
||||||
/>
|
|
||||||
<HajjForm
|
|
||||||
v-if="model === 'LV-006' && modelSpecific === 'b2'"
|
|
||||||
:data="formData"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
:on-confirm="onConfirm"
|
|
||||||
/>
|
|
||||||
<MilitaryForm
|
|
||||||
v-if="model === 'LV-007'"
|
|
||||||
style="width: 100%"
|
|
||||||
:data="formData"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
:on-confirm="onConfirm"
|
|
||||||
/>
|
|
||||||
<StudyForm
|
|
||||||
v-if="model === 'LV-008' && modelSpecific === 's1'"
|
|
||||||
style="width: 100%"
|
|
||||||
:data="formData"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
:on-confirm="onConfirm"
|
|
||||||
/>
|
|
||||||
<TrainForm
|
|
||||||
v-if="
|
|
||||||
model === 'LV-008' &&
|
|
||||||
modelSpecific != 's1' &&
|
|
||||||
modelSpecific != ''
|
|
||||||
"
|
|
||||||
:data="formData"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
:on-confirm="onConfirm"
|
|
||||||
/>
|
|
||||||
<WorkInternationalForm
|
|
||||||
v-if="model === 'LV-009'"
|
|
||||||
:data="formData"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
:on-confirm="onConfirm"
|
|
||||||
/>
|
|
||||||
<FollowSpouseForm
|
|
||||||
v-if="model === 'LV-010'"
|
|
||||||
:data="formData"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
:on-confirm="onConfirm"
|
|
||||||
/>
|
|
||||||
<RehabilitationForm
|
|
||||||
v-if="model === 'LV-011'"
|
|
||||||
:data="formData"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
:on-confirm="onConfirm"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</q-card>
|
|
||||||
</q-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue