เพิ่มเงื่อนไขกรอกให้ครบก่อนส่ง

This commit is contained in:
AnandaTon 2023-09-05 21:09:28 +07:00
parent 2143c05a42
commit 0bbf5cde0b
3 changed files with 778 additions and 1099 deletions

View file

@ -6,13 +6,30 @@
<div v-if="routeName == 'addTransfer'">เพิ่มเรื่องขอโอน</div> <div v-if="routeName == 'addTransfer'">เพิ่มเรื่องขอโอน</div>
<div v-else>รายละเอียดเรื่องขอโอน</div> <div v-else>รายละเอียดเรื่องขอโอน</div>
</div> </div>
<div 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 class="col-12 row q-pa-sm q-col-gutter-sm"> <div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-input class="col-12" dense outlined v-model="tranferOrg" label="หน่วยงานที่ขอโอนไป" :readonly="routeName != 'addTransfer'" /> <q-input
<q-input class="col-12" dense outlined v-model="noteReason" label="เหตุผล" type="textarea" :readonly="routeName != 'addTransfer'" /> class="col-12"
dense
outlined
v-model="tranferOrg"
label="หน่วยงานที่ขอโอนไป"
:readonly="routeName != 'addTransfer'"
:rules="[(val:string) => !!val || `${'กรุณากรอกหน่วยงานที่ขอโอนไป'}`]"
/>
<q-input
class="col-12"
dense
outlined
v-model="noteReason"
label="เหตุผล"
type="textarea"
:readonly="routeName != 'addTransfer'"
:rules="[(val:string) => !!val || `${'กรุณากรอกเหตุผล'}`]"
/>
<div class="col-12 row"> <div class="col-12 row">
<q-uploader <q-uploader
bordered bordered
@ -25,261 +42,16 @@
@added="fileUploadDoc" @added="fileUploadDoc"
/> />
</div> </div>
<!-- <q-file
class="col-xs-12 col-sm-12"
outlined
dense
multiple
v-model="file"
label="เอกสารเพิ่มเติม"
hide-bottom-space
accept=".jpg,.png,.pdf,.csv,.doc"
lazy-rules
:rules="[val => val || 'กรุณาเลือกไฟล์เอกสารเพิ่มเติม']"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file> -->
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-8 row">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row items-center q-py-sm q-px-md justify-center text-bold">อมลการดารงตาแหน</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-input class="col-12" dense outlined v-model="typeServant" label="ประเภทข้าราชการ(สามัญ/ครู)" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="position" label="ตําแหน่ง" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="level" label="ระดับ" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="positionNum" label="ตําแหน่งเลขที่" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="groupOrga" label="ฝ่าย/กลุ่มงานที่สังกัด" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="affiliation" label="ส่วนที่สังกัด (ถ้ามี)" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="affiliationPart" label="ส่วนราชการที่สังกัด" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="OrganizationPart" label="หน่วยงานที่สังกัด" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="servantAge" label="อายุราชการ" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="salary" label="อัตราเงินเดือน" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="extraSalary" label="เงินเพิ่มพิเศษ" :readonly="routeName != 'addTransfer'" />
<q-input
class="col-12"
dense
outlined
v-model="positionHistory"
label="ประวัติการดํารงตําแหน่ง (ดึงข้อมูลจากระบบทะเบียนประวัติในส่วนของการแต่งตั้งย้ายเลื่อน)"
:readonly="routeName != 'addTransfer'"
/>
<q-input class="col-12" dense outlined v-model="transfer" label=" ประวัติเกี่ยวกับวินัย" type="textarea" :readonly="routeName != 'addTransfer'" />
</div>
<div class="col-xs-12 col-sm-8 row">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row items-center q-py-sm q-px-md justify-center text-bold">าแหน ระด เลขทาแหน และสงกดทขอโอน</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-input class="col-xs-12 col-sm-6" dense outlined v-model="positionNew" label="ตำแหน่ง" :readonly="routeName != 'addTransfer'" />
<q-input class="col-xs-12 col-sm-6" dense outlined v-model="salaryNew" label="ระดับ" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="transfer" label="เลขที่ตําแหน่ง" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12 col-sm-6" dense outlined v-model="note" label="สังกัดที่ขอโอน" :readonly="routeName != 'addTransfer'" />
<q-input class="col-12" dense outlined v-model="note" label="เหตุผลที่ขอโอน" type="textarea" :readonly="routeName != 'addTransfer'" />
</div>
</q-card>
</div>
</q-card>
</div>
<div class="col-xs-12 col-sm-4 row">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row items-center q-py-sm q-px-md justify-center text-bold">เอกสารหลกฐานทแนบ</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-file
class="col-xs-12 col-sm-12"
outlined
dense
v-model="fileEdu"
label="สําเนาหลักฐานการศึกษา (ปริญญาบัตรประกาศนียบัตร)"
hide-bottom-space
lazy-rules
:rules="[val => val || 'กรุณาเลือกไฟล์สําเนาหลักฐานการศึกษา (ปริญญาบัตรประกาศนียบัตร)']"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-file
class="col-xs-12 col-sm-12"
outlined
dense
v-model="fileKorkor1"
label="สําเนาประวัติราชการ (ก.ก.1)"
hide-bottom-space
lazy-rules
:rules="[val => val || 'กรุณาเลือกไฟล์สําเนาประวัติราชการ (ก.ก.1)']"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-file class="col-xs-12 col-sm-12" outlined dense v-model="fileEtc" label="สําเนาเอกสารหลักฐานอื่นๆ" hide-bottom-space lazy-rules>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</div>
</q-card>
<div class="col-xs-12 col-sm-12 row">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row items-center q-py-sm q-px-md justify-center text-bold">ความเห</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-input
class="col-12 col-sm-12"
dense
outlined
v-model="note"
label="ความเห็นผู้บังคับบัญชาชั้นต้น (หัวหน้าฝ่าย/กลุ่มงาน)"
type="textarea"
:readonly="routeName != 'addTransfer'"
/>
<q-input
class="col-12 col-sm-12"
dense
outlined
v-model="note"
label="ความเห็นผู้บังคับบัญชาเหนือขึ้นไป (ผู้อํานวยการส่วน) (ถ้ามี)"
type="textarea"
:readonly="routeName != 'addTransfer'"
/>
<q-input
class="col-12 col-sm-12"
dense
outlined
v-model="note"
label="ความเห็นหัวหน้าส่วนราชการผู้ขอโอน (ผอ. กอง)"
type="textarea"
:readonly="routeName != 'addTransfer'"
/>
</div>
</q-card>
</div>
</div>
</div>
<q-separator />
<div class="col-xs-12 col-sm-12 row">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row items-center q-py-sm q-px-md justify-center text-bold">เอกสารหลกฐาน</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-file
class="col-xs-12 col-sm-12"
outlined
dense
v-model="fileEdu"
label="หนังสือถึงหน่วยงานที่รับโอน"
hide-bottom-space
lazy-rules
:rules="[val => val || 'กรุณาเลือกไฟล์หนังสือถึงหน่วยงานที่รับโอน']"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-file
class="col-xs-12 col-sm-12"
outlined
dense
v-model="fileKorkor1"
label="หนังสือถึงสกจ. เพื่อตรวจสอบพฤติการณ์ทางวินัยและภาระหนี้สิน (เงินกู้สวัสดิการข้าราชการ) ของข้าราชการ"
hide-bottom-space
lazy-rules
:rules="[val => val || 'กรุณาเลือกไฟล์หนังสือถึงสกจ. เพื่อตรวจสอบพฤติการณ์ทางวินัยและภาระหนี้สิน (เงินกู้สวัสดิการข้าราชการ) ของข้าราชการ']"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-file
class="col-xs-12 col-sm-12"
outlined
dense
v-model="fileEtc"
label="หนังสือถึงสพท. เพื่อตรวจสอบภาระผูกพันกับกรุงเทพมหานครเกี่ยวกับการลาศึกษาอบรมของข้าราชการ"
hide-bottom-space
lazy-rules
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-file
class="col-xs-12 col-sm-12"
outlined
dense
v-model="fileEtc"
label="หนังสือถึงผู้จัดการสหกรณ์ออมทรัพย์กทม. เพื่อตรวจสอบหนี้สินและภาระผูกพันของข้าราชการ"
hide-bottom-space
lazy-rules
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-file
class="col-xs-12 col-sm-12"
outlined
dense
v-model="fileEtc"
label="หนังสือสําคัญการโอนอัตราและจ่ายเงินเดือนสําหรับรับรองการจ่ายเงินเดือนครั้งสุดท้ายและโอนอัตราเงินเดือนตามตัวไปตั้งจ่าย"
hide-bottom-space
lazy-rules
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-file
class="col-xs-12 col-sm-12"
outlined
dense
v-model="fileEtc"
label="แบบประเมินประสิทธิภาพและประสิทธิผลการปฏิบัติงานของข้าราชการพลเรือนสามัญ"
hide-bottom-space
lazy-rules
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-file class="col-xs-12 col-sm-12" outlined dense v-model="fileEtc" label="หนังสือรับรองวันลา" hide-bottom-space lazy-rules>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-file class="col-xs-12 col-sm-12" outlined dense v-model="fileEtc" label="หนังสือขอโอนจากกทม. ถึงหน่วยงานที่ประสงค์จะโอน" hide-bottom-space lazy-rules>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-file class="col-xs-12 col-sm-12" outlined dense v-model="fileEtc" label="หนังสือตอบรับการโอนจากหน่วยงานที่ประสงค์จะโอน" hide-bottom-space lazy-rules>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-file class="col-xs-12 col-sm-12" outlined dense v-model="fileEtc" label="คําสั่งรับโอนจากหน่วยงานที่ประสงค์จะโอน" hide-bottom-space lazy-rules>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</div>
</q-card>
</div>-->
<q-separator v-if="routeName == 'addTransfer'" /> <q-separator v-if="routeName == 'addTransfer'" />
<div class="row col-12 q-pa-md" v-if="routeName == 'addTransfer'"> <div class="row col-12 q-pa-md" v-if="routeName == 'addTransfer'">
<q-space /> <q-space />
<q-btn unelevated dense class="q-px-md items-center" color="primary" label="ยื่นเรื่องขอโอน" @click="saveTransfer" /> <q-btn unelevated dense class="q-px-md items-center" color="primary" label="ยื่นเรื่องขอโอน" @click="saveData" />
</div> </div>
</q-card> </q-card>
</div> </q-form>
</div> </div>
</div> </div>
</template> </template>
@ -291,11 +63,13 @@ import { useRouter, useRoute } from "vue-router"
import { useCounterMixin } from "@/stores/mixin" import { useCounterMixin } from "@/stores/mixin"
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"
const router = useRouter() const router = useRouter()
const $q = useQuasar() const $q = useQuasar()
const mixin = useCounterMixin() const mixin = useCounterMixin()
const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader } = mixin const myform = ref<QForm | null>(null)
const { date2Thai, fails, success, messageError, showLoader, hideLoader } = mixin
const fileDocDataUpload = ref<File[]>([]) const fileDocDataUpload = ref<File[]>([])
const route = useRoute() const route = useRoute()
const files = ref<any>() const files = ref<any>()
@ -313,6 +87,17 @@ onMounted(() => {
} }
}) })
const saveData = async () => {
console.log(myform.value)
if (myform.value != null) {
await myform.value.validate().then(async (saveDataTest: Boolean) => {
if (saveDataTest) {
saveTransfer()
}
})
}
}
const saveTransfer = () => { const saveTransfer = () => {
$q.dialog({ $q.dialog({
title: "ยืนยันการยื่นข้อมูลการโอน", title: "ยืนยันการยื่นข้อมูลการโอน",
@ -327,7 +112,9 @@ const saveTransfer = () => {
createTransfer() createTransfer()
}) })
.onCancel(() => {}) .onCancel(() => {})
.onDismiss(() => {}) .onDismiss(() => {
fails($q, "กรุณากรอกอัพโหลดเอกสารเพิ่มเติม")
})
} }
const createTransfer = async () => { const createTransfer = async () => {

View file

@ -6,12 +6,20 @@
<div v-if="routeName == 'AddLeave'">เพิ่มเรื่องลาออก</div> <div v-if="routeName == 'AddLeave'">เพิ่มเรื่องลาออก</div>
<div v-else>รายละเอียดเรื่องลาออก</div> <div v-else>รายละเอียดเรื่องลาออก</div>
</div> </div>
<div 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 class="col-12 row q-pa-sm q-col-gutter-sm"> <div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-input class="col-8" dense outlined v-model="tranferOrg" label="สถานที่ยื่นขอลาออกจากราชการ" :readonly="routeName != 'AddLeave'" /> <q-input
class="col-8"
dense
outlined
v-model="tranferOrg"
label="สถานที่ยื่นขอลาออกจากราชการ"
:readonly="routeName != 'AddLeave'"
:rules="[(val:string) => !!val || `${'กรุณากรอกสถานที่ยื่นขอลาออกจากราชการ'}`]"
/>
<datepicker class="col-2" menu-class-name="modalfix" v-model="dateCommand" :locale="'th'" autoApply readonly borderless :enableTimePicker="false" week-start="0"> <datepicker class="col-2" menu-class-name="modalfix" v-model="dateCommand" :locale="'th'" autoApply readonly borderless :enableTimePicker="false" week-start="0">
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
@ -70,7 +78,16 @@
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>
<q-input class="col-12" dense outlined v-model="noteReason" label="เหตุผลที่ลาออกจากราชการ" type="textarea" :readonly="routeName != 'AddLeave'" /> <q-input
class="col-12"
dense
outlined
v-model="noteReason"
label="เหตุผลที่ลาออกจากราชการ"
type="textarea"
:readonly="routeName != 'AddLeave'"
:rules="[val => !!val || `${'กรุณากรอกเหตุผลที่ลาออกจากราชการ'}`]"
/>
<div class="col-12 row"> <div class="col-12 row">
<q-uploader <q-uploader
@ -89,9 +106,7 @@
</div> </div>
<q-card bordered class="row col-12 text-dark q-mt-sm"> <q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary"> <div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark"> <div class="q-pl-sm text-weight-bold text-dark">ผลการพจารณาของผงคบบญชา</div>
ผลการพจารณาของผงคบบญชา
</div>
</div> </div>
<q-separator /> <q-separator />
<div class="row col-12 q-pa-md"> <div class="row col-12 q-pa-md">
@ -99,44 +114,22 @@
<div class="col-xs-6 row items-start"> <div class="col-xs-6 row items-start">
<div class="col-12 text-top">สถานะ</div> <div class="col-12 text-top">สถานะ</div>
<div class="col-12 text-detail"> <div class="col-12 text-detail">
{{ {{ dataDetail.commanderReject !== null ? statusOrder(dataDetail.commanderReject) : "-" }}
dataDetail.commanderReject !== null
? statusOrder(dataDetail.commanderReject)
: "-"
}}
</div> </div>
</div> </div>
<div class="col-xs-6 row items-start"> <div class="col-xs-6 row items-start">
<div class="col-12 text-top">นสดทายทบย</div> <div class="col-12 text-top">นสดทายทบย</div>
<div class="col-12 text-detail"> <div class="col-12 text-detail">
{{ {{ dataDetail.commanderRejectDate !== null ? date2Thai(dataDetail.commanderRejectDate) : "-" }}
dataDetail.commanderRejectDate !== null
? date2Thai(dataDetail.commanderRejectDate)
: "-"
}}
</div> </div>
</div> </div>
<div class="col-xs-12 row items-start"> <div class="col-xs-12 row items-start">
<div class="col-12 text-top">ความคดเหนและเหตผล</div> <div class="col-12 text-top">ความคดเหนและเหตผล</div>
<div <div class="col-12 text-detail" v-if="dataDetail.commanderReject === false">
class="col-12 text-detail" {{ dataDetail.commanderApproveReason !== null ? dataDetail.commanderApproveReason : "-" }}
v-if="dataDetail.commanderReject === false"
>
{{
dataDetail.commanderApproveReason !== null
? dataDetail.commanderApproveReason
: "-"
}}
</div> </div>
<div <div class="col-12 text-detail" v-if="dataDetail.commanderReject === true">
class="col-12 text-detail" {{ dataDetail.commanderRejectReason !== null ? dataDetail.commanderRejectReason : "-" }}
v-if="dataDetail.commanderReject === true"
>
{{
dataDetail.commanderRejectReason !== null
? dataDetail.commanderRejectReason
: "-"
}}
</div> </div>
</div> </div>
</div> </div>
@ -145,9 +138,7 @@
<q-card bordered class="row col-12 text-dark q-mt-sm"> <q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary"> <div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark"> <div class="q-pl-sm text-weight-bold text-dark">ผลการพจารณาของผอำนาจ</div>
ผลการพจารณาของผอำนาจ
</div>
</div> </div>
<q-separator /> <q-separator />
<div class="row col-12 q-pa-md"> <div class="row col-12 q-pa-md">
@ -155,44 +146,22 @@
<div class="col-xs-6 row items-start"> <div class="col-xs-6 row items-start">
<div class="col-12 text-top">สถานะ</div> <div class="col-12 text-top">สถานะ</div>
<div class="col-12 text-detail"> <div class="col-12 text-detail">
{{ {{ dataDetail.oligarchReject !== null ? statusOrder(dataDetail.oligarchReject) : "-" }}
dataDetail.oligarchReject !== null
? statusOrder(dataDetail.oligarchReject)
: "-"
}}
</div> </div>
</div> </div>
<div class="col-xs-6 row items-start"> <div class="col-xs-6 row items-start">
<div class="col-12 text-top">นสดทายทบย</div> <div class="col-12 text-top">นสดทายทบย</div>
<div class="col-12 text-detail"> <div class="col-12 text-detail">
{{ {{ dataDetail.oligarchRejectDate !== null ? date2Thai(dataDetail.oligarchRejectDate) : "-" }}
dataDetail.oligarchRejectDate !== null
? date2Thai(dataDetail.oligarchRejectDate)
: "-"
}}
</div> </div>
</div> </div>
<div class="col-xs-12 row items-start"> <div class="col-xs-12 row items-start">
<div class="col-12 text-top">ความคดเหนและเหตผล</div> <div class="col-12 text-top">ความคดเหนและเหตผล</div>
<div <div class="col-12 text-detail" v-if="dataDetail.oligarchReject == false">
class="col-12 text-detail" {{ dataDetail.oligarchApproveReason !== null ? dataDetail.oligarchApproveReason : "-" }}
v-if="dataDetail.oligarchReject == false"
>
{{
dataDetail.oligarchApproveReason !== null
? dataDetail.oligarchApproveReason
: "-"
}}
</div> </div>
<div <div class="col-12 text-detail" v-else-if="dataDetail.oligarchReject == true">
class="col-12 text-detail" {{ dataDetail.oligarchRejectReason !== null ? dataDetail.oligarchRejectReason : "-" }}
v-else-if="dataDetail.oligarchReject == true"
>
{{
dataDetail.oligarchRejectReason !== null
? dataDetail.oligarchRejectReason
: "-"
}}
</div> </div>
</div> </div>
</div> </div>
@ -200,16 +169,16 @@
</q-card> </q-card>
<div class="row col-12 q-pa-md" v-if="routeName != 'AddLeave'"> <div class="row col-12 q-pa-md" v-if="routeName != 'AddLeave'">
<q-space /> <q-space />
<q-btn unelevated dense class="q-px-md items-center" color="orange" label="ยกเลิกการลาออก" @click="cancelResing(id.value)" :disable="tranferOrg == '' && noteReason == ''" /> <q-btn unelevated dense class="q-px-md items-center" color="orange" label="ยกเลิกการลาออก" @click="cancelResing" :disable="tranferOrg == '' && noteReason == ''" />
</div> </div>
</div> </div>
<q-separator v-if="routeName == 'AddLeave'" /> <q-separator v-if="routeName == 'AddLeave'" />
<div class="row col-12 q-pa-md" v-if="routeName == 'AddLeave'"> <div class="row col-12 q-pa-md" v-if="routeName == 'AddLeave'">
<q-space /> <q-space />
<q-btn unelevated dense class="q-px-md items-center" color="primary" label="ยื่นเรื่องขอลาออก" @click="saveResing" :disable="tranferOrg == '' && noteReason == ''" /> <q-btn unelevated dense class="q-px-md items-center" color="primary" label="ยื่นเรื่องขอลาออก" @click="saveData" :disable="tranferOrg == '' && noteReason == ''" />
</div> </div>
</q-card> </q-card>
</div> </q-form>
</div> </div>
</div> </div>
</template> </template>
@ -221,11 +190,13 @@ import { useRouter, useRoute } from "vue-router"
import { useCounterMixin } from "@/stores/mixin" import { useCounterMixin } from "@/stores/mixin"
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"
const mixin = useCounterMixin() const mixin = useCounterMixin()
const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader } = mixin const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader, fails } = mixin
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const myform = ref<QForm | null>(null)
const $q = useQuasar() const $q = useQuasar()
const routeName = router.currentRoute.value.name const routeName = router.currentRoute.value.name
const id = ref<string>("") const id = ref<string>("")
@ -258,16 +229,16 @@ const dataDetail = ref<any>({
status: "", status: "",
statustext: "", statustext: "",
fullname: "", fullname: "",
}); })
const statusOrder = (val: boolean) => { const statusOrder = (val: boolean) => {
switch (val) { switch (val) {
case true: case true:
return "ยับยั้งการลาออก"; return "ยับยั้งการลาออก"
case false: case false:
return "อนุมัติการลาออก"; return "อนุมัติการลาออก"
}
} }
};
onMounted(() => { onMounted(() => {
if (route.params.id !== undefined) { if (route.params.id !== undefined) {
@ -275,6 +246,18 @@ onMounted(() => {
fectDataresign(id.value) fectDataresign(id.value)
} }
}) })
const saveData = async () => {
console.log(myform.value)
if (myform.value != null) {
await myform.value.validate().then(async (saveDataTest: Boolean) => {
if (saveDataTest) {
saveResing()
}
})
}
}
const saveResing = () => { const saveResing = () => {
$q.dialog({ $q.dialog({
title: "ยืนยันการยื่นข้อมูลแบบสอบถาม", title: "ยืนยันการยื่นข้อมูลแบบสอบถาม",
@ -289,11 +272,13 @@ const saveResing = () => {
createFormresign() createFormresign()
}) })
.onCancel(() => {}) .onCancel(() => {})
.onDismiss(() => {}) .onDismiss(() => {
fails($q, "กรุณากรอกอัพโหลดเอกสารเพิ่มเติม")
})
} }
const cancelResing = () => { const cancelResing = () => {
console.log(id); console.log(id)
$q.dialog({ $q.dialog({
title: "ยืนยันการยกเลิกการลาออก", title: "ยืนยันการยกเลิกการลาออก",
@ -309,29 +294,26 @@ const cancelResing = () => {
id.value = route.params.id.toString() id.value = route.params.id.toString()
deleteResting(id.value) deleteResting(id.value)
} }
}) })
.onCancel(() => {}) .onCancel(() => {})
.onDismiss(() => {}) .onDismiss(() => {})
} }
const deleteResting = async (id: string) => { const deleteResting = async (id: string) => {
showLoader() showLoader()
await http await http
.delete(config.API.resingByid(id)) .delete(config.API.resingByid(id))
.then(() => { .then(() => {
success($q, "ยกเลิกการลาออกขอสำเร็จ"); success($q, "ยกเลิกการลาออกขอสำเร็จ")
}) })
.catch((e) => { .catch(e => {
messageError($q, e); messageError($q, e)
}) })
.finally(() => { .finally(() => {
hideLoader(); hideLoader()
}); })
} }
const createFormresign = async () => { const createFormresign = async () => {
const formData = new FormData() const formData = new FormData()
const blob = files.value.slice(0, files.value[0].size) const blob = files.value.slice(0, files.value[0].size)
@ -364,8 +346,12 @@ const fectDataresign = async (id: string) => {
.then((res: any) => { .then((res: any) => {
let data = res.data.result let data = res.data.result
// console.log(data); // console.log(data);
;(tranferOrg.value = data.location), (dateCommand.value = data.sendDate), (dateLeave.value = data.activeDate), (noteReason.value = data.reason), (files.value = data.docs) ,(dataDetail.value = data) ;(tranferOrg.value = data.location),
(dateCommand.value = data.sendDate),
(dateLeave.value = data.activeDate),
(noteReason.value = data.reason),
(files.value = data.docs),
(dataDetail.value = data)
}) })
.catch((e: any) => { .catch((e: any) => {
console.log(e) console.log(e)

View file

@ -1,62 +1,58 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia"
import moment from "moment"; import moment from "moment"
import CustomComponent from "@/components/CustomDialog.vue"; import CustomComponent from "@/components/CustomDialog.vue"
import { Loading, QSpinnerCube } from "quasar"; import { Loading, QSpinnerCube } from "quasar"
export const useCounterMixin = defineStore("mixin", () => { export const useCounterMixin = defineStore("mixin", () => {
/** /**
* *
*/ */
const calAge = ( const calAge = (srcDate: Date, birthCal: Date = new Date(), eng: boolean = false) => {
srcDate: Date, const year = eng ? "years" : "ปี"
birthCal: Date = new Date(), const month = eng ? "months" : "เดือน"
eng: boolean = false const day = eng ? "days" : "วัน"
) => {
const year = eng ? "years" : "ปี";
const month = eng ? "months" : "เดือน";
const day = eng ? "days" : "วัน";
if (srcDate == null) { if (srcDate == null) {
return `0 ${year} 0 ${month} 0 ${day}`; return `0 ${year} 0 ${month} 0 ${day}`
} }
const toDay = birthCal; const toDay = birthCal
const birth = new Date(srcDate); const birth = new Date(srcDate)
const yearNow = toDay.getFullYear(); const yearNow = toDay.getFullYear()
const monthNow = toDay.getMonth(); const monthNow = toDay.getMonth()
const dateNow = toDay.getDate(); const dateNow = toDay.getDate()
const yearDob = birth.getFullYear(); const yearDob = birth.getFullYear()
const monthDob = birth.getMonth(); const monthDob = birth.getMonth()
const dateDob = birth.getDate(); const dateDob = birth.getDate()
const lastYear = 12; const lastYear = 12
const subtractDate: Object = moment().subtract(1, "months").endOf("month"); const subtractDate: Object = moment().subtract(1, "months").endOf("month")
const lastMonths = new Date(subtractDate.toString()).getDate(); const lastMonths = new Date(subtractDate.toString()).getDate()
let yearAge = yearNow - yearDob; let yearAge = yearNow - yearDob
let monthAge = 0; let monthAge = 0
let dateAge = 0; let dateAge = 0
if (monthNow >= monthDob) { if (monthNow >= monthDob) {
monthAge = monthNow - monthDob; monthAge = monthNow - monthDob
} else { } else {
yearAge--; yearAge--
monthAge = lastYear + monthNow - monthDob; monthAge = lastYear + monthNow - monthDob
} }
if (dateNow >= dateDob) { if (dateNow >= dateDob) {
dateAge = dateNow - dateDob; dateAge = dateNow - dateDob
} else { } else {
monthAge--; monthAge--
dateAge = lastMonths + dateNow - dateDob; dateAge = lastMonths + dateNow - dateDob
if (monthAge < 0) { if (monthAge < 0) {
monthAge = 11; monthAge = 11
yearAge--; yearAge--
} }
} }
@ -64,208 +60,113 @@ export const useCounterMixin = defineStore("mixin", () => {
years: yearAge, years: yearAge,
months: monthAge, months: monthAge,
days: dateAge, days: dateAge,
}; }
return `${yearAge} ${year} ${monthAge} ${month} ${dateAge} ${day}`; return `${yearAge} ${year} ${monthAge} ${month} ${dateAge} ${day}`
}; }
function date2Thai( function date2Thai(srcDate: Date, isFullMonth: boolean = false, isTime: boolean = false) {
srcDate: Date,
isFullMonth: boolean = false,
isTime: boolean = false
) {
if (srcDate == null) { if (srcDate == null) {
return null; return null
;`
` `
`;
} }
const date = new Date(srcDate); const date = new Date(srcDate)
const isValidDate = Boolean(+date); const isValidDate = Boolean(+date)
if (!isValidDate) return srcDate.toString(); if (!isValidDate) return srcDate.toString()
if (isValidDate && date.getFullYear() < 1000) return srcDate.toString(); if (isValidDate && date.getFullYear() < 1000) return srcDate.toString()
const fullMonthThai = [ const fullMonthThai = ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"]
"มกราคม", const abbrMonthThai = ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."]
"กุมภาพันธ์", let dstYear = 0
"มีนาคม",
"เมษายน",
"พฤษภาคม",
"มิถุนายน",
"กรกฎาคม",
"สิงหาคม",
"กันยายน",
"ตุลาคม",
"พฤศจิกายน",
"ธันวาคม",
];
const abbrMonthThai = [
"ม.ค.",
"ก.พ.",
"มี.ค.",
"เม.ย.",
"พ.ค.",
"มิ.ย.",
"ก.ค.",
"ส.ค.",
"ก.ย.",
"ต.ค.",
"พ.ย.",
"ธ.ค.",
];
let dstYear = 0;
if (date.getFullYear() > 2500) { if (date.getFullYear() > 2500) {
dstYear = date.getFullYear(); dstYear = date.getFullYear()
} else { } else {
dstYear = date.getFullYear() + 543; dstYear = date.getFullYear() + 543
} }
let dstMonth = ""; let dstMonth = ""
if (isFullMonth) { if (isFullMonth) {
dstMonth = fullMonthThai[date.getMonth()]; dstMonth = fullMonthThai[date.getMonth()]
} else { } else {
dstMonth = abbrMonthThai[date.getMonth()]; dstMonth = abbrMonthThai[date.getMonth()]
} }
let dstTime = ""; let dstTime = ""
if (isTime) { if (isTime) {
const H = date.getHours().toString().padStart(2, "0"); const H = date.getHours().toString().padStart(2, "0")
const M = date.getMinutes().toString().padStart(2, "0"); const M = date.getMinutes().toString().padStart(2, "0")
// const S = date.getSeconds().toString().padStart(2, "0") // const S = date.getSeconds().toString().padStart(2, "0")
// dstTime = " " + H + ":" + M + ":" + S + " น." // dstTime = " " + H + ":" + M + ":" + S + " น."
dstTime = " " + H + ":" + M + " น."; dstTime = " " + H + ":" + M + " น."
} }
return ( return date.getDate().toString().padStart(2, "0") + " " + dstMonth + " " + dstYear + dstTime
date.getDate().toString().padStart(2, "0") +
" " +
dstMonth +
" " +
dstYear +
dstTime
);
} }
function dateMonth2Thai(srcDate: Date, isFullMonth = false, isTime = false) { function dateMonth2Thai(srcDate: Date, isFullMonth = false, isTime = false) {
if (!srcDate) return srcDate; if (!srcDate) return srcDate
const date = new Date(srcDate); const date = new Date(srcDate)
const isValidDate = Boolean(+date); const isValidDate = Boolean(+date)
if (!isValidDate) return srcDate; if (!isValidDate) return srcDate
if (isValidDate && date.getFullYear() < 1000) return srcDate; if (isValidDate && date.getFullYear() < 1000) return srcDate
const fullMonthThai = [ const fullMonthThai = ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"]
"มกราคม", const abbrMonthThai = ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."]
"กุมภาพันธ์", let dstYear = 0
"มีนาคม",
"เมษายน",
"พฤษภาคม",
"มิถุนายน",
"กรกฎาคม",
"สิงหาคม",
"กันยายน",
"ตุลาคม",
"พฤศจิกายน",
"ธันวาคม",
];
const abbrMonthThai = [
"ม.ค.",
"ก.พ.",
"มี.ค.",
"เม.ย.",
"พ.ค.",
"มิ.ย.",
"ก.ค.",
"ส.ค.",
"ก.ย.",
"ต.ค.",
"พ.ย.",
"ธ.ค.",
];
let dstYear = 0;
if (date.getFullYear() > 2500) { if (date.getFullYear() > 2500) {
dstYear = date.getFullYear(); dstYear = date.getFullYear()
} else { } else {
dstYear = date.getFullYear() + 543; dstYear = date.getFullYear() + 543
} }
let dstMonth = ""; let dstMonth = ""
if (isFullMonth) { if (isFullMonth) {
dstMonth = fullMonthThai[date.getMonth()]; dstMonth = fullMonthThai[date.getMonth()]
} else { } else {
dstMonth = abbrMonthThai[date.getMonth()]; dstMonth = abbrMonthThai[date.getMonth()]
} }
let dstTime = ""; let dstTime = ""
if (isTime) { if (isTime) {
const H = date.getHours().toString().padStart(2, "0"); const H = date.getHours().toString().padStart(2, "0")
const M = date.getMinutes().toString().padStart(2, "0"); const M = date.getMinutes().toString().padStart(2, "0")
// const S = date.getSeconds().toString().length === 1 ? "0" + date.getSeconds() : date.getSeconds() // const S = date.getSeconds().toString().length === 1 ? "0" + date.getSeconds() : date.getSeconds()
// dstTime = " " + H + ":" + M + ":" + S + " น." // dstTime = " " + H + ":" + M + ":" + S + " น."
dstTime = " " + H + ":" + M + " น."; dstTime = " " + H + ":" + M + " น."
} }
return date.getDate().toString().padStart(2, "0") + " " + dstMonth; return date.getDate().toString().padStart(2, "0") + " " + dstMonth
} }
function monthYear2Thai(month: number, year: number, isFullMonth = false) { function monthYear2Thai(month: number, year: number, isFullMonth = false) {
const date = new Date(`${year}-${month + 1}-1`); const date = new Date(`${year}-${month + 1}-1`)
const fullMonthThai = [ const fullMonthThai = ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"]
"มกราคม", const abbrMonthThai = ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."]
"กุมภาพันธ์", let dstYear = 0
"มีนาคม",
"เมษายน",
"พฤษภาคม",
"มิถุนายน",
"กรกฎาคม",
"สิงหาคม",
"กันยายน",
"ตุลาคม",
"พฤศจิกายน",
"ธันวาคม",
];
const abbrMonthThai = [
"ม.ค.",
"ก.พ.",
"มี.ค.",
"เม.ย.",
"พ.ค.",
"มิ.ย.",
"ก.ค.",
"ส.ค.",
"ก.ย.",
"ต.ค.",
"พ.ย.",
"ธ.ค.",
];
let dstYear = 0;
if (date.getFullYear() > 2500) { if (date.getFullYear() > 2500) {
dstYear = date.getFullYear(); dstYear = date.getFullYear()
} else { } else {
dstYear = date.getFullYear() + 543; dstYear = date.getFullYear() + 543
} }
let dstMonth = ""; let dstMonth = ""
if (isFullMonth) { if (isFullMonth) {
dstMonth = fullMonthThai[date.getMonth()]; dstMonth = fullMonthThai[date.getMonth()]
} else { } else {
dstMonth = abbrMonthThai[date.getMonth()]; dstMonth = abbrMonthThai[date.getMonth()]
} }
return dstMonth + " " + dstYear; return dstMonth + " " + dstYear
} }
function dateToISO(date: Date) { function dateToISO(date: Date) {
return ( return date.getFullYear() + "-" + appendLeadingZeroes(date.getMonth() + 1) + "-" + appendLeadingZeroes(date.getDate())
date.getFullYear() +
"-" +
appendLeadingZeroes(date.getMonth() + 1) +
"-" +
appendLeadingZeroes(date.getDate())
);
} }
function appendLeadingZeroes(n: Number) { function appendLeadingZeroes(n: Number) {
if (n <= 9) return "0" + n; if (n <= 9) return "0" + n
return n; return n
} }
function textToPhone(n: string) { function textToPhone(n: string) {
const p = n.substr(0, 3) + "-" + n.substr(3, 3) + "-" + n.substr(6, 4); const p = n.substr(0, 3) + "-" + n.substr(3, 3) + "-" + n.substr(6, 4)
return p; return p
} }
function textToFax(n: string) { function textToFax(n: string) {
const p = n.substr(0, 2) + "-" + n.substr(2, 3) + "-" + n.substr(5, 4); const p = n.substr(0, 2) + "-" + n.substr(2, 3) + "-" + n.substr(5, 4)
return p; return p
} }
const success = (q: any, val: string) => { const success = (q: any, val: string) => {
@ -280,9 +181,25 @@ export const useCounterMixin = defineStore("mixin", () => {
timeout: 1000, timeout: 1000,
badgeColor: "positive", badgeColor: "positive",
classes: "my-notif-class", classes: "my-notif-class",
}); })
}
}
const fails = (q: any, val: string) => {
// useQuasar ไม่สามารถใช้นอกไฟล์ .vue
if (val !== "") {
return q.notify({
message: val,
color: "red",
icon: "mdi-information",
position: "bottom-right",
multiLine: true,
timeout: 1000,
badgeColor: "positive",
classes: "my-notif-class",
})
}
} }
};
function notify(q: any, val: string) { function notify(q: any, val: string) {
if (val !== "") { if (val !== "") {
@ -294,7 +211,7 @@ export const useCounterMixin = defineStore("mixin", () => {
multiLine: true, multiLine: true,
timeout: 7000, timeout: 7000,
actions: [{ label: "ปิด", color: "white", handler: () => {} }], actions: [{ label: "ปิด", color: "white", handler: () => {} }],
}); })
} }
} }
function notifyError(q: any, val: string) { function notifyError(q: any, val: string) {
@ -307,7 +224,7 @@ export const useCounterMixin = defineStore("mixin", () => {
multiLine: true, multiLine: true,
timeout: 12000, timeout: 12000,
actions: [{ label: "ปิด", color: "white", handler: () => {} }], actions: [{ label: "ปิด", color: "white", handler: () => {} }],
}); })
} }
} }
@ -325,7 +242,7 @@ export const useCounterMixin = defineStore("mixin", () => {
color: "red", color: "red",
onlycancel: true, onlycancel: true,
}, },
}); })
} else { } else {
q.dialog({ q.dialog({
component: CustomComponent, component: CustomComponent,
@ -336,7 +253,7 @@ export const useCounterMixin = defineStore("mixin", () => {
color: "red", color: "red",
onlycancel: true, onlycancel: true,
}, },
}); })
} }
} else { } else {
if (e.response.status == 401) { if (e.response.status == 401) {
@ -350,7 +267,7 @@ export const useCounterMixin = defineStore("mixin", () => {
color: "red", color: "red",
onlycancel: true, onlycancel: true,
}, },
}); })
} else { } else {
q.dialog({ q.dialog({
component: CustomComponent, component: CustomComponent,
@ -361,7 +278,7 @@ export const useCounterMixin = defineStore("mixin", () => {
color: "red", color: "red",
onlycancel: true, onlycancel: true,
}, },
}); })
} }
} }
} else { } else {
@ -374,9 +291,9 @@ export const useCounterMixin = defineStore("mixin", () => {
color: "red", color: "red",
onlycancel: true, onlycancel: true,
}, },
}); })
}
} }
};
const dialogMessage = ( const dialogMessage = (
// ไม่เอาใส่ undefined // ไม่เอาใส่ undefined
@ -402,12 +319,12 @@ export const useCounterMixin = defineStore("mixin", () => {
}, },
}) })
.onOk(() => { .onOk(() => {
if (ok != undefined) ok(); if (ok != undefined) ok()
}) })
.onCancel(() => { .onCancel(() => {
if (cancel != undefined) cancel(); if (cancel != undefined) cancel()
}); })
}; }
const showLoader = () => { const showLoader = () => {
Loading.show({ Loading.show({
@ -415,20 +332,14 @@ export const useCounterMixin = defineStore("mixin", () => {
spinnerSize: 140, spinnerSize: 140,
spinnerColor: "primary", spinnerColor: "primary",
backgroundColor: "white", backgroundColor: "white",
}); })
}; }
const hideLoader = () => { const hideLoader = () => {
Loading.hide(); Loading.hide()
}; }
function modalDelete( function modalDelete(q: any, title: string, message: string, ok: Function, cancel?: Function) {
q: any,
title: string,
message: string,
ok: Function,
cancel?: Function
) {
q.dialog({ q.dialog({
title: `<span class="text-red">${title}</span>`, title: `<span class="text-red">${title}</span>`,
message: `<span class="text-black">${message}</span>`, message: `<span class="text-black">${message}</span>`,
@ -444,21 +355,15 @@ export const useCounterMixin = defineStore("mixin", () => {
html: true, html: true,
}) })
.onOk(() => { .onOk(() => {
ok(); ok()
}) })
.onCancel(() => { .onCancel(() => {
if (cancel != undefined) cancel(); if (cancel != undefined) cancel()
}) })
.onDismiss(() => {}); .onDismiss(() => {})
} }
function modalConfirm( function modalConfirm(q: any, title: string, message: string, ok: Function, cancel?: Function) {
q: any,
title: string,
message: string,
ok: Function,
cancel?: Function
) {
q.dialog({ q.dialog({
title: `<span class="text-primary">${title}</span>`, title: `<span class="text-primary">${title}</span>`,
message: `<span class="text-black">${message}</span>`, message: `<span class="text-black">${message}</span>`,
@ -474,12 +379,12 @@ export const useCounterMixin = defineStore("mixin", () => {
html: true, html: true,
}) })
.onOk(() => { .onOk(() => {
ok(); ok()
}) })
.onCancel(() => { .onCancel(() => {
if (cancel != undefined) cancel(); if (cancel != undefined) cancel()
}) })
.onDismiss(() => {}); .onDismiss(() => {})
} }
function modalWarning(q: any, title: string, message: string, ok?: Function) { function modalWarning(q: any, title: string, message: string, ok?: Function) {
@ -509,7 +414,7 @@ export const useCounterMixin = defineStore("mixin", () => {
color: "warning", color: "warning",
onlycancel: true, onlycancel: true,
}, },
}); })
} }
function modalError(q: any, title: string, message: string, ok?: Function) { function modalError(q: any, title: string, message: string, ok?: Function) {
@ -539,16 +444,16 @@ export const useCounterMixin = defineStore("mixin", () => {
color: "red", color: "red",
onlycancel: true, onlycancel: true,
}, },
}); })
} }
const dateText = (val: Date) => { const dateText = (val: Date) => {
if (val != null) { if (val != null) {
return date2Thai(val); return date2Thai(val)
} else { } else {
return "-"; return "-"
}
} }
};
/** /**
* 2 * 2
@ -556,138 +461,138 @@ export const useCounterMixin = defineStore("mixin", () => {
*/ */
const dateThaiRange = (val: [Date, Date]) => { const dateThaiRange = (val: [Date, Date]) => {
if (val === null) { if (val === null) {
return ""; return ""
} else if (date2Thai(val[0]) === date2Thai(val[1])) { } else if (date2Thai(val[0]) === date2Thai(val[1])) {
return `${date2Thai(val[0])}`; return `${date2Thai(val[0])}`
} else { } else {
return `${date2Thai(val[0])} - ${date2Thai(val[1])}`; return `${date2Thai(val[0])} - ${date2Thai(val[1])}`
}
} }
};
const weekThai = (val: Number) => { const weekThai = (val: Number) => {
switch (val) { switch (val) {
case 0: case 0:
return "วันอาทิตย์"; return "วันอาทิตย์"
case 1: case 1:
return "วันจันทร์"; return "วันจันทร์"
case 2: case 2:
return "วันอังคาร"; return "วันอังคาร"
case 3: case 3:
return "วันพุธ"; return "วันพุธ"
case 4: case 4:
return "วันพฤหัสบดี"; return "วันพฤหัสบดี"
case 5: case 5:
return "วันศุกร์"; return "วันศุกร์"
case 6: case 6:
return "วันเสาร์"; return "วันเสาร์"
default: default:
return "-"; return "-"
}
} }
};
const genColor15 = (val: number) => { const genColor15 = (val: number) => {
val = val % 15; val = val % 15
switch (val) { switch (val) {
case 1: case 1:
return "pink"; return "pink"
case 2: case 2:
return "purple"; return "purple"
case 3: case 3:
return "deep-purple"; return "deep-purple"
case 4: case 4:
return "indigo"; return "indigo"
case 5: case 5:
return "blue"; return "blue"
case 6: case 6:
return "light-blue"; return "light-blue"
case 7: case 7:
return "cyan"; return "cyan"
case 8: case 8:
return "teal"; return "teal"
case 9: case 9:
return "green"; return "green"
case 10: case 10:
return "light-green"; return "light-green"
case 11: case 11:
return "amber"; return "amber"
case 12: case 12:
return "orange"; return "orange"
case 13: case 13:
return "deep-orange"; return "deep-orange"
case 14: case 14:
return "brown"; return "brown"
case 0: case 0:
return "blue-grey"; return "blue-grey"
default: default:
return ""; return ""
}
} }
};
const typeCategoryExam = (val: string) => { const typeCategoryExam = (val: string) => {
switch (val) { switch (val) {
case "hygiene": case "hygiene":
return "สำนักอนามัย"; return "สำนักอนามัย"
case "physician": case "physician":
return "สำนักการแพทย์"; return "สำนักการแพทย์"
case "city": case "city":
return "สำนักผังเมือง"; return "สำนักผังเมือง"
case "culture": case "culture":
return "สำนักวัฒนธรรม กีฬา และการท่องเที่ยว"; return "สำนักวัฒนธรรม กีฬา และการท่องเที่ยว"
default: default:
return "-"; return "-"
}
} }
};
const typeRetire = (val: string) => { const typeRetire = (val: string) => {
switch (val) { switch (val) {
case "retire": case "retire":
return "เกษียณอายุราชการ"; return "เกษียณอายุราชการ"
case "resign": case "resign":
return "ลาออก"; return "ลาออก"
case "transfer": case "transfer":
return "ให้โอน"; return "ให้โอน"
case "death": case "death":
return "ถึงแก่กรรม"; return "ถึงแก่กรรม"
case "layoff": case "layoff":
return "ให้ออก"; return "ให้ออก"
case "discharge": case "discharge":
return "ปลดออก"; return "ปลดออก"
case "dismiss": case "dismiss":
return "ไล่ออก"; return "ไล่ออก"
case "other": case "other":
return "อื่นๆ"; return "อื่นๆ"
default: default:
return "-"; return "-"
}
} }
};
const typeChangeName = (val: string) => { const typeChangeName = (val: string) => {
switch (val) { switch (val) {
case "firstName": case "firstName":
return "เปลี่ยนชื่อ"; return "เปลี่ยนชื่อ"
case "lastName": case "lastName":
return "เปลี่ยนนามสกุล"; return "เปลี่ยนนามสกุล"
case "all": case "all":
return "เปลี่ยนชื่อ-นามสกุล"; return "เปลี่ยนชื่อ-นามสกุล"
default: default:
return "-"; return "-"
}
} }
};
const statusLeave = (val: string) => { const statusLeave = (val: string) => {
switch (val) { switch (val) {
case "waitting": case "waitting":
return "รออนุมัติ"; return "รออนุมัติ"
case "reject": case "reject":
return "ไม่ผ่านการอนุมัติ"; return "ไม่ผ่านการอนุมัติ"
case "approve": case "approve":
return "ผ่านการอนุมัติ"; return "ผ่านการอนุมัติ"
case "cancel": case "cancel":
return "ยกเลิก"; return "ยกเลิก"
default: default:
return "-"; return "-"
}
} }
};
return { return {
calAge, calAge,
@ -716,5 +621,6 @@ export const useCounterMixin = defineStore("mixin", () => {
typeChangeName, typeChangeName,
statusLeave, statusLeave,
modalWarning, modalWarning,
}; fails,
}); }
})