Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2023-12-20 17:04:52 +07:00
commit 5e63b4c675
10 changed files with 352 additions and 36 deletions

View file

@ -145,16 +145,16 @@ async function fetchListTimeRecord() {
checkInDate: e.checkInDate ? date2Thai(e.checkInDate) : "-",
checkInTime: e.checkInTime,
checkInLocation: e.checkInLocation,
checkInLat: e.checkInLat,
checkInLon: e.checkInLon,
checkInLat: e.checkInLat ? e.checkInLat : "",
checkInLon: e.checkInLon ? e.checkInLon : "",
checkInStatus: e.checkInStatus
? workStore.convertSatatus(e.checkInStatus)
: "-",
checkOutDate: e.checkOutDate ? date2Thai(e.checkOutDate) : "-",
checkOutLocation: e.checkOutLocation ? e.checkOutLocation : "-",
checkOutTime: e.checkOutTime ? e.checkOutTime : "-",
checkOutLat: e.checkOutLocation ? e.checkOutLat : "",
checkOutLon: e.checkOutLocation ? e.checkOutLon : "",
checkOutLat: e.checkOutLat ? e.checkOutLat : "",
checkOutLon: e.checkOutLat ? e.checkOutLon : "",
checkOutStatus: e.checkOutStatus
? workStore.convertSatatus(e.checkOutStatus)
: "-",

View file

@ -48,6 +48,8 @@ const route = useRoute();
const paramsId = route.params.id.toString();
const modalApprove = ref(false);
const typeDocx = ref<string>("docx");
const typePdf = ref<string>("pdf");
const dialogTitleUnapprove = ref<string>("ไม่อนุมัติ");
const dialogTitle = ref<string>("อนุมัติ");
const dialogLabel = ref<string>("เหตุผล");
@ -462,14 +464,15 @@ function clickSave(reason: string) {
}
}
async function onClickDownloadFile(id: string, fileName: string) {
async function onClickDownloadFile(id: string, fileName: string, type: string) {
showLoader();
await http
.get(config.API.leaveReport(id))
.then(async (res) => {
console.log(res);
const data = res.data.result;
await genReport(data, fileName);
await genReport(data, fileName, type);
console.log(type);
})
.catch((err) => {
messageError($q, err);
@ -496,7 +499,7 @@ async function onClickDownloadFile(id: string, fileName: string) {
รายละเอยดการลาของ {{ formData.fullName }}
</div>
<div>
<q-btn
<!-- <q-btn
icon="mdi-download"
unelevated
round
@ -506,7 +509,44 @@ async function onClickDownloadFile(id: string, fileName: string) {
class="q-mr-sm"
@click="onClickDownloadFile(formData.id, formData.leaveTypeName)"
><q-tooltip>ดาวนโหลดไฟล</q-tooltip></q-btn
>
> -->
<q-btn class="q-mr-sm" icon="mdi-download" round color="primary" flat>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
<q-menu>
<q-list style="min-width: 100px">
<q-item
clickable
v-close-popup
@click="
onClickDownloadFile(
formData.id,
formData.leaveTypeName,
typeDocx
)
"
>
<q-item-section class="text-blue"
>ดาวนโหลดไฟล .docx</q-item-section
>
</q-item>
<q-item
clickable
v-close-popup
@click="
onClickDownloadFile(
formData.id,
formData.leaveTypeName,
typePdf
)
"
>
<q-item-section class="text-red"
>ดาวนโหลดไฟล .pdf</q-item-section
>
</q-item>
</q-list>
</q-menu>
</q-btn>
</div>
<q-space />
<!-- <q-file

View file

@ -47,6 +47,8 @@ const router = useRouter();
const route = useRoute();
const paramsId = route.params.id.toString();
const typeDocx = ref<string>("docx");
const typePdf = ref<string>("pdf");
const modalApprove = ref(false);
const dialogTitleUnapprove = ref<string>("ไม่อนุมัติ");
const dialogTitle = ref<string>("อนุมัติ");
@ -405,14 +407,14 @@ function clickSave(reason: string) {
}
}
async function onClickDownloadFile(id: string, fileName: string) {
async function onClickDownloadFile(id: string, fileName: string, type: string) {
showLoader();
await http
.get(config.API.leaveReportReject(id))
.then(async (res) => {
console.log(res);
const data = res.data.result;
await genReport(data, fileName);
await genReport(data, fileName, type);
})
.catch((err) => {
messageError($q, err);
@ -439,7 +441,7 @@ async function onClickDownloadFile(id: string, fileName: string) {
รายละเอยดการขอยกเลกของ {{ formData.fullName }}
</div>
<div>
<q-btn
<!-- <q-btn
icon="mdi-download"
unelevated
round
@ -449,7 +451,44 @@ async function onClickDownloadFile(id: string, fileName: string) {
class="q-mr-sm"
@click="onClickDownloadFile(formData.id, formData.leaveTypeName)"
><q-tooltip>ดาวนโหลดไฟล</q-tooltip></q-btn
>
> -->
<q-btn class="q-mr-sm" icon="mdi-download" round color="primary" flat>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
<q-menu>
<q-list style="min-width: 100px">
<q-item
clickable
v-close-popup
@click="
onClickDownloadFile(
formData.id,
formData.leaveTypeName,
typeDocx
)
"
>
<q-item-section class="text-blue"
>ดาวนโหลดไฟล .docx</q-item-section
>
</q-item>
<q-item
clickable
v-close-popup
@click="
onClickDownloadFile(
formData.id,
formData.leaveTypeName,
typePdf
)
"
>
<q-item-section class="text-red"
>ดาวนโหลดไฟล .pdf</q-item-section
>
</q-item>
</q-list>
</q-menu>
</q-btn>
</div>
<q-space />
<!-- <q-file

View file

@ -68,6 +68,13 @@ const formData = reactive<FormData>({
isActive: false,
});
/**FunctionCheckbox แก้ไขสถานะ */
function checkDefault() {
if (formData.isDefault === true) {
formData.isActive = true;
}
}
/** Function validateForm*/
function validateForm() {
const hasError = [];
@ -356,7 +363,11 @@ watch(
<div class="row items-center q-my-sm justify-between">
<p class="q-ma-none">เวลา Default</p>
<label class="toggle-control">
<input type="checkbox" v-model="formData.isDefault" />
<input
type="checkbox"
v-model="formData.isDefault"
@change="checkDefault()"
/>
<span class="control"></span>
</label>
</div>

View file

@ -43,8 +43,8 @@ const formData = reactive<dataRowRound>({
checkIn: "",
checkOut: "",
note: "",
checkInStatus: "",
checkOutStatus: "",
checkInStatus: "NORMAL",
checkOutStatus: "NORMAL",
checkInEdit: false,
checkOutEdit: false,
});
@ -95,8 +95,8 @@ async function approveData() {
const body = {
checkInTime: formData.checkIn,
checkOutTime: formData.checkOut,
checkInStatus: SpecialTimeStore.checkInStatus,
checkOutStatus: SpecialTimeStore.checkOutStatus,
checkInStatus: formData.checkInStatus,
checkOutStatus: formData.checkOutStatus,
reason: formData.note,
};
await http
@ -123,14 +123,29 @@ function close() {
watch(
() => props.modal,
() => {
console.log("props===>", props);
if (props.editCheck === "APPROVE") {
formData.checkIn = "";
formData.checkOut = "";
formData.note = "";
} else if (props.editCheck === "PENDING") {
if (props.detailData) {
formData.checkIn = props.detailData.checkIn;
formData.checkOut = props.detailData.checkOut;
if (props.detailData.checkInEdit) {
formData.checkIn = props.detailData.startTimeMorning;
formData.checkOut = props.detailData.endTimeAfternoon;
} else if (
props.detailData.checkInEdit &&
!props.detailData.checkOutEdit
) {
formData.checkIn = props.detailData.startTimeMorning;
formData.checkOut = props.detailData.endTimeMorning;
} else if (
!props.detailData.checkInEdit &&
props.detailData.checkOutEdit
) {
formData.checkIn = props.detailData.startAfternoon;
formData.checkOut = props.detailData.endTimeAfternoon;
}
formData.note = props.detailData.note;
formData.checkInEdit = props.detailData.checkInEdit;
formData.checkOutEdit = props.detailData.checkOutEdit;
@ -142,7 +157,7 @@ watch(
<template>
<q-dialog v-model="props.modal" persistent>
<q-card style="min-width: 350px" class="bg-grey-11">
<q-card style="width: 350px" class="bg-grey-11">
<form @submit.prevent="validateForm">
<DialogHeader
:tittle="
@ -159,7 +174,7 @@ watch(
<div class="col q-ma-md q-pa-sm bg-white border-custom">
<q-card bordered class="border-primary text-center">
<q-card-section class="bg-primary q-pa-sm">
<div class="text-white text-bold">เวลาทกรอก</div>
<div class="text-white text-bold">นทนเรอง</div>
</q-card-section>
<q-card-section class="q-pa-sm bg-white text-black">
@ -216,6 +231,7 @@ watch(
</div>
</div>
<div
v-if="formData.checkInEdit"
class="col q-ma-md q-pa-sm bg-white border-custom text-weight-medium"
>
<p style="color: #06884d; font-size: 16px">สถานะชวงเช</p>
@ -230,7 +246,7 @@ watch(
outlined
full-width
dense
v-model="SpecialTimeStore.checkInStatus"
v-model="formData.checkInStatus"
:options="SpecialTimeStore.optionStatus"
option-value="id"
option-label="name"
@ -242,6 +258,7 @@ watch(
</div>
<div
v-if="formData.checkOutEdit"
class="col q-ma-md q-pa-sm bg-white border-custom text-weight-medium"
>
<p style="color: #06884d; font-size: 16px">สถานะชวงบาย</p>
@ -259,7 +276,7 @@ watch(
:rules="[(val) => !!val || 'กรุณาเลือกสถานะช่วงบ่าย']"
hide-bottom-space
full-width
v-model="SpecialTimeStore.checkOutStatus"
v-model="formData.checkOutStatus"
:options="SpecialTimeStore.optionStatus"
option-value="id"
option-label="name"

View file

@ -73,8 +73,8 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => {
rows.value.push({
id: e.id,
fullname: e.fullName,
date: date2Thai(new Date(e.checkDate), false, true),
dateFix: date2Thai(new Date(e.createdAt)),
date: date2Thai(new Date(e.createdAt), false, true),
dateFix: date2Thai(new Date(e.checkDate)),
timeMorning:
e.startTimeMorning == null
? "-"
@ -151,9 +151,10 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => {
}
};
const optionStatus = ref<DataOption[]>([
{ id: "0", name: "ปกติ" },
{ id: "1", name: "สาย" },
{ id: "2", name: "ขาดราชการ" },
{ id: "NORMAL", name: "ปกติ" },
{ id: "LATE", name: "สาย" },
{ id: "ABSENT", name: "ขาดราชการ" },
{ id: "NOT_COMPLETE", name: "ปฏิบัติงานไม่ครบตามกำหนดเวลา" },
]);
// const filterSelector = (val: any, update: Function, refData: string) => {
@ -203,7 +204,7 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => {
{
name: "date",
align: "left",
label: "วันที่กรอก",
label: "วันที่ยื่นเรื่อง",
sortable: true,
field: "date",
headerStyle: "font-size: 14px",

View file

@ -21,6 +21,8 @@ const dataStore = useChangeRoundDataStore();
const $q = useQuasar();
const modal = ref<boolean>(false);
const dateWork = ref<any>();
const modalFix = ref<boolean>(false);
const editCheck = ref<string>("");
const DataRow = ref<any>();
const formData = reactive<dataPost>({
@ -45,9 +47,14 @@ function Openmodal(check: string, detail: any) {
}
}
function OpenmodalFix(detail: any) {
modalFix.value = true;
}
/** Function closePopup */
function closeDialog() {
modal.value = false;
modalFix.value = false;
}
/** Function ค้นหาข้อมูล */
@ -180,6 +187,15 @@ function searchData() {
<q-item-label>ประวการเปลยนรอบ</q-item-label>
</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
@click="OpenmodalFix(props.row)"
>
<q-item-section>
<q-item-label>แกไขปฏนวนทำงาน</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
@ -198,6 +214,52 @@ function searchData() {
:personId="DataRow == null ? '' : DataRow.profileId"
@update:change-page="dataStore.changePage"
/>
<q-dialog v-model="modalFix" persistent>
<q-card style="min-width: 800px"
><q-toolbar>
<q-toolbar-title class="text-subtitle1 text-bold">
{{ "แก้ไขปฏิทินวันทำงาน" }}
</q-toolbar-title>
<q-btn
icon="close"
unelevated
round
dense
@click="closeDialog"
style="color: #ff8080; background-color: #ffdede"
/>
</q-toolbar>
<q-separator color="grey-4" />
<q-form @submit="closeDialog" class="q-gutter-md">
<div class="q-pa-md">
<q-radio
name="dateWork"
v-model="dateWork"
val="line"
label="ทำงาน 5 วัน"
/>
<q-radio
name="dateWork"
v-model="dateWork"
val="rectangle"
label="ทำงาน 6 วัน"
/>
</div>
<q-separator color="grey-4" />
<div class="q-pa-xs">
<div class="row justify-end q-mr-sm q-py-sm">
<q-btn
id="onSubmit"
type="submit"
unelevated
label="บันทึก"
class="q-px-md items-center"
color="secondary"
/>
</div>
</div>
</q-form> </q-card
></q-dialog>
</template>
<style scoped lang="scss">
.q-table tbody td:before.no-background {

View file

@ -358,6 +358,7 @@ const monthYearThai = (val: any) => {
</d-table>
</div>
</q-card>
<DialogReason
:modal="modalUnapprove"
:title="dialogTitle"
@ -366,6 +367,7 @@ const monthYearThai = (val: any) => {
label="เหตุผล"
:savaForm="clickSave"
/>
<DialogApprove
:modal="modalApprove"
:closeDialog="closeDialog"