เพิ่ม Popup ข้อมูลการพ้นจากราชการ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-01-24 15:28:07 +07:00
parent 671b878872
commit 4ef5be2e61
2 changed files with 130 additions and 63 deletions

View file

@ -0,0 +1,81 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRoute } from "vue-router";
import DialogHeader from "@/components/DialogHeader.vue";
const modal = defineModel<boolean>("modal", { required: true });
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
showLoader,
hideLoader,
messageError,
date2Thai,
pathRegistryEmp,
onSearchDataTable,
} = mixin;
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const profileId = ref<string>(route.params.id.toString()); //id profile
const data = ref<{ date: Date; type: string; reson: string; document: string }>(
{
date: new Date(),
type: "ออกจากราชการ",
reson: "พ้นจากราชการด้วยสาเหตุ : ออกจากราชการ",
document: "test",
}
);
</script>
<template>
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 30%">
<DialogHeader
tittle="ข้อมูลการพ้นจากราชการ"
:close="() => (modal = false)"
/>
<q-separator />
<q-card-section>
<div class="row">
<div class="col-12 column justify-center no-wrap">
<div class="row text-grey-6">
<div class="col-6">นเดอนปนจากราชการ</div>
<div class="col-6">ประเภทการพนจากราชการ</div>
</div>
<div class="row">
<div class="col-6">
{{ data.date ? date2Thai(data.date) : "-" }}
</div>
<div class="col-6">{{ data.type ? data.type : "-" }}</div>
</div>
<div class="row q-mt-md text-grey-6">
<div class="col-12">สาเหต /เหตผล</div>
</div>
<div class="row">
<div class="col-12">{{ data.reson ? data.reson : "-" }}</div>
</div>
<div class="row q-mt-md text-grey-6">
<div class="col-12">คำส /เอกสารอางอ</div>
</div>
<div class="row">
<div class="col-12">
{{ data.document ? data.document : "-" }}
</div>
</div>
</div>
</div>
</q-card-section>
</q-card>
</q-dialog>
</template>

View file

@ -16,25 +16,20 @@ import axios from "axios";
import genReport from "@/plugins/genreport"; import genReport from "@/plugins/genreport";
import avatar from "@/assets/avatar_user.jpg"; import avatar from "@/assets/avatar_user.jpg";
/** /** importType*/
* importType
*/
import type { import type {
DataOption, DataOption,
DataOptionSys, DataOptionSys,
} from "@/modules/04_registryPerson/interface/index/Main"; } from "@/modules/04_registryPerson/interface/index/Main";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile"; import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile";
/** /** importComponents*/
* importComponents
*/
import CardNotPermission from "@/components/CardNotPermission.vue"; import CardNotPermission from "@/components/CardNotPermission.vue";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import TabMain from "@/modules/04_registryPerson/components/detail/TabMain.vue"; import TabMain from "@/modules/04_registryPerson/components/detail/TabMain.vue";
import DialogRetired from "@/modules/04_registryPerson/components/DialogRetired.vue";
/** /** use*/
* use
*/
const $q = useQuasar(); const $q = useQuasar();
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
@ -67,6 +62,8 @@ const reasonDeath = ref(""); //เหตุผลการเสียชีว
const dialogImage = ref<boolean>(false); // const dialogImage = ref<boolean>(false); //
const formDetail = ref<ResponseObject>(); // const formDetail = ref<ResponseObject>(); //
const modalDialogRetired = ref<boolean>(false);
// //
const baseItemsMenu = ref<DataOptionSys[]>([ const baseItemsMenu = ref<DataOptionSys[]>([
{ {
@ -118,6 +115,7 @@ const itemsMenu = computed(() => {
return baseItemsMenu.value || []; return baseItemsMenu.value || [];
} }
}); });
// //
const itemsMenuEmployee = ref<DataOptionSys[]>([ const itemsMenuEmployee = ref<DataOptionSys[]>([
{ {
@ -162,7 +160,10 @@ function imageActive(n: any) {
activeImage.value = n; activeImage.value = n;
} }
// /**
* งกนสำหรบปรบขนาดภาพ
* @param file ไฟล
*/
function resizeImage(file: File): Promise<File> { function resizeImage(file: File): Promise<File> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const img = new Image(); const img = new Image();
@ -224,9 +225,7 @@ function resizeImage(file: File): Promise<File> {
const newProfileFile = ref<any>(null); const newProfileFile = ref<any>(null);
/** /** ฟังก์ชันอัปโหลด*/
* งกนอปโหลด
*/
async function uploadImg() { async function uploadImg() {
showLoader(); showLoader();
newProfileFile.value = await resizeImage(profileFile.value); newProfileFile.value = await resizeImage(profileFile.value);
@ -266,6 +265,8 @@ async function uploadProfile(path: string) {
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
})
.finally(() => {
hideLoader(); hideLoader();
}); });
} }
@ -347,9 +348,7 @@ const reasonOptions = ref<DataOption[]>([
}, },
]); ]);
/** /** ฟังก์ชันดึงข้อมูลส่วนต้ว*/
* งกนดงขอมลสวนต
*/
async function fetchDataPersonal() { async function fetchDataPersonal() {
showLoader(); showLoader();
await http await http
@ -400,7 +399,8 @@ async function fetchDataPersonal() {
} }
/** /**
* งกนดาวนโหลดไฟล "..7/..1 หร ประวแบบย * งกนดาวนโหลดไฟล "..7/..1 และประวแบบย
* @param type full === 'ก.พ.7/ก.ก.1', SHORT === 'ประวัติแบบย่อ'
*/ */
async function onClickDownloadKp7(type: string) { async function onClickDownloadKp7(type: string) {
showLoader(); showLoader();
@ -428,9 +428,7 @@ async function onClickDownloadKp7(type: string) {
}); });
} }
/** /** ฟังก์ชันออกคำสั่งช่วยราชการ*/
* งกนออกคำสงชวยราชการ
*/
function helpPost() { function helpPost() {
const formData = new FormData(); const formData = new FormData();
formData.append("id", profileId.value); formData.append("id", profileId.value);
@ -451,9 +449,7 @@ function helpPost() {
}); });
} }
/** /** ฟังก์ชันออกคำสั่งส่งตัวกลับ*/
* งกนออกคำสงสงตวกล
*/
function repatriationPost() { function repatriationPost() {
const formData = new FormData(); const formData = new FormData();
formData.append("id", profileId.value); formData.append("id", profileId.value);
@ -474,9 +470,7 @@ function repatriationPost() {
}); });
} }
/** /** ฟังก์ชันออกคำสั่งแต่งตังเลื่อน*/
* งกนออกคำสงแตงตงเลอน
*/
function appointPost() { function appointPost() {
const formData = new FormData(); const formData = new FormData();
formData.append("id", profileId.value); formData.append("id", profileId.value);
@ -497,9 +491,7 @@ function appointPost() {
}); });
} }
/** /** ฟังก์ชันออกคำสั่งถึงเเก่กรรม*/
* งกนออกคำสงถงเเกกรรม
*/
function clickPassaway() { function clickPassaway() {
dialogPassaway.value = true; dialogPassaway.value = true;
filePassaway.value = null; filePassaway.value = null;
@ -509,9 +501,7 @@ function clickPassaway() {
reasonDeath.value = ""; reasonDeath.value = "";
} }
/** /** ฟังก์ชันออกคำสั่งให้ออกจากราชการ*/
* งกนออกคำสงใหออกจากราชการ
*/
function outPost() { function outPost() {
const formData = new FormData(); const formData = new FormData();
formData.append("id", profileId.value); formData.append("id", profileId.value);
@ -536,9 +526,7 @@ function outPost() {
}); });
} }
/** /** ฟังก์ชันออกคำสั่งอื่นๆ*/
* งกนออกคำสงอนๆ
*/
function otherPost() { function otherPost() {
const formData = new FormData(); const formData = new FormData();
formData.append("id", profileId.value); formData.append("id", profileId.value);
@ -563,9 +551,7 @@ function otherPost() {
}); });
} }
/** /** ฟังก์ชันออกคำสั่งปรับระดับชั้นงาน - ย้าย*/
* งกนออกคำสงปรบระดบชนงาน - าย
*/
function appointEmployeePost() { function appointEmployeePost() {
const formData = new FormData(); const formData = new FormData();
formData.append("id", profileId.value); formData.append("id", profileId.value);
@ -586,9 +572,7 @@ function appointEmployeePost() {
}); });
} }
/** /** ฟังก์ชันยืนยันบันทึกข้อมูลถึงแก่กรรม*/
* งกนยนยนบนทกขอมลถงแกกรรม
*/
function clickSaveDeceased() { function clickSaveDeceased() {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
showLoader(); showLoader();
@ -617,25 +601,19 @@ function clickSaveDeceased() {
}); });
} }
/** /** ฟังก์ชันปืด popup ถึงแก่กรรม*/
* งกนป popup งแกกรรม
*/
function closePassaway() { function closePassaway() {
dialogPassaway.value = false; dialogPassaway.value = false;
} }
/** /** ฟังก์ชันเปืด popup เลือกรูปภาพ*/
* งกนเป popup เลอกรปภาพ
*/
function openDialogImg() { function openDialogImg() {
dialogImage.value = true; dialogImage.value = true;
getImage(); getImage();
} }
/** /** ฟังก์ชันเรียกข้อมูลรูป*/
* งกนเรยกขอมลร async function getImage() {
*/
function getImage() {
showLoader(); showLoader();
http http
.get(config.API.orgProfileAvatar + `/${profileId.value}`) .get(config.API.orgProfileAvatar + `/${profileId.value}`)
@ -656,8 +634,8 @@ function getImage() {
} }
/** /**
* งกนเรยกขอมลร * งกนเรยกขอมลรายการร
* @param dataList * @param dataList อม
*/ */
async function getImg(dataList: any) { async function getImg(dataList: any) {
await http await http
@ -676,9 +654,7 @@ async function getImg(dataList: any) {
}); });
} }
/** /** ฟังก์ชันปิด Popup เลือกรูปภาพ*/
* งกนป Popup เลอกรปภาพ
*/
function closeImage() { function closeImage() {
dialogImage.value = false; dialogImage.value = false;
images.value = []; images.value = [];
@ -696,10 +672,10 @@ function deletePhoto(id: string) {
showLoader(); showLoader();
http http
.delete(config.API.orgProfileAvatar + `/${id}`) .delete(config.API.orgProfileAvatar + `/${id}`)
.then((res) => { .then(async () => {
await getImage();
images.value = []; images.value = [];
imagesAlldata.value = []; imagesAlldata.value = [];
getImage();
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -712,9 +688,7 @@ function deletePhoto(id: string) {
); );
} }
/** /** ฟังก์ชันยืนยันการเลือกรูป*/
* งกนยนยนการเลอกร
*/
function selectAvatarHistory() { function selectAvatarHistory() {
if (activeImage.value == null) { if (activeImage.value == null) {
dialogMessageNotify($q, "กรุณาเลือกรูปที่ต้องการเปลี่ยน"); dialogMessageNotify($q, "กรุณาเลือกรูปที่ต้องการเปลี่ยน");
@ -781,7 +755,7 @@ onMounted(async () => {
/> />
{{ {{
route.name === "registry-employeeId" route.name === "registry-employeeId"
? " ทะเบียนประวัติลูกจ้างชั่วคราว" ? "ทะเบียนประวัติลูกจ้างชั่วคราว"
: "ทะเบียนประวัติ" : "ทะเบียนประวัติ"
}} }}
</div> </div>
@ -789,7 +763,6 @@ onMounted(async () => {
<div v-if="isPermission"> <div v-if="isPermission">
<!-- list menu ของขาราชการฯ --> <!-- list menu ของขาราชการฯ -->
<q-btn-dropdown <q-btn-dropdown
v-if=" v-if="
(!storeRegistry.isLeave && (!storeRegistry.isLeave &&
@ -934,6 +907,16 @@ onMounted(async () => {
}${formDetail.firstName} ${formDetail.lastName}` }${formDetail.firstName} ${formDetail.lastName}`
}} }}
<span class="text-red"> {{ leaveReason }}</span> <span class="text-red"> {{ leaveReason }}</span>
<q-btn
v-if="leaveReason"
flat
round
color="info"
icon="info"
@click.stop.prevent="modalDialogRetired = true"
>
<q-tooltip>อมลการพนจากราชการ</q-tooltip>
</q-btn>
</h2> </h2>
</div> </div>
</div> </div>
@ -1201,6 +1184,9 @@ onMounted(async () => {
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
<!-- Dialog อมลการพนจากราชการ -->
<DialogRetired v-model:modal="modalDialogRetired" />
</template> </template>
<style scoped> <style scoped>