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,43 +1,42 @@
|
||||||
<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 ประเภทการลา
|
||||||
|
|
@ -45,39 +44,39 @@ async function fetchDataTable() {
|
||||||
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 => {
|
||||||
|
messageError($q, err)
|
||||||
})
|
})
|
||||||
.catch((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
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -108,11 +107,11 @@ async function onClickClose() {
|
||||||
*/
|
*/
|
||||||
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,17 +121,17 @@ 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
|
||||||
|
|
@ -151,84 +150,35 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<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"
|
|
||||||
:props="props"
|
|
||||||
@click="onClickView(props.row.id, props.row.status)"
|
|
||||||
>
|
|
||||||
{{ (page - 1) * pageSize + props.rowIndex + 1 }}
|
{{ (page - 1) * pageSize + props.rowIndex + 1 }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td
|
<q-td key="leaveTypeName" :props="props" @click="onClickView(props.row.id, props.row.status)">
|
||||||
key="leaveTypeName"
|
|
||||||
:props="props"
|
|
||||||
@click="onClickView(props.row.id, props.row.status)"
|
|
||||||
>
|
|
||||||
{{ props.row.leaveTypeName }}
|
{{ props.row.leaveTypeName }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td
|
<q-td key="dateLeave" :props="props">
|
||||||
key="dateSendLeave"
|
{{ props.row.dateLeave }}
|
||||||
:props="props"
|
</q-td>
|
||||||
@click="onClickView(props.row.id, props.row.status)"
|
<q-td key="dateSendLeave" :props="props" @click="onClickView(props.row.id, props.row.status)">
|
||||||
>
|
|
||||||
{{ props.row.dateSendLeave }}
|
{{ props.row.dateSendLeave }}
|
||||||
</q-td>
|
</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' &&
|
|
||||||
props.row.status != 'REJECT' &&
|
|
||||||
props.row.status != 'CANCEL'
|
|
||||||
"
|
|
||||||
flat
|
flat
|
||||||
icon="mdi-dots-vertical"
|
icon="mdi-dots-vertical"
|
||||||
color="grey-8"
|
color="grey-8"
|
||||||
|
|
@ -239,21 +189,14 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<q-menu>
|
<q-menu>
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-item
|
<q-item clickable v-close-popup @click="onClickView(props.row.id, 'CANCEL')">
|
||||||
clickable
|
|
||||||
v-close-popup
|
|
||||||
@click="onClickView(props.row.id, 'CANCEL')"
|
|
||||||
>
|
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>ขอยกเลิก</q-item-label>
|
<q-item-label>ขอยกเลิก</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item
|
<q-item
|
||||||
v-if="
|
v-if="
|
||||||
props.row.status != 'DELETE' &&
|
(props.row.status != 'DELETE' && props.row.status != 'REJECT' && props.row.status != 'CANCEL' && props.row.status == 'NEW') || props.row.status == 'DRAFT'
|
||||||
props.row.status != 'REJECT' &&
|
|
||||||
props.row.status != 'CANCEL' &&
|
|
||||||
props.row.status == 'NEW'
|
|
||||||
"
|
"
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
|
|
@ -294,12 +237,5 @@ onMounted(async () => {
|
||||||
</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,31 +1,25 @@
|
||||||
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
|
||||||
|
|
@ -38,38 +32,39 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
leaveTypeId: e.leaveTypeId,
|
leaveTypeId: e.leaveTypeId,
|
||||||
fullName: e.fullName,
|
fullName: e.fullName,
|
||||||
dateSendLeave: e.dateSendLeave && date2Thai(e.dateSendLeave),
|
dateSendLeave: e.dateSendLeave && date2Thai(e.dateSendLeave),
|
||||||
|
dateLeave: date2Thai(e.leaveStartDate) + " - " + date2Thai(e.leaveEndDate),
|
||||||
status: e.status,
|
status: e.status,
|
||||||
statusConvert: convertStatud(e.status),
|
statusConvert: convertStatud(e.status),
|
||||||
isDelete: e.isDelete,
|
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 ประเภทการลา
|
||||||
|
|
@ -81,20 +76,20 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
/** สถานะของการลา */
|
/** สถานะของการลา */
|
||||||
|
|
@ -106,8 +101,8 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
{ 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
|
||||||
|
|
@ -119,20 +114,16 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
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
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "LeaveStatusOption":
|
case "LeaveStatusOption":
|
||||||
update(() => {
|
update(() => {
|
||||||
statusOptions.value = statusOptionsMain.value.filter(
|
statusOptions.value = statusOptionsMain.value.filter((v: any) => v.name.indexOf(val) > -1)
|
||||||
(v: any) => v.name.indexOf(val) > -1
|
})
|
||||||
);
|
break
|
||||||
});
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -140,21 +131,16 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
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"]>([
|
||||||
{
|
{
|
||||||
|
|
@ -175,6 +161,15 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px; width:15%;",
|
style: "font-size: 14px; width:15%;",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "dateLeave",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่ลา",
|
||||||
|
sortable: true,
|
||||||
|
field: "dateLeave",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px; width:15%;",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "dateSendLeave",
|
name: "dateSendLeave",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -184,6 +179,7 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px; width:15%;",
|
style: "font-size: 14px; width:15%;",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "status",
|
name: "status",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -193,7 +189,7 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px; width:10%;",
|
style: "font-size: 14px; width:10%;",
|
||||||
},
|
},
|
||||||
]);
|
])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*ฟังก์ชั่นแปลงประเภทแบบฟอร์มลา
|
*ฟังก์ชั่นแปลงประเภทแบบฟอร์มลา
|
||||||
|
|
@ -203,13 +199,13 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
function typeConvert(item: string, subitem: any) {
|
function typeConvert(item: string, subitem: any) {
|
||||||
// console.log('first',item)
|
// console.log('first',item)
|
||||||
// if (item !== "LV-006" && item !== "LV-008") {
|
// if (item !== "LV-006" && item !== "LV-008") {
|
||||||
typeLeave.value = convertSubtitle(item);
|
typeLeave.value = convertSubtitle(item)
|
||||||
// } else if (item === "LV-006") {
|
// } else if (item === "LV-006") {
|
||||||
// typeLeave.value = convertSubtitleInfo(subitem);
|
// typeLeave.value = convertSubtitleInfo(subitem);
|
||||||
// } else if (item === "LV-008") {
|
// } else if (item === "LV-008") {
|
||||||
// typeLeave.value = convertSubtitleInfo2(subitem);
|
// typeLeave.value = convertSubtitleInfo2(subitem);
|
||||||
// }
|
// }
|
||||||
typeId.value = convertId(item);
|
typeId.value = convertId(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -218,7 +214,7 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
* @returns ส่งค่าที่แปลงแล้ว
|
* @returns ส่งค่าที่แปลงแล้ว
|
||||||
*/
|
*/
|
||||||
function convertSubtitle(val: string) {
|
function convertSubtitle(val: string) {
|
||||||
return options.value.find((x) => x.code == val)?.name;
|
return options.value.find(x => x.code == val)?.name
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -227,7 +223,7 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
* @returns ส่งค่าที่แปลงแล้ว
|
* @returns ส่งค่าที่แปลงแล้ว
|
||||||
*/
|
*/
|
||||||
function convertSubtitleInfo(val: string) {
|
function convertSubtitleInfo(val: string) {
|
||||||
return optionsOrdination.value.find((x) => x.id == val)?.name;
|
return optionsOrdination.value.find(x => x.id == val)?.name
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -236,7 +232,7 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
* @returns ส่งค่าที่แปลงแล้ว
|
* @returns ส่งค่าที่แปลงแล้ว
|
||||||
*/
|
*/
|
||||||
function convertSubtitleInfo2(val: string) {
|
function convertSubtitleInfo2(val: string) {
|
||||||
return optionsSpecific.value.find((x) => x.id == val)?.name;
|
return optionsSpecific.value.find(x => x.id == val)?.name
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -245,110 +241,106 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
* @returns ส่งค่าที่แปลงแล้ว
|
* @returns ส่งค่าที่แปลงแล้ว
|
||||||
*/
|
*/
|
||||||
function convertId(val: string) {
|
function convertId(val: string) {
|
||||||
return options.value.find((x) => x.code == val)?.id;
|
return options.value.find(x => x.code == val)?.id
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*ตัวแปร profile ที่จะส่งออก
|
*ตัวแปร profile ที่จะส่งออก
|
||||||
*/
|
*/
|
||||||
const dateSendLeave = ref<Date>(); //วันที่ยื่นใบลา
|
const dateSendLeave = ref<Date>() //วันที่ยื่นใบลา
|
||||||
const leaveTypeName = ref<string>(""); //Name ประเภทการลา
|
const leaveTypeName = ref<string>("") //Name ประเภทการลา
|
||||||
const dear = ref<string>(""); //เรียน
|
const dear = ref<string>("") //เรียน
|
||||||
const fullName = ref<string>(""); //คำนำหน้า ชื่อ นามสกุล ผู้ยื่นขอ
|
const fullName = ref<string>("") //คำนำหน้า ชื่อ นามสกุล ผู้ยื่นขอ
|
||||||
const positionName = ref<string>(""); //ตำแหน่งผู้ยื่นขอ
|
const positionName = ref<string>("") //ตำแหน่งผู้ยื่นขอ
|
||||||
const positionLevelName = ref<string>(""); //ระดับผู้ยื่นขอ
|
const positionLevelName = ref<string>("") //ระดับผู้ยื่นขอ
|
||||||
const organizationName = ref<string>(""); //สังกัดผู้ยื่นขอ
|
const organizationName = ref<string>("") //สังกัดผู้ยื่นขอ
|
||||||
const leaveLimit = ref<number>(0); //โควต้าลา(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
const leaveLimit = ref<number>(0) //โควต้าลา(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
||||||
const leaveTotal = ref<number>(0); //ลาไปแล้ว(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
const leaveTotal = ref<number>(0) //ลาไปแล้ว(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
||||||
const leaveRemain = ref<number>(0); //คงเหลือโควต้า(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
const leaveRemain = ref<number>(0) //คงเหลือโควต้า(แต่ละประเภท)หน่วยเป็นวัน(ภายในปีนั้น)
|
||||||
const restDayTotalOld = ref<number>(0); //จำนวนวันลาพักผ่อนสะสม จากปีที่ผ่านมา
|
const restDayTotalOld = ref<number>(0) //จำนวนวันลาพักผ่อนสะสม จากปีที่ผ่านมา
|
||||||
const birthDate = ref<Date>(); //วันเกิด
|
const birthDate = ref<Date>() //วันเกิด
|
||||||
const dateAppoint = ref<Date>(); //วันที่เข้ารับราชการ
|
const dateAppoint = ref<Date>() //วันที่เข้ารับราชการ
|
||||||
const salary = ref<number>(0); //เงินเดือนปัจจุบัน
|
const salary = ref<number>(0) //เงินเดือนปัจจุบัน
|
||||||
const salaryText = ref<string>(""); //เงินเดือนปัจจุบัน(ภาษาไทย)
|
const salaryText = ref<string>("") //เงินเดือนปัจจุบัน(ภาษาไทย)
|
||||||
const leaveLast = ref<any>();
|
const leaveLast = ref<any>()
|
||||||
const restDayCurrentTotal = ref<string>("");
|
const restDayCurrentTotal = ref<string>("")
|
||||||
|
|
||||||
//ดึงข้อมูล profile จาก API
|
//ดึงข้อมูล profile จาก API
|
||||||
async function fetchProfile() {
|
async function fetchProfile() {
|
||||||
await http
|
await http
|
||||||
.post(config.API.leaveProfile(), { type: typeId.value })
|
.post(config.API.leaveProfile(), { type: typeId.value })
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result
|
||||||
dateSendLeave.value = data.dateSendLeave;
|
dateSendLeave.value = data.dateSendLeave
|
||||||
leaveTypeName.value = data.leaveTypeName;
|
leaveTypeName.value = data.leaveTypeName
|
||||||
dear.value = data.dear;
|
dear.value = data.dear
|
||||||
fullName.value = data.fullName;
|
fullName.value = data.fullName
|
||||||
positionName.value = data.positionName;
|
positionName.value = data.positionName
|
||||||
positionLevelName.value = data.positionLevelName;
|
positionLevelName.value = data.positionLevelName
|
||||||
organizationName.value = data.organizationName;
|
organizationName.value = data.organizationName
|
||||||
leaveLimit.value = data.leaveLimit;
|
leaveLimit.value = data.leaveLimit
|
||||||
leaveTotal.value = data.leaveTotal;
|
leaveTotal.value = data.leaveTotal
|
||||||
leaveRemain.value = data.leaveRemain;
|
leaveRemain.value = data.leaveRemain
|
||||||
restDayTotalOld.value = data.restDayTotalOld;
|
restDayTotalOld.value = data.restDayTotalOld
|
||||||
birthDate.value = data.birthDate;
|
birthDate.value = data.birthDate
|
||||||
dateAppoint.value = data.dateAppoint;
|
dateAppoint.value = data.dateAppoint
|
||||||
salary.value = data.salary ? data.salary.toLocaleString("th-TH") : "";
|
salary.value = data.salary ? data.salary.toLocaleString("th-TH") : ""
|
||||||
salaryText.value = data.salaryText;
|
salaryText.value = data.salaryText
|
||||||
leaveLast.value =
|
leaveLast.value = data.leaveLast != "0001-01-01T00:00:00" ? date2Thai(data.leaveLast) : "-"
|
||||||
data.leaveLast != "0001-01-01T00:00:00"
|
restDayCurrentTotal.value = data.restDayCurrentTotal
|
||||||
? date2Thai(data.leaveLast)
|
|
||||||
: "-";
|
|
||||||
restDayCurrentTotal.value = data.restDayCurrentTotal;
|
|
||||||
})
|
})
|
||||||
.catch((e: any) => {
|
.catch((e: any) => {
|
||||||
messageError($q, e);
|
messageError($q, e)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchProfileOld(data: any) {
|
async function fetchProfileOld(data: any) {
|
||||||
await http
|
await http
|
||||||
.post(config.API.leaveProfile(), { type: typeId.value })
|
.post(config.API.leaveProfile(), { type: typeId.value })
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result
|
||||||
leaveLimit.value = data.leaveLimit;
|
leaveLimit.value = data.leaveLimit
|
||||||
leaveTotal.value = data.leaveTotal;
|
leaveTotal.value = data.leaveTotal
|
||||||
leaveRemain.value = data.leaveRemain;
|
leaveRemain.value = data.leaveRemain
|
||||||
restDayTotalOld.value = data.restDayTotalOld; //จำนวนวันลาพักผ่อนสะสม จากปีที่ผ่านมา
|
restDayTotalOld.value = data.restDayTotalOld //จำนวนวันลาพักผ่อนสะสม จากปีที่ผ่านมา
|
||||||
birthDate.value = data.birthDate; // วันเกิด
|
birthDate.value = data.birthDate // วันเกิด
|
||||||
dateAppoint.value = data.dateAppoint; // วันที่รับราชการ
|
dateAppoint.value = data.dateAppoint // วันที่รับราชการ
|
||||||
salary.value = data.salary ? data.salary.toLocaleString("th-TH") : "";
|
salary.value = data.salary ? data.salary.toLocaleString("th-TH") : ""
|
||||||
salaryText.value = data.salaryText;
|
salaryText.value = data.salaryText
|
||||||
})
|
})
|
||||||
.catch((e: any) => {
|
.catch((e: any) => {
|
||||||
messageError($q, e);
|
messageError($q, e)
|
||||||
});
|
})
|
||||||
|
|
||||||
dateSendLeave.value = data.dateSendLeave;
|
dateSendLeave.value = data.dateSendLeave
|
||||||
typeLeave.value = data.leaveTypeName;
|
typeLeave.value = data.leaveTypeName
|
||||||
dear.value = data.dear;
|
dear.value = data.dear
|
||||||
fullName.value = data.fullName;
|
fullName.value = data.fullName
|
||||||
positionName.value = data.positionName;
|
positionName.value = data.positionName
|
||||||
positionLevelName.value = data.positionLevelName;
|
positionLevelName.value = data.positionLevelName
|
||||||
organizationName.value = data.organizationName;
|
organizationName.value = data.organizationName
|
||||||
leaveLast.value =
|
leaveLast.value = data.leaveLast != "0001-01-01T00:00:00" ? date2Thai(data.leaveLast) : "-"
|
||||||
data.leaveLast != "0001-01-01T00:00:00" ? date2Thai(data.leaveLast) : "-";
|
restDayCurrentTotal.value = data.restDayCurrentTotal
|
||||||
restDayCurrentTotal.value = data.restDayCurrentTotal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetForm2() {
|
function resetForm2() {
|
||||||
dateSendLeave.value = undefined;
|
dateSendLeave.value = undefined
|
||||||
leaveTypeName.value = "";
|
leaveTypeName.value = ""
|
||||||
dear.value = "";
|
dear.value = ""
|
||||||
fullName.value = "";
|
fullName.value = ""
|
||||||
positionName.value = "";
|
positionName.value = ""
|
||||||
positionLevelName.value = "";
|
positionLevelName.value = ""
|
||||||
organizationName.value = "";
|
organizationName.value = ""
|
||||||
leaveLimit.value = 0;
|
leaveLimit.value = 0
|
||||||
leaveTotal.value = 0;
|
leaveTotal.value = 0
|
||||||
leaveRemain.value = 0;
|
leaveRemain.value = 0
|
||||||
restDayTotalOld.value = 0;
|
restDayTotalOld.value = 0
|
||||||
birthDate.value = undefined;
|
birthDate.value = undefined
|
||||||
dateAppoint.value = undefined;
|
dateAppoint.value = undefined
|
||||||
salary.value = 0;
|
salary.value = 0
|
||||||
salaryText.value = "";
|
salaryText.value = ""
|
||||||
leaveLast.value = undefined;
|
leaveLast.value = undefined
|
||||||
restDayCurrentTotal.value = "";
|
restDayCurrentTotal.value = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -396,5 +388,5 @@ export const useLeaveStore = defineStore("Leave", () => {
|
||||||
convertStatud,
|
convertStatud,
|
||||||
resetForm2,
|
resetForm2,
|
||||||
fetchProfileOld,
|
fetchProfileOld,
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,39 @@
|
||||||
<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
|
||||||
|
|
@ -41,62 +41,52 @@ const modelSpecific = ref<string>("");
|
||||||
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 => {
|
||||||
|
messageError($q, err)
|
||||||
})
|
})
|
||||||
.catch((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"
|
|
||||||
icon="mdi-arrow-left"
|
|
||||||
unelevated
|
|
||||||
round
|
|
||||||
dense
|
|
||||||
flat
|
|
||||||
color="primary"
|
|
||||||
class="q-mr-sm"
|
|
||||||
/>
|
|
||||||
<div>สร้างใบลา</div>
|
<div>สร้างใบลา</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -105,14 +95,8 @@ onMounted(async () => {
|
||||||
<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"
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
<div class="q-pl-sm text-weight-bold text-dark">
|
|
||||||
เลือกประเภทการลา
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="q-py-sm q-px-lg">
|
<div class="q-py-sm q-px-lg">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -127,36 +111,23 @@ onMounted(async () => {
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
prefix="ประเภทใบลา :"
|
prefix="ประเภทใบลา :"
|
||||||
@update:model-value="
|
@update:model-value="dataStore.typeConvert(model, null), (modelSpecific = ''), dataStore.fetchProfile()"
|
||||||
dataStore.typeConvert(model, null),
|
|
||||||
(modelSpecific = ''),
|
|
||||||
dataStore.fetchProfile()
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</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"
|
|
||||||
v-if="model === 'LV-006' || model === 'LV-008'"
|
|
||||||
>
|
|
||||||
<q-select
|
<q-select
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="modelSpecific"
|
v-model="modelSpecific"
|
||||||
:options="
|
:options="model === 'LV-006' ? dataStore.optionsOrdination : dataStore.optionsSpecific"
|
||||||
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="
|
@update:model-value="dataStore.typeConvert(model, modelSpecific)"
|
||||||
dataStore.typeConvert(model, modelSpecific)
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -164,68 +135,26 @@ onMounted(async () => {
|
||||||
|
|
||||||
<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"
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
<div class="q-pl-sm text-weight-bold text-dark">
|
|
||||||
ข้อมูลการลา
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<FormPart2 :model="model" />
|
<FormPart2 :model="model" />
|
||||||
</div>
|
</div>
|
||||||
</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'"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
/>
|
|
||||||
<FormBirth v-if="model === 'LV-003'" :on-submit="onSubmit" />
|
<FormBirth v-if="model === 'LV-003'" :on-submit="onSubmit" />
|
||||||
<HelpWifeBirthForm
|
<HelpWifeBirthForm v-if="model === 'LV-004'" :on-submit="onSubmit" />
|
||||||
v-if="model === 'LV-004'"
|
|
||||||
:on-submit="onSubmit"
|
|
||||||
/>
|
|
||||||
<VacationForm v-if="model === 'LV-005'" :on-submit="onSubmit" />
|
<VacationForm v-if="model === 'LV-005'" :on-submit="onSubmit" />
|
||||||
<OrdinationForm
|
<OrdinationForm v-if="model === 'LV-006' && modelSpecific == 'b1'" :on-submit="onSubmit" />
|
||||||
v-if="model === 'LV-006' && modelSpecific == 'b1'"
|
<HajjForm v-if="model === 'LV-006' && modelSpecific == 'b2'" :on-submit="onSubmit" />
|
||||||
:on-submit="onSubmit"
|
<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" />
|
||||||
<HajjForm
|
<TrainForm v-if="model === 'LV-008' && modelSpecific != 's1' && modelSpecific != ''" :on-submit="onSubmit" />
|
||||||
v-if="model === 'LV-006' && modelSpecific == 'b2'"
|
<WorkInternationalForm v-if="model === 'LV-009'" :on-submit="onSubmit" />
|
||||||
:on-submit="onSubmit"
|
<FollowSpouseForm v-if="model === 'LV-010'" :on-submit="onSubmit" />
|
||||||
/>
|
<RehabilitationForm v-if="model === 'LV-011'" :on-submit="onSubmit" />
|
||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,38 @@
|
||||||
<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 การยื่นขอลา
|
||||||
|
|
@ -102,195 +94,172 @@ const formData = reactive<any>({
|
||||||
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 =
|
formData.leaveLastStart = data.leaveLastStart && date2Thai(data.leaveLastStart)
|
||||||
data.leaveLastStart && date2Thai(data.leaveLastStart);
|
formData.leaveLastEnd = data.leaveLastStart && date2Thai(data.leaveLastEnd)
|
||||||
formData.leaveLastEnd =
|
formData.leaveTotal = data.leaveTotal
|
||||||
data.leaveLastStart && date2Thai(data.leaveLastEnd);
|
formData.leavebirthDate = data.leaveBirthDate && date2Thai(data.leaveBirthDate)
|
||||||
formData.leaveTotal = data.leaveTotal;
|
formData.leavegovernmentDate = data.leaveGovernmentDate && date2Thai(data.leaveGovernmentDate)
|
||||||
formData.leavebirthDate =
|
formData.leaveSalary = data.leaveSalary ?? "-"
|
||||||
data.leaveBirthDate && date2Thai(data.leaveBirthDate);
|
formData.leaveSalaryText = data.leaveSalaryText ?? "-"
|
||||||
formData.leavegovernmentDate =
|
formData.wifeDayName = data.wifeDayName ?? "-"
|
||||||
data.leaveGovernmentDate && date2Thai(data.leaveGovernmentDate);
|
formData.wifeDayDateBorn = data.wifeDayDateBorn && date2Thai(data.wifeDayDateBorn)
|
||||||
formData.leaveSalary = data.leaveSalary ?? "-";
|
formData.restDayOldTotal = data.restDayOldTotal ?? "-"
|
||||||
formData.leaveSalaryText = data.leaveSalaryText ?? "-";
|
formData.restDayCurrentTotal = data.restDayCurrentTotal ?? "-"
|
||||||
formData.wifeDayName = data.wifeDayName ?? "-";
|
formData.ordainDayStatus = data.ordainDayStatus
|
||||||
formData.wifeDayDateBorn =
|
formData.ordainDayLocationName = data.ordainDayLocationName ?? "-"
|
||||||
data.wifeDayDateBorn && date2Thai(data.wifeDayDateBorn);
|
formData.ordainDayLocationAddress = data.ordainDayLocationAddress ?? "-"
|
||||||
formData.restDayOldTotal = data.restDayOldTotal ?? "-";
|
formData.ordainDayLocationNumber = data.ordainDayLocationNumber ?? "-"
|
||||||
formData.restDayCurrentTotal = data.restDayCurrentTotal ?? "-";
|
formData.ordainDayOrdination = data.ordainDayOrdination && date2Thai(data.ordainDayOrdination)
|
||||||
formData.ordainDayStatus = data.ordainDayStatus;
|
formData.ordainDayBuddhistLentName = data.ordainDayBuddhistLentName ?? "-"
|
||||||
formData.ordainDayLocationName = data.ordainDayLocationName ?? "-";
|
formData.ordainDayBuddhistLentAddress = data.ordainDayBuddhistLentAddress ?? "-"
|
||||||
formData.ordainDayLocationAddress = data.ordainDayLocationAddress ?? "-";
|
formData.hajjDayStatus = data.hajjDayStatus
|
||||||
formData.ordainDayLocationNumber = data.ordainDayLocationNumber ?? "-";
|
formData.absentDaySummon = data.absentDaySummon ?? "-"
|
||||||
formData.ordainDayOrdination =
|
formData.absentDayLocation = data.absentDayLocation ?? "-"
|
||||||
data.ordainDayOrdination && date2Thai(data.ordainDayOrdination);
|
formData.absentDayRegistorDate = data.absentDayRegistorDate && date2Thai(data.absentDayRegistorDate)
|
||||||
formData.ordainDayBuddhistLentName =
|
formData.absentDayGetIn = data.absentDayGetIn ?? "-"
|
||||||
data.ordainDayBuddhistLentName ?? "-";
|
formData.absentDayAt = data.absentDayAt ?? "-"
|
||||||
formData.ordainDayBuddhistLentAddress =
|
formData.studyDaySubject = data.studyDaySubject ?? "-"
|
||||||
data.ordainDayBuddhistLentAddress ?? "-";
|
formData.studyDayDegreeLevel = data.studyDayDegreeLevel ?? "-"
|
||||||
formData.hajjDayStatus = data.hajjDayStatus;
|
formData.studyDayUniversityName = data.studyDayUniversityName ?? "-"
|
||||||
formData.absentDaySummon = data.absentDaySummon ?? "-";
|
formData.studyDayTrainingSubject = data.studyDayTrainingSubject ?? "-" ?? "-"
|
||||||
formData.absentDayLocation = data.absentDayLocation ?? "-";
|
formData.studyDayTrainingName = data.studyDayTrainingName ?? "-"
|
||||||
formData.absentDayRegistorDate =
|
formData.studyDayCountry = data.studyDayCountry ?? "-"
|
||||||
data.absentDayRegistorDate && date2Thai(data.absentDayRegistorDate);
|
formData.studyDayScholarship = data.studyDayScholarship ?? "-"
|
||||||
formData.absentDayGetIn = data.absentDayGetIn ?? "-";
|
formData.coupleDayName = data.coupleDayName ?? "-"
|
||||||
formData.absentDayAt = data.absentDayAt ?? "-";
|
formData.coupleDayPosition = data.coupleDayPosition ?? "-"
|
||||||
formData.studyDaySubject = data.studyDaySubject ?? "-";
|
formData.coupleDayLevel = data.coupleDayLevel ?? "-"
|
||||||
formData.studyDayDegreeLevel = data.studyDayDegreeLevel ?? "-";
|
formData.coupleDayLevelCountry = data.coupleDayLevelCountry ?? "-"
|
||||||
formData.studyDayUniversityName = data.studyDayUniversityName ?? "-";
|
formData.coupleDayCountryHistory = data.coupleDayCountryHistory ?? "-"
|
||||||
formData.studyDayTrainingSubject =
|
formData.coupleDayTotalHistory = data.coupleDayTotalHistory ?? "-"
|
||||||
data.studyDayTrainingSubject ?? "-" ?? "-";
|
formData.coupleDayStartDateHistory = data.coupleDayStartDateHistory
|
||||||
formData.studyDayTrainingName = data.studyDayTrainingName ?? "-";
|
formData.coupleDayEndDateHistory = data.coupleDayEndDateHistory
|
||||||
formData.studyDayCountry = data.studyDayCountry ?? "-";
|
formData.coupleDaySumTotalHistory = data.coupleDaySumTotalHistory ?? "-"
|
||||||
formData.studyDayScholarship = data.studyDayScholarship ?? "-";
|
formData.approveStep = data.approveStep ?? "-"
|
||||||
formData.coupleDayName = data.coupleDayName ?? "-";
|
formData.dear = data.dear ?? "-"
|
||||||
formData.coupleDayPosition = data.coupleDayPosition ?? "-";
|
formData.leaveLast = data.leaveLast ?? "-"
|
||||||
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)
|
// 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() {
|
||||||
|
console.log(personalId.value)
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
async () => {
|
async () => {
|
||||||
// showLoader();
|
showLoader()
|
||||||
// await http
|
await http
|
||||||
// .post(config.API.leaveUser() + "/" + id)
|
.get(config.API.leaveUserSendId(personalId.value))
|
||||||
// .then(() => {
|
.then(() => {
|
||||||
router.push("/leave");
|
// router.push("/leave")
|
||||||
success($q, "ยื่นใบลาสำเร็จ");
|
success($q, "ยื่นใบลาสำเร็จ")
|
||||||
// })
|
})
|
||||||
// .catch((e: any) => {
|
.catch((e: any) => {
|
||||||
// messageError($q, e);
|
messageError($q, e)
|
||||||
// })
|
})
|
||||||
// .finally(() => {
|
.finally(() => {
|
||||||
// hideLoader();
|
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"
|
|
||||||
icon="mdi-arrow-left"
|
|
||||||
unelevated
|
|
||||||
round
|
|
||||||
dense
|
|
||||||
flat
|
|
||||||
color="primary"
|
|
||||||
class="q-mr-sm"
|
|
||||||
/>
|
|
||||||
<div>
|
<div>
|
||||||
แก้ไขใบลา
|
แก้ไขใบลา
|
||||||
<!-- {{ formData.leaveTypeName }} {{ leaveId }} -->
|
{{ formData.leaveTypeName }} {{ personalId }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<q-form ref="myform" class="col-12">
|
<q-form ref="myform" class="col-12">
|
||||||
|
|
@ -298,14 +267,8 @@ onMounted(() => {
|
||||||
<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"
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
<div class="q-pl-sm text-weight-bold text-dark">
|
|
||||||
เลือกประเภทการลา
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="q-py-sm q-px-lg">
|
<div class="q-py-sm q-px-lg">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -323,28 +286,19 @@ onMounted(() => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</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"
|
|
||||||
v-if="model === 'LV-006' || model === 'LV-008'"
|
|
||||||
>
|
|
||||||
<q-select
|
<q-select
|
||||||
readonly
|
readonly
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="modelSpecific"
|
v-model="modelSpecific"
|
||||||
:options="
|
:options="model === 'LV-006' ? dataStore.optionsOrdination : dataStore.optionsSpecific"
|
||||||
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="
|
@update:model-value="dataStore.typeConvert(model, modelSpecific)"
|
||||||
dataStore.typeConvert(model, modelSpecific)
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -352,101 +306,25 @@ onMounted(() => {
|
||||||
|
|
||||||
<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"
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
<div class="q-pl-sm text-weight-bold text-dark">
|
|
||||||
ข้อมูลการลา
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<FormPart2 :model="model" :data="formData" :leaveTypeId="formData.leaveTypeId" />
|
||||||
<FormPart2
|
|
||||||
:model="model"
|
|
||||||
:data="formData"
|
|
||||||
:leaveTypeId="formData.leaveTypeId"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<SickForm
|
<SickForm v-if="model === 'LV-001' || model === 'LV-002'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
v-if="model === 'LV-001' || model === 'LV-002'"
|
<FormBirth v-if="model === 'LV-003'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
:data="formData"
|
<HelpWifeBirthForm v-if="model === 'LV-004'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
:on-submit="onSubmit"
|
<VacationForm v-if="model === 'LV-005'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
: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" />
|
||||||
<FormBirth
|
<MilitaryForm v-if="model === 'LV-007'" style="width: 100%" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
v-if="model === 'LV-003'"
|
<StudyForm v-if="model === 'LV-008' && modelSpecific === 's1'" style="width: 100%" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
:data="formData"
|
<TrainForm v-if="model === 'LV-008' && modelSpecific != 's1' && modelSpecific != ''" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
:on-submit="onSubmit"
|
<WorkInternationalForm v-if="model === 'LV-009'" :data="formData" :on-submit="onSubmit" :on-confirm="onConfirm" />
|
||||||
: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" />
|
||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue