hrms-mgt/src/modules/06_retirement/components/03_resignEmp/ResignByid.vue

1529 lines
49 KiB
Vue
Raw Normal View History

2024-11-08 15:34:22 +07:00
<script setup lang="ts">
import { ref, onMounted, computed } from "vue";
import axios from "axios";
import { useRouter, useRoute } from "vue-router";
import { useQuasar, QForm } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import genReport from "@/plugins/genreport";
import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
import type {
TypeFile,
rowFile,
FileList,
} from "@/modules/06_retirement/interface/response/Main";
import type { QTableProps } from "quasar";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import CardProfile from "@/components/CardProfile.vue";
import WorkFlow from "@/components/Workflow/Main.vue";
/** Use */
const $q = useQuasar();
const route = useRoute();
const router = useRouter();
2024-11-11 10:05:02 +07:00
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailbyidEMP");
2024-11-08 15:34:22 +07:00
const mixin = useCounterMixin();
const {
messageError,
date2Thai,
showLoader,
hideLoader,
success,
dialogConfirm,
dialogRemove,
2025-03-11 15:19:04 +07:00
convertDateToAPI,
2024-11-08 15:34:22 +07:00
} = mixin;
/** ตัวแปร */
const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
const roleUser = ref<string>("");
const dataProfile = ref<DataProfile>();
const id = ref<string>(route.params.id.toString());
const myForm = ref<QForm | null>(null);
const edit = ref<boolean>(false);
const conditions = ref<boolean>(false);
const dataDetail = ref<any>({
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: "",
statusMain: "",
cancelReason: "",
remark: "",
2025-01-13 17:07:23 +07:00
reasonResign: "",
2024-11-08 15:34:22 +07:00
});
const workflowRef = ref<any>(null);
const organizationPositionOld = ref<string>("");
const positionTypeOld = ref<string>("");
const positionLevelOld = ref<string>("");
const posNo = ref<string>("");
const salary = ref<number>(0);
const date = ref<Date | null>(null);
const dateLeave = ref<Date | null>(null);
const reason = ref<string>("");
const location = ref<string>("");
const status = ref<string>("");
const remarkHorizontal = ref<string>("");
const modal = ref<boolean>(false);
const actionPass = ref<boolean>(false);
const reasonReign = ref<string>("");
const dateBreak = ref<Date | null>(null);
const isCheckData = computed(() => {
if (
organizationPositionOld.value !== "" &&
positionTypeOld.value !== "" &&
positionLevelOld.value !== "" &&
posNo.value !== "" &&
date.value !== null &&
dataDetail.value.commanderReject !== null &&
dataDetail.value.oligarchReject !== null
) {
return true;
} else return false;
});
/** คอลัมน์ */
const rows = ref<TypeFile[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fileName",
align: "left",
label: "ชื่อไฟล์",
sortable: true,
field: "fileName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "btnMicrosoft",
align: "right",
label: "ปุ่ม",
sortable: true,
field: "btnMicrosoft",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
/**เปิด-ปิด modal */
function closeModal() {
modal.value = false;
}
function openModal() {
modal.value = true;
}
const file = ref<any>(null);
const fileList = ref<FileList[]>([]);
const isNoDebt = ref<boolean>(false);
const isNoBurden = ref<boolean>(false);
const isDiscipline = ref<boolean>(false);
// เอกสารดาวน์โหลด
const rowsFileDownload = ref<rowFile[]>([
{
fileName: "แบบฟอร์มหนังสือขอลาออกจากราชการ",
pathName: "",
},
]);
function diffDate() {
if (date.value !== null && dateLeave.value !== null) {
const time = dateLeave.value.getTime() - date.value.getTime();
//วันที่ขอลาออกจากราชการ - วันที่ยื่นขอลาออกจากราชการ
const day = time / (1000 * 3600 * 24);
if (day < 30) {
return true;
}
return false;
}
return false;
}
/** นำข้อมูลมาจาก API*/
async function fetchData(id: string) {
showLoader();
await http
.get(config.API.resingByidEMP(id))
.then(async (res) => {
const data = await res.data.result;
dataProfile.value = data as DataProfile;
let list: TypeFile[] = [];
if (data.docs.length > 0) {
data.docs.map((doc: TypeFile) => {
list.push({
pathName: doc.pathName ?? "",
fileName: doc.fileName ?? "",
});
});
}
rows.value = list;
dataDetail.value = data;
organizationPositionOld.value = data.organizationPositionOld ?? "";
positionTypeOld.value = data.positionTypeOld ?? "";
positionLevelOld.value = data.positionLevelOld ?? "";
posNo.value = data.positionNumberOld ?? "";
salary.value = data.salary ? data.salary : 0;
date.value = data.sendDate ? new Date(data.sendDate) : null;
dateLeave.value = data.activeDate ? new Date(data.activeDate) : null;
2025-01-13 17:06:48 +07:00
reason.value = data.reasonResign ?? "";
2024-11-08 15:34:22 +07:00
location.value = data.location ?? "";
status.value = data.status ?? "";
remarkHorizontal.value = data.remarkHorizontal ?? "-";
isNoDebt.value = data.isNoDebt;
isNoBurden.value = data.isNoBurden;
isDiscipline.value = data.isDiscipline;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**Pop up */
function popUp(action: "pass" | "passNot", type: string) {
reasonReign.value = "";
dateBreak.value = null;
actionPass.value = action === "pass";
roleUser.value = type;
openModal();
}
//เงื่อนไขpop up
function onSubmit() {
if (actionPass.value) {
confirmpopUp();
} else {
rejectpopUp();
}
}
//pop up ยืนยันการอนุญาต
async function confirmpopUp() {
dialogConfirm(
$q,
async () => {
showLoader();
const body = {
reason: reasonReign.value,
};
await http
.put(config.API.resignConfirmEMP(roleUser.value, id.value), body)
.then(async () => {
await fetchData(id.value);
closeModal();
success($q, "การอนุญาตสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
},
"ยืนยันการอนุญาต",
"ต้องการยืนยันการอนุญาตการลานี้หรือไม่ ?"
);
}
//pop up การยับยั้งสำเร็จ
async function rejectpopUp() {
dialogConfirm(
$q,
async () => {
showLoader();
const body = {
reason: reasonReign.value,
date: dateBreak.value,
};
await http
.put(config.API.resignRejectEMP(roleUser.value, id.value), body)
.then(async () => {
await fetchData(id.value);
closeModal();
success($q, "การยับยั้งสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
},
"ยืนยันการยับยั้ง",
"ต้องการยืนยันการยับยั้งนี้หรือไม่ ?"
);
}
/**
* กดยกเล
*/
async function clickCancel() {
edit.value = false;
const data = dataDetail.value;
if (data) {
organizationPositionOld.value = data.organizationPositionOld ?? "";
positionTypeOld.value = data.positionTypeOld ?? "";
positionLevelOld.value = data.positionLevelOld ?? "";
posNo.value = data.positionNumberOld ?? "";
salary.value = data.salary ? data.salary : 0;
date.value = data.sendDate ? new Date(data.sendDate) : null;
dateLeave.value = data.activeDate ? new Date(data.activeDate) : null;
2025-01-13 17:06:48 +07:00
reason.value = data.reasonResign ?? "";
location.value = data.location ?? "";
status.value = data.status ?? "";
remarkHorizontal.value = data.remarkHorizontal ?? "-";
isNoDebt.value = data.isNoDebt;
isNoBurden.value = data.isNoBurden;
isDiscipline.value = data.isDiscipline;
}
2024-11-08 15:34:22 +07:00
myForm.value?.resetValidation();
// await fetchData(id.value);
2024-11-08 15:34:22 +07:00
}
/**
* กดยกเล
*/
async function clickCancelConditions() {
await fetchData(id.value);
conditions.value = false;
}
2024-11-28 13:44:28 +07:00
/** Function บันทึก รายการตรวจสอบเงื่อนไขต่างๆ*/
2024-11-08 15:34:22 +07:00
function onSubmitConditions() {
dialogConfirm($q, async () => {
2024-11-08 15:34:22 +07:00
showLoader();
await http
2024-11-08 15:34:22 +07:00
.put(config.API.resignConditionsEMP(id.value), {
isNoDebt: isNoDebt.value,
isNoBurden: isNoBurden.value,
isDiscipline: isDiscipline.value,
})
.then(async () => {
await fetchData(id.value);
2024-11-28 13:44:28 +07:00
success($q, "บันทึกเงื่อนไขต่างๆ สำเร็จ");
2024-11-08 15:34:22 +07:00
conditions.value = false;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/** Function บันทึก ,แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
function onSubmitAttached() {
dialogConfirm($q, () => {
const formData = new FormData();
2025-03-11 15:19:04 +07:00
const send = convertDateToAPI(date.value) ?? "";
const activeDate = convertDateToAPI(dateLeave.value) ?? "";
2024-11-08 15:34:22 +07:00
formData.append("Location", location.value);
formData.append("SendDate", send);
formData.append("ActiveDate", activeDate);
formData.append("Reason", reason.value);
formData.append("OrganizationPositionOld", organizationPositionOld.value);
formData.append("PositionTypeOld", positionTypeOld.value);
formData.append("PositionLevelOld", positionLevelOld.value);
formData.append("PositionNumberOld", posNo.value);
formData.append("AmountOld", salary.value.toString());
formData.append("remarkHorizontal", remarkHorizontal.value);
showLoader();
http
.put(config.API.resingByidEMP(id.value), formData)
.then(async () => {
await fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
edit.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
}
/**
* Function เพ Class เวลา Edit
* @param val เมอเปนEdit จะเปลยน Class
*/
function getClass(val: boolean) {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
}
/** แปลง StatusOrder */
function statusOrder(val: boolean) {
switch (val) {
case true:
return "ยับยั้ง";
case false:
return "อนุญาต";
}
}
// ดาว์นโหลดไฟล์
async function fileDownload(type: string, fileName: string) {
showLoader();
await http
.get(config.API.reportResignList(type, id.value))
.then(async (res) => {
const data = res.data.result;
await genReport(data, `${fileName}`, type);
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
hideLoader();
});
}
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
async function fetchFile() {
showLoader();
await http
.get(config.API.file("พ้นจากราชการ", "หลักฐานลาออก", id.value))
.then(async (res) => {
fileList.value = await res.data;
})
.catch((e) => {
messageError($q, e);
hideLoader();
});
}
function uploadFiles() {
showLoader();
http
.post(config.API.file("พ้นจากราชการ", "หลักฐานลาออก", id.value), {
replace: true,
fileList: [
{
fileName: file.value.name,
},
],
})
.then(async (res) => {
const foundKey: string | undefined = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
foundKey && (await uploadFileURL(res.data[foundKey]?.uploadUrl));
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function uploadFileURL(uploadUrl: string) {
const Data = new FormData();
Data.append("file", file.value);
showLoader();
await axios
.put(uploadUrl, file.value, {
headers: {
"Content-Type": file.value.type,
},
})
.then(async () => {
await fetchFile();
success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
file.value = null;
});
}
async function downloadFiles(fileName: string) {
showLoader();
await http
.get(
config.API.fileByFile("พ้นจากราชการ", "หลักฐานลาออก", id.value, fileName)
)
.then(async (res) => {
const data = await res.data.downloadUrl;
window.open(data, "_blank");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
}
/**
* ลบไฟล
* @param id id file
*/
function removeFile(fileName: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(
config.API.fileByFile(
"พ้นจากราชการ",
"หลักฐานลาออก",
id.value,
fileName
)
)
.then(() => {
setTimeout(async () => {
await fetchFile();
success($q, `ลบไฟล์สำเร็จ`);
hideLoader();
}, 1000);
})
.catch((e) => {
messageError($q, e);
hideLoader();
});
});
}
const isDirector = ref<boolean>(false);
const isStaff = ref<boolean>(false);
function fetchCheckIsofficer() {
http
.get(config.API.workflowKeycloakSystem("SYS_RESIGN_EMP"))
.then((res) => {
isStaff.value = res.data.result.isStaff;
isDirector.value = res.data.result.isDirector;
})
.catch((err) => {
messageError($q, err);
});
}
function convertStatus(val: string) {
if (/^[A-Za-z]+$/.test(val)) {
switch (val) {
case "CAREER":
return "ประกอบอาชีพอื่น";
case "MOVE":
return "รับราชการสังกัดอื่น";
case "FAMILY":
return "ดูแลบิดามารดา";
case "EDUCATION":
return "ศึกษาต่อ";
case "OTHER":
return "อื่น ๆ";
}
} else return val;
}
2024-11-08 15:34:22 +07:00
/** Hook */
onMounted(async () => {
showLoader();
await Promise.all([
fetchData(id.value),
fetchFile(),
fetchCheckIsofficer(),
]).finally(() => {
2024-11-08 15:34:22 +07:00
hideLoader();
});
});
</script>
<template>
<div class="q-pa-sm">
2024-11-08 15:34:22 +07:00
<div class="toptitle text-dark col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="router.push('/retirement/resign-employee')"
/>
รายละเอยดการลาออก
{{
dataDetail.prefix + dataDetail.firstName + " " + dataDetail.lastName
}}
2024-11-08 15:34:22 +07:00
</div>
<CardProfile :type="'employee'" :data="dataProfile as DataProfile" />
<!-- อมลการลาออก -->
<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>
<!-- <q-space />
<div
class="q-gutter-x-sm"
v-if="
(roleUser === 'officer' && dataDetail.officerReject === null) ||
(roleUser === 'commander' &&
dataDetail.commanderReject === null &&
dataDetail.officerReject !== null) ||
(roleUser === 'oligarch' &&
dataDetail.oligarchReject === null &&
dataDetail.commanderReject !== null &&
dataDetail.officerReject !== null)
"
>
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot')"
/>
</div> -->
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-md">
<div class="col-12 row bg-white q-col-gutter-md">
<div class="col-xs-6 col-sm-3 row items-start">
<div class="col-12">
<div class="col-12 text-top">สถานทนขอลาออกจากราชการ</div>
<div class="col-12 text-detail">{{ dataDetail.location }}</div>
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-start">
<div class="col-12">
<div class="col-12 text-top">นทนขอลาออกจากราชการ</div>
<div class="col-12 text-detail">
{{ date2Thai(dataDetail.sendDate) }}
</div>
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-start">
<div class="col-12">
<div class="col-12 text-top">เหตผลทลาออกจากราชการ</div>
<div class="col-12 text-detail">
{{
`${convertStatus(dataDetail.reason)}${
dataDetail.remark ? `(${dataDetail.remark})` : ""
}`
}}
</div>
2024-11-08 15:34:22 +07:00
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-start">
<div class="col-12">
<div class="col-12 text-top">นทขอลาออกจากราชการ</div>
<div
:class="
diffDate()
? 'col-12 text-detail text-red text-bold'
: 'col-12 text-detail'
"
>
{{ date2Thai(dataDetail.activeDate) }}
</div>
<div
:class="
diffDate()
? 'col-12 text-detail text-red text-bold'
: 'col-12 text-detail'
"
>
{{ diffDate() ? "(ยื่นขอลาออกน้อยกว่า 30 วัน)" : "" }}
</div>
</div>
</div>
<div
class="col-xs-12 col-sm-12 row items-start"
v-if="dataDetail.statusMain === 'CANCEL'"
>
<div class="col-12">
<div class="col-12 text-top">เหตผลการขอยกเล</div>
<div class="col-12 text-detail text-red">
{{ dataDetail.cancelReason }}
</div>
</div>
</div>
2024-11-08 15:34:22 +07:00
</div>
</div>
</q-card>
<!-- เอกสารเพมเต -->
<q-card
v-if="rows.length > 0"
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>
<div class="col-12"><q-separator /></div>
<div class="col-12">
<d-table
:rows="rows"
:columns="columns"
row-key="fileName"
hide-header
hide-bottom
>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="fileName" :props="props">
{{ props.row.fileName }}
</q-td>
<q-td key="btnMicrosoft" :props="props">
<q-btn
type="a"
target="_blank"
:href="props.row.pathName"
flat
dense
round
color="red"
icon="picture_as_pdf"
>
<q-tooltip>ไฟล PDF</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</q-card>
<!-- เอกสารดาวนโหลด -->
<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>
<div class="col-12"><q-separator /></div>
<div class="col-12">
<d-table
:rows="rowsFileDownload"
:columns="columns"
row-key="fileName"
hide-header
hide-bottom
>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td key="fileName" :props="props">
{{ props.row.fileName }}
</q-td>
<q-td key="btnMicrosoft" :props="props">
<q-btn
flat
dense
round
color="red"
icon="picture_as_pdf"
@click="fileDownload('pdf', props.row.fileName)"
>
<q-tooltip>ไฟล PDF</q-tooltip>
</q-btn>
<q-btn
flat
dense
round
color="blue"
icon="mdi-file-word"
@click="fileDownload('docx', props.row.fileName)"
>
<q-tooltip>ไฟล WORD</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</q-card>
2024-11-28 13:44:28 +07:00
<!-- รายการตรวจสอบเงอนไขตางๆ -->
2024-11-08 15:34:22 +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">
2024-11-28 13:44:28 +07:00
รายการตรวจสอบเงอนไขตางๆ
2024-11-08 15:34:22 +07:00
</div>
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-sm q-col-gutter-sm">
<div class="col-6">
<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">
2024-11-28 13:44:28 +07:00
เงอนไขตางๆ
2024-11-08 15:34:22 +07:00
</div>
<q-space />
<div
v-if="
!checkRoutePermisson &&
isStaff &&
dataDetail.statusMain === 'WAITTING'
"
>
2024-11-08 15:34:22 +07:00
<div v-if="!conditions">
<q-btn
outline
color="primary"
dense
icon-right="mdi-file-edit-outline"
class="q-px-sm"
label="แก้ไข"
style="width: 80px"
@click="conditions = !conditions"
/>
</div>
<div v-else class="q-gutter-x-sm">
<q-btn
outline
color="public"
dense
class="q-px-sm"
label="บันทึก"
style="width: 80px"
@click="onSubmitConditions"
/>
<q-btn
outline
color="red"
dense
class="q-px-sm"
label="ยกเลิก"
style="width: 80px"
@click="clickCancelConditions"
/>
</div>
</div>
</div>
<div class="col-12"><q-separator /></div>
<div class="col-12">
<q-checkbox
v-model="isNoDebt"
label="ไม่เป็นหนี้สหกรณ์"
color="teal"
:disable="!conditions"
/>
</div>
<div class="col-12">
<q-checkbox
v-model="isNoBurden"
label="ไม่มีภาระผูกพันค้ำประกันทุนการศึกษา"
color="teal"
:disable="!conditions"
/>
</div>
<div class="col-12">
<q-checkbox
v-model="isDiscipline"
label="ไม่มีพฤติการณ์ทางวินัย"
color="teal"
:disable="!conditions"
/>
</div>
</q-card>
</div>
<div class="col-6">
<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">
2024-11-28 13:44:28 +07:00
เอกสารหลกฐานตางๆ
2024-11-08 15:34:22 +07:00
</div>
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-col-gutter-y-sm q-pa-sm">
<div class="col-12 row">
<q-file
v-if="
!checkRoutePermisson &&
isStaff &&
dataDetail.statusMain === 'WAITTING'
"
2024-11-08 15:34:22 +07:00
class="col-12"
for="#evidenceFiles"
outlined
dense
v-model="file"
2024-11-28 13:44:28 +07:00
label="อัปโหลดเอกสารหลักฐานต่างๆ"
2024-11-08 15:34:22 +07:00
hide-bottom-space
>
<template v-slot:prepend>
<q-icon name="attach_file" color="primary" />
</template>
<template v-slot:after>
<q-btn
v-if="file"
size="14px"
flat
round
dense
2024-12-04 16:13:12 +07:00
color="primary"
2024-11-08 15:34:22 +07:00
icon="mdi-upload"
@click="uploadFiles"
><q-tooltip>ปโหลดเอกสาร</q-tooltip></q-btn
>
</template>
</q-file>
</div>
<div v-if="fileList.length > 0" class="col-xs-12 row">
<q-list class="full-width rounded-borders" bordered separator>
<q-item
v-for="File in fileList"
:key="File.id"
clickable
v-ripple
>
<q-item-section>{{ File.title }}</q-item-section>
<q-item-section avatar>
<div class="row">
<div>
<q-btn
dense
flat
round
size="12px"
color="blue"
icon="mdi-download-outline"
@click="downloadFiles(File.fileName)"
>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn>
</div>
<div>
<q-btn
v-if="
!checkRoutePermisson &&
isStaff &&
dataDetail.statusMain === 'WAITTING'
2024-11-08 15:34:22 +07:00
"
dense
flat
round
size="12px"
color="red"
icon="mdi-delete-outline"
@click="removeFile(File.fileName)"
><q-tooltip>ลบไฟล</q-tooltip></q-btn
>
</div>
</div>
</q-item-section>
</q-item>
</q-list>
</div>
<div class="col-12" v-else>
<q-card class="q-pa-sm" bordered> ไมรายการเอกสาร </q-card>
</div>
</div>
</q-card>
</div>
</div>
</q-card>
<!-- ผลการพจารณาของการเจาหนาทของหนวยงาน -->
<!-- <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>
<div class="col-12"><q-separator /></div>
<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.officerReject !== null
? statusOrder(dataDetail.officerReject)
: "-"
}}
</div>
</div>
<div class="col-xs-6 row items-start">
<div class="col-12 text-top">นสดทายทบย</div>
<div class="col-12 text-detail">
{{
dataDetail.officerRejectDate !== null
? date2Thai(dataDetail.officerRejectDate)
: "-"
}}
</div>
</div>
<div class="col-xs-12 row items-start">
<div class="col-12 text-top">ความคดเหนและเหตผล</div>
<div class="col-12 text-detail">
{{
dataDetail.officerReject
? dataDetail.officerRejectReason
: dataDetail.officerApproveReason
}}
</div>
</div>
</div>
</div>
</q-card> -->
<!-- ผลการพจารณาของผงคบบญชา -->
<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>
<q-space />
<div
class="q-gutter-x-sm"
v-if="
isDirector &&
dataDetail.commanderReject === null &&
dataDetail.statusMain === 'WAITTING'
"
2024-11-08 15:34:22 +07:00
>
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass', 'commander')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot', 'commander')"
/>
</div>
</div>
<div class="col-12"><q-separator /></div>
<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">
{{
dataDetail.commanderReject
? dataDetail.commanderRejectReason
: dataDetail.commanderApproveReason
}}
</div>
</div>
</div>
</div>
</q-card>
<!-- ผลการพจารณาของผอำนาจ -->
<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>
<q-space />
<div
class="q-gutter-x-sm"
v-if="
isDirector &&
dataDetail.oligarchReject === null &&
dataDetail.statusMain === 'WAITTING'
"
2024-11-08 15:34:22 +07:00
>
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass', 'oligarch')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot', 'oligarch')"
/>
</div>
</div>
<div class="col-12"><q-separator /></div>
<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">
{{
dataDetail.oligarchReject
? dataDetail.oligarchRejectReason
: dataDetail.oligarchApproveReason
}}
</div>
</div>
</div>
</div>
</q-card>
<!-- แกไขขอมลเพอลงบญชแนบทาย -->
<q-card bordered class="row col-12 text-dark q-mt-sm">
<q-form
ref="myForm"
greedy
@submit.prevent
@validation-success="onSubmitAttached"
class="full-width"
2024-11-08 15:34:22 +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>
<q-space />
<div
v-if="
!checkRoutePermisson &&
isStaff &&
dataDetail.statusMain === 'WAITTING'
"
>
2024-11-08 15:34:22 +07:00
<div class="q-gutter-sm" v-if="!edit">
<q-btn
outline
color="primary"
dense
icon-right="mdi-file-edit-outline"
class="q-px-sm"
label="แก้ไข"
style="width: 80px"
@click="edit = !edit"
v-if="!(status == 'REPORT' || status == 'DONE')"
/>
</div>
<div class="q-gutter-sm" v-else>
<q-btn
outline
color="public"
dense
class="q-px-sm"
label="บันทึก"
style="width: 80px"
type="submit"
/>
<q-btn
outline
color="red"
dense
class="q-px-sm"
label="ยกเลิก"
style="width: 80px"
@click="clickCancel"
/>
</div>
</div>
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-md">
<div class="col-12 row bg-white q-col-gutter-md">
<div class="col-xs-12 row items-center">
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="organizationPositionOld"
:rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่ง/สังกัดเดิม'}`]"
hide-bottom-space
:label="`${'ตำแหน่ง/สังกัดเดิม'}`"
type="textarea"
/>
</div>
</div>
<div class="col-xs-6 col-sm-4 row">
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionTypeOld"
:rules="[(val:string) => !!val || `${'กรุณากรอกกลุ่มงาน'}`]"
2024-11-08 15:34:22 +07:00
hide-bottom-space
:label="`${'กลุ่มงาน'}`"
2024-11-08 15:34:22 +07:00
/>
</div>
</div>
<div class="col-xs-6 col-sm-4 row">
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionLevelOld"
2025-02-25 11:37:37 +07:00
:rules="[(val:string) => !!val || `${'กรุณากรอกระดับชั้นงาน'}`]"
2024-11-08 15:34:22 +07:00
hide-bottom-space
2025-02-25 11:37:37 +07:00
:label="`${'ระดับชั้นงาน'}`"
2024-11-08 15:34:22 +07:00
/>
</div>
</div>
<div class="col-xs-6 col-sm-4 row">
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="posNo"
:rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่'}`]"
hide-bottom-space
:label="`${'เลขที่'}`"
/>
</div>
</div>
<!-- <div class="col-xs-6 col-sm-3 row">
<div class="col-12">
<q-input
v-model="salary"
:outlined="edit"
dense
:readonly="!edit"
:borderless="!edit"
hide-bottom-space
:label="`${'เงินเดือน'}`"
:rules="[(val:number) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
lazy-rules
:class="getClass(edit)"
mask="###,###,###,###"
reverse-fill-mask
/>
</div>
</div> -->
<div class="col-12"><q-separator /></div>
<div class="col-xs-4 row">
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="location"
:rules="[
(val:string) => !!val || `${'กรุณากรอกสถานที่ยื่นขอลาออกจากราชการ'}`,
]"
hide-bottom-space
:label="`${'สถานที่ยื่นขอลาออกจากราชการ'}`"
/>
</div>
</div>
<div class="col-xs-4 row">
<div class="col-12">
<datepicker
menu-class-name="modalfix"
:readonly="!edit"
v-model="date"
:locale="'th'"
autoApply
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:readonly="!edit"
:class="getClass(edit)"
:outlined="edit"
dense
:borderless="!edit"
:model-value="date !== null ? date2Thai(date) : null"
:rules="edit ? [
2024-11-08 15:34:22 +07:00
(val:string) =>
!!val || `${'กรุณาเลือก วันที่ยื่นขอลาออกจากราชการ'}`,
] : []"
2024-11-08 15:34:22 +07:00
hide-bottom-space
:label="`${' วันที่ยื่นขอลาออกจากราชการ'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="reason"
:rules="[
(val:string) => !!val || `${'กรุณากรอกเหตุผลที่ลาออกจากราชการ'}`,
]"
hide-bottom-space
:label="`${'เหตุผลที่ลาออกจากราชการ (หมายเหตุแนวตั้ง)'}`"
type="textarea"
/>
</div>
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="remarkHorizontal"
:rules="[(val:string) => !!val || `${'กรุณากรอกหมายเหตุแนวนอน '}`]"
hide-bottom-space
:label="`${'หมายเหตุแนวนอน '}`"
type="textarea"
/>
</div>
</div>
</div>
</q-form>
</q-card>
<!-- <WorkFlow
ref="workflowRef"
v-model:is-check-data="isCheckData"
:id="id"
2024-11-15 10:24:53 +07:00
sys-name="SYS_RESIGN"
2024-11-08 15:34:22 +07:00
/> -->
</div>
<q-dialog v-model="modal" persistent>
<q-card style="width: 800px">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader
:tittle="`${actionPass ? 'อนุญาตการลาออก' : 'ยับยั้งการลาออก'}`"
:close="closeModal"
/>
<q-separator />
<q-card-section class="q-p-sm q-gutter-md">
<div class="col-xs-12 col-sm-12 col-md-12">
<q-input
hide-bottom-space
dense
outlined
lazy-rules
:rules="[(val:string) => !!val || 'กรุณากรอกความคิดเห็น/เหตุผล']"
v-model="reasonReign"
:label="`${'กรอกความคิดเห็น/เหตุผล'}`"
type="textarea"
class="inputgreen"
/>
</div>
<div class="col-xs-12 col-sm-12 col-md-12" v-if="!actionPass">
<datepicker
menu-class-name="modalfix"
v-model="dateBreak"
:locale="'th'"
autoApply
: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
dense
class="inputgreen"
:model-value="
dateBreak !== null ? date2Thai(dateBreak) : null
"
hide-bottom-space
:label="`${' วันสุดท้ายที่ยับยั้ง'}`"
:rules="[(val:string) => !!val || 'กรุณาเลือกวันที่']"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white text-teal">
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
<!-- <DialogFooter :editvisible="true" :save="conditionPopup" /> -->
</q-form>
</q-card>
</q-dialog>
<PopupPersonal
:modal="modalPersonal"
:id="personId"
@update:modal="updatemodalPersonal"
/>
</template>
<style lang="scss" scope>
.q-img {
border-radius: 5px;
height: 70px;
}
.text-top {
color: gray;
font-weight: 400;
padding-bottom: 3px;
}
.text-detail {
font-weight: 500;
}
</style>