2023-07-21 16:34:06 +07:00
|
|
|
<template>
|
2023-08-21 15:05:05 +07:00
|
|
|
<div class="col-12 row justify-center">
|
|
|
|
|
<div class="col-xs-12 col-sm-12 col-md-11">
|
|
|
|
|
<div class="toptitle text-white col-12 row items-center">
|
|
|
|
|
<q-btn icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm" @click="router.go(-1)" />
|
|
|
|
|
<div v-if="routeName == 'AddLeave'">เพิ่มเรื่องลาออก</div>
|
|
|
|
|
<div v-else>รายละเอียดเรื่องลาออก</div>
|
|
|
|
|
</div>
|
2023-09-05 21:09:28 +07:00
|
|
|
<q-form ref="myform" class="col-12">
|
2023-08-21 15:05:05 +07:00
|
|
|
<q-card bordered>
|
|
|
|
|
<div class="col-12 row q-col-gutter-md q-pa-md">
|
|
|
|
|
<div class="col-xs-12 col-sm-12">
|
2023-08-22 12:21:03 +07:00
|
|
|
<div class="col-12 row q-pa-sm q-col-gutter-sm">
|
2023-09-05 21:09:28 +07:00
|
|
|
<q-input
|
|
|
|
|
class="col-8"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
v-model="tranferOrg"
|
|
|
|
|
label="สถานที่ยื่นขอลาออกจากราชการ"
|
|
|
|
|
:readonly="routeName != 'AddLeave'"
|
|
|
|
|
:rules="[(val:string) => !!val || `${'กรุณากรอกสถานที่ยื่นขอลาออกจากราชการ'}`]"
|
|
|
|
|
/>
|
2023-08-22 12:21:03 +07:00
|
|
|
<datepicker class="col-2" menu-class-name="modalfix" v-model="dateCommand" :locale="'th'" autoApply readonly borderless :enableTimePicker="false" week-start="0">
|
|
|
|
|
<template #year="{ year }">
|
|
|
|
|
{{ year + 543 }}
|
|
|
|
|
</template>
|
|
|
|
|
<template #year-overlay-value="{ value }">
|
|
|
|
|
{{ parseInt(value + 543) }}
|
|
|
|
|
</template>
|
|
|
|
|
<template #trigger>
|
|
|
|
|
<q-input
|
|
|
|
|
outlined
|
|
|
|
|
readonly
|
|
|
|
|
dense
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
class="full-width datepicker"
|
|
|
|
|
:model-value="dateCommand != null ? date2Thai(dateCommand) : null"
|
|
|
|
|
:label="`${'วันที่ยื่นขอลาออกจากราชการ'}`"
|
|
|
|
|
:rules="[val => !!val || `${'กรุณาเลือกวันที่ยื่นขอลาออกจากราชการ'}`]"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon name="event" class="cursor-pointer" style="color: var(--q-primary)"> </q-icon>
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
</template>
|
|
|
|
|
</datepicker>
|
|
|
|
|
<datepicker
|
|
|
|
|
class="col-2"
|
|
|
|
|
menu-class-name="modalfix"
|
|
|
|
|
v-model="dateLeave"
|
|
|
|
|
:locale="'th'"
|
|
|
|
|
autoApply
|
|
|
|
|
borderless
|
|
|
|
|
:enableTimePicker="false"
|
|
|
|
|
week-start="0"
|
|
|
|
|
:readonly="routeName != 'AddLeave'"
|
|
|
|
|
>
|
|
|
|
|
<template #year="{ year }">
|
|
|
|
|
{{ year + 543 }}
|
|
|
|
|
</template>
|
|
|
|
|
<template #year-overlay-value="{ value }">
|
|
|
|
|
{{ parseInt(value + 543) }}
|
|
|
|
|
</template>
|
|
|
|
|
<template #trigger>
|
|
|
|
|
<q-input
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
:readonly="routeName != 'AddLeave'"
|
|
|
|
|
class="full-width datepicker"
|
|
|
|
|
:model-value="dateLeave != null ? date2Thai(dateLeave) : null"
|
|
|
|
|
:label="`${'วันที่ขอลาออกจากราชการ'}`"
|
|
|
|
|
:rules="[val => !!val || `${'กรุณาเลือกวันที่ขอลาออกจากราชการ'}`]"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon name="event" class="cursor-pointer" style="color: var(--q-primary)"> </q-icon>
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
</template>
|
|
|
|
|
</datepicker>
|
2023-09-05 21:09:28 +07:00
|
|
|
<q-input
|
|
|
|
|
class="col-12"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
v-model="noteReason"
|
|
|
|
|
label="เหตุผลที่ลาออกจากราชการ"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:readonly="routeName != 'AddLeave'"
|
|
|
|
|
:rules="[val => !!val || `${'กรุณากรอกเหตุผลที่ลาออกจากราชการ'}`]"
|
|
|
|
|
/>
|
2023-07-21 16:34:06 +07:00
|
|
|
|
2023-08-22 12:21:03 +07:00
|
|
|
<div class="col-12 row">
|
|
|
|
|
<q-uploader
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
|
|
|
|
class="col-xs-12 col-sm-12"
|
|
|
|
|
accept=".jpg,.png,.pdf,.csv,.doc"
|
|
|
|
|
url="http://localhost:4444/upload"
|
|
|
|
|
label="เอกสารเพิ่มเติม"
|
|
|
|
|
type="file"
|
|
|
|
|
@added="fileUploadDoc"
|
|
|
|
|
style="max-width: px"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-08-21 15:05:05 +07:00
|
|
|
</div>
|
2023-08-29 17:04:37 +07:00
|
|
|
<q-card bordered class="row col-12 text-dark q-mt-sm">
|
2023-09-05 21:09:28 +07:00
|
|
|
<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>
|
|
|
|
|
</div>
|
|
|
|
|
<q-separator />
|
|
|
|
|
<div class="row col-12 q-pa-md">
|
|
|
|
|
<div class="col-12 row bg-white q-col-gutter-md">
|
|
|
|
|
<div class="col-xs-6 row items-start">
|
|
|
|
|
<div class="col-12 text-top">สถานะ</div>
|
|
|
|
|
<div class="col-12 text-detail">
|
|
|
|
|
{{ dataDetail.commanderReject !== null ? statusOrder(dataDetail.commanderReject) : "-" }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-6 row items-start">
|
|
|
|
|
<div class="col-12 text-top">วันสุดท้ายที่ยับยั้ง</div>
|
|
|
|
|
<div class="col-12 text-detail">
|
|
|
|
|
{{ dataDetail.commanderRejectDate !== null ? date2Thai(dataDetail.commanderRejectDate) : "-" }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-12 row items-start">
|
|
|
|
|
<div class="col-12 text-top">ความคิดเห็นและเหตุผล</div>
|
|
|
|
|
<div class="col-12 text-detail" v-if="dataDetail.commanderReject === false">
|
|
|
|
|
{{ dataDetail.commanderApproveReason !== null ? dataDetail.commanderApproveReason : "-" }}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12 text-detail" v-if="dataDetail.commanderReject === true">
|
|
|
|
|
{{ dataDetail.commanderRejectReason !== null ? dataDetail.commanderRejectReason : "-" }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
2023-08-29 17:04:37 +07:00
|
|
|
|
2023-09-05 21:09:28 +07:00
|
|
|
<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="q-pl-sm text-weight-bold text-dark">ผลการพิจารณาของผู้มีอำนาจ</div>
|
|
|
|
|
</div>
|
|
|
|
|
<q-separator />
|
|
|
|
|
<div class="row col-12 q-pa-md">
|
|
|
|
|
<div class="col-12 row bg-white q-col-gutter-md">
|
|
|
|
|
<div class="col-xs-6 row items-start">
|
|
|
|
|
<div class="col-12 text-top">สถานะ</div>
|
|
|
|
|
<div class="col-12 text-detail">
|
|
|
|
|
{{ dataDetail.oligarchReject !== null ? statusOrder(dataDetail.oligarchReject) : "-" }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-6 row items-start">
|
|
|
|
|
<div class="col-12 text-top">วันสุดท้ายที่ยับยั้ง</div>
|
|
|
|
|
<div class="col-12 text-detail">
|
|
|
|
|
{{ dataDetail.oligarchRejectDate !== null ? date2Thai(dataDetail.oligarchRejectDate) : "-" }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-12 row items-start">
|
|
|
|
|
<div class="col-12 text-top">ความคิดเห็นและเหตุผล</div>
|
|
|
|
|
<div class="col-12 text-detail" v-if="dataDetail.oligarchReject == false">
|
|
|
|
|
{{ dataDetail.oligarchApproveReason !== null ? dataDetail.oligarchApproveReason : "-" }}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12 text-detail" v-else-if="dataDetail.oligarchReject == true">
|
|
|
|
|
{{ dataDetail.oligarchRejectReason !== null ? dataDetail.oligarchRejectReason : "-" }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
<div class="row col-12 q-pa-md" v-if="routeName != 'AddLeave'">
|
|
|
|
|
<q-space />
|
|
|
|
|
<q-btn unelevated dense class="q-px-md items-center" color="orange" label="ยกเลิกการลาออก" @click="cancelResing" :disable="tranferOrg == '' && noteReason == ''" />
|
|
|
|
|
</div>
|
2023-08-21 15:05:05 +07:00
|
|
|
</div>
|
2023-08-22 12:21:03 +07:00
|
|
|
<q-separator v-if="routeName == 'AddLeave'" />
|
2023-08-21 16:03:36 +07:00
|
|
|
<div class="row col-12 q-pa-md" v-if="routeName == 'AddLeave'">
|
2023-08-21 15:05:05 +07:00
|
|
|
<q-space />
|
2023-09-05 21:09:28 +07:00
|
|
|
<q-btn unelevated dense class="q-px-md items-center" color="primary" label="ยื่นเรื่องขอลาออก" @click="saveData" :disable="tranferOrg == '' && noteReason == ''" />
|
2023-08-21 15:05:05 +07:00
|
|
|
</div>
|
|
|
|
|
</q-card>
|
2023-09-05 21:09:28 +07:00
|
|
|
</q-form>
|
2023-08-21 15:05:05 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-07-21 16:34:06 +07:00
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
2023-08-21 15:05:05 +07:00
|
|
|
import type { QTableProps } from "quasar"
|
|
|
|
|
import { ref, onMounted } from "vue"
|
|
|
|
|
import { useQuasar } from "quasar"
|
|
|
|
|
import { useRouter, useRoute } from "vue-router"
|
|
|
|
|
import { useCounterMixin } from "@/stores/mixin"
|
|
|
|
|
import http from "@/plugins/http"
|
|
|
|
|
import config from "@/app.config"
|
2023-09-05 21:09:28 +07:00
|
|
|
import type { QForm } from "quasar"
|
2023-07-21 16:34:06 +07:00
|
|
|
|
2023-08-21 15:05:05 +07:00
|
|
|
const mixin = useCounterMixin()
|
2023-09-05 21:09:28 +07:00
|
|
|
const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader, fails } = mixin
|
2023-08-21 15:05:05 +07:00
|
|
|
const router = useRouter()
|
|
|
|
|
const route = useRoute()
|
2023-09-05 21:09:28 +07:00
|
|
|
const myform = ref<QForm | null>(null)
|
2023-08-21 15:05:05 +07:00
|
|
|
const $q = useQuasar()
|
|
|
|
|
const routeName = router.currentRoute.value.name
|
|
|
|
|
const id = ref<string>("")
|
|
|
|
|
const fileDocDataUpload = ref<File[]>([])
|
|
|
|
|
const files = ref<any>()
|
|
|
|
|
const tranferOrg = ref("")
|
|
|
|
|
const dateCommand = ref<Date>(new Date())
|
|
|
|
|
const dateLeave = ref<Date>(new Date())
|
|
|
|
|
const noteReason = ref("")
|
2023-08-24 16:08:11 +07:00
|
|
|
const nameFile = ref<string>("")
|
2023-08-09 12:04:57 +07:00
|
|
|
|
2023-08-29 17:04:37 +07:00
|
|
|
const dataDetail = ref<any>({
|
2023-09-05 21:09:28 +07:00
|
|
|
datetext: "",
|
|
|
|
|
activeDate: new Date(),
|
|
|
|
|
createdAt: new Date(),
|
|
|
|
|
firstName: "",
|
|
|
|
|
id: "",
|
|
|
|
|
isActive: true,
|
|
|
|
|
lastName: "",
|
|
|
|
|
location: "",
|
|
|
|
|
organizationPositionOld: "",
|
|
|
|
|
positionLevelOld: "",
|
|
|
|
|
positionNumberOld: "",
|
|
|
|
|
positionTypeOld: "",
|
|
|
|
|
prefix: "",
|
|
|
|
|
profileId: "",
|
|
|
|
|
reason: "",
|
|
|
|
|
salary: 0,
|
|
|
|
|
sendDate: new Date(),
|
|
|
|
|
status: "",
|
|
|
|
|
statustext: "",
|
|
|
|
|
fullname: "",
|
|
|
|
|
})
|
2023-08-29 17:04:37 +07:00
|
|
|
|
|
|
|
|
const statusOrder = (val: boolean) => {
|
2023-09-05 21:09:28 +07:00
|
|
|
switch (val) {
|
|
|
|
|
case true:
|
|
|
|
|
return "ยับยั้งการลาออก"
|
|
|
|
|
case false:
|
|
|
|
|
return "อนุมัติการลาออก"
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-29 17:04:37 +07:00
|
|
|
|
2023-08-09 12:04:57 +07:00
|
|
|
onMounted(() => {
|
2023-08-21 15:05:05 +07:00
|
|
|
if (route.params.id !== undefined) {
|
|
|
|
|
id.value = route.params.id.toString()
|
|
|
|
|
fectDataresign(id.value)
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-09-05 21:09:28 +07:00
|
|
|
|
|
|
|
|
const saveData = async () => {
|
|
|
|
|
console.log(myform.value)
|
|
|
|
|
if (myform.value != null) {
|
|
|
|
|
await myform.value.validate().then(async (saveDataTest: Boolean) => {
|
|
|
|
|
if (saveDataTest) {
|
|
|
|
|
saveResing()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-09 12:04:57 +07:00
|
|
|
const saveResing = () => {
|
2023-08-21 15:05:05 +07:00
|
|
|
$q.dialog({
|
2023-08-24 16:08:11 +07:00
|
|
|
title: "ยืนยันการยื่นข้อมูลแบบสอบถาม",
|
|
|
|
|
message: "ต้องการยื่นข้อมูลแบบสอบถามนี้ใช่หรือไม่?",
|
2023-08-21 15:05:05 +07:00
|
|
|
cancel: {
|
|
|
|
|
flat: true,
|
|
|
|
|
color: "negative",
|
|
|
|
|
},
|
|
|
|
|
persistent: true,
|
|
|
|
|
})
|
|
|
|
|
.onOk(async () => {
|
|
|
|
|
createFormresign()
|
|
|
|
|
})
|
|
|
|
|
.onCancel(() => {})
|
2023-09-05 21:09:28 +07:00
|
|
|
.onDismiss(() => {
|
|
|
|
|
fails($q, "กรุณากรอกอัพโหลดเอกสารเพิ่มเติม")
|
|
|
|
|
})
|
2023-08-21 15:05:05 +07:00
|
|
|
}
|
2023-08-31 10:55:29 +07:00
|
|
|
|
|
|
|
|
const cancelResing = () => {
|
2023-09-05 21:09:28 +07:00
|
|
|
console.log(id)
|
|
|
|
|
|
2023-08-31 10:55:29 +07:00
|
|
|
$q.dialog({
|
|
|
|
|
title: "ยืนยันการยกเลิกการลาออก",
|
|
|
|
|
message: "ต้องการยื่นข้อมูลยกเลิกการลาออกนี้ใช่หรือไม่?",
|
|
|
|
|
cancel: {
|
|
|
|
|
flat: true,
|
|
|
|
|
color: "negative",
|
|
|
|
|
},
|
|
|
|
|
persistent: true,
|
|
|
|
|
})
|
|
|
|
|
.onOk(async () => {
|
2023-09-05 21:09:28 +07:00
|
|
|
if (route.params.id !== undefined) {
|
|
|
|
|
id.value = route.params.id.toString()
|
|
|
|
|
deleteResting(id.value)
|
|
|
|
|
}
|
2023-08-31 10:55:29 +07:00
|
|
|
})
|
|
|
|
|
.onCancel(() => {})
|
|
|
|
|
.onDismiss(() => {})
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-05 21:09:28 +07:00
|
|
|
const deleteResting = async (id: string) => {
|
2023-08-31 10:55:29 +07:00
|
|
|
showLoader()
|
|
|
|
|
await http
|
2023-09-05 21:09:28 +07:00
|
|
|
.delete(config.API.resingByid(id))
|
|
|
|
|
.then(() => {
|
|
|
|
|
success($q, "ยกเลิกการลาออกขอสำเร็จ")
|
|
|
|
|
})
|
|
|
|
|
.catch(e => {
|
|
|
|
|
messageError($q, e)
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader()
|
|
|
|
|
})
|
2023-08-31 10:55:29 +07:00
|
|
|
}
|
|
|
|
|
|
2023-08-09 12:04:57 +07:00
|
|
|
const createFormresign = async () => {
|
2023-08-21 15:05:05 +07:00
|
|
|
const formData = new FormData()
|
2023-08-24 16:08:11 +07:00
|
|
|
const blob = files.value.slice(0, files.value[0].size)
|
|
|
|
|
const newFile = new File(blob, nameFile.value, {
|
|
|
|
|
type: files.value[0].type,
|
|
|
|
|
})
|
2023-08-21 15:05:05 +07:00
|
|
|
formData.append("Location", tranferOrg.value)
|
|
|
|
|
formData.append("SendDate", dateToISO(dateCommand.value))
|
|
|
|
|
formData.append("ActiveDate", dateToISO(dateLeave.value))
|
|
|
|
|
formData.append("Reason", noteReason.value)
|
2023-08-24 16:08:11 +07:00
|
|
|
formData.append("file", newFile)
|
|
|
|
|
console.log(files.value)
|
2023-08-21 15:05:05 +07:00
|
|
|
await http
|
|
|
|
|
.post(config.API.listResign(), formData)
|
|
|
|
|
.then((res: any) => {
|
2023-08-22 12:21:03 +07:00
|
|
|
let data = res.data.result.id
|
2023-08-21 15:05:05 +07:00
|
|
|
// console.log(res);
|
|
|
|
|
success($q, "บันทึกข้อมูลสำเร็จ")
|
2023-08-22 12:21:03 +07:00
|
|
|
router.push(`/leave/result/${data}`)
|
2023-08-21 15:05:05 +07:00
|
|
|
})
|
|
|
|
|
.catch((e: any) => {
|
|
|
|
|
messageError($q, e)
|
|
|
|
|
console.log(e)
|
|
|
|
|
})
|
|
|
|
|
}
|
2023-08-09 12:04:57 +07:00
|
|
|
const fectDataresign = async (id: string) => {
|
2023-08-21 15:05:05 +07:00
|
|
|
showLoader()
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.resingByid(id))
|
|
|
|
|
.then((res: any) => {
|
|
|
|
|
let data = res.data.result
|
|
|
|
|
// console.log(data);
|
2023-09-05 21:09:28 +07:00
|
|
|
;(tranferOrg.value = data.location),
|
|
|
|
|
(dateCommand.value = data.sendDate),
|
|
|
|
|
(dateLeave.value = data.activeDate),
|
|
|
|
|
(noteReason.value = data.reason),
|
|
|
|
|
(files.value = data.docs),
|
|
|
|
|
(dataDetail.value = data)
|
2023-08-21 15:05:05 +07:00
|
|
|
})
|
|
|
|
|
.catch((e: any) => {
|
|
|
|
|
console.log(e)
|
|
|
|
|
messageError($q, e)
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const fileUploadDoc = async (file: any) => {
|
|
|
|
|
fileDocDataUpload.value.push(file)
|
2023-08-28 10:44:54 +07:00
|
|
|
nameFile.value = file[0].name
|
2023-08-21 15:05:05 +07:00
|
|
|
files.value = file
|
|
|
|
|
}
|
2023-07-21 16:34:06 +07:00
|
|
|
</script>
|