2023-09-19 17:42:17 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
|
|
import { useQuasar } from "quasar";
|
|
|
|
|
import { ref, onMounted } from "vue";
|
|
|
|
|
import http from "@/plugins/http";
|
|
|
|
|
import config from "@/app.config";
|
2024-05-03 13:24:48 +07:00
|
|
|
|
|
|
|
|
/** importType*/
|
|
|
|
|
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
|
|
|
|
|
import type { ResDetailDeceased } from "@/modules/06_retirement/interface/response/Deceased";
|
|
|
|
|
|
|
|
|
|
/** importComponents*/
|
|
|
|
|
import CardProfile from "@/components/CardProfile.vue";
|
|
|
|
|
|
|
|
|
|
/** importStore*/
|
|
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
2024-08-16 15:40:06 +07:00
|
|
|
import { checkPermission } from "@/utils/permissions";
|
|
|
|
|
|
|
|
|
|
import genReport from "@/plugins/genreport";
|
2024-05-03 13:24:48 +07:00
|
|
|
|
2023-11-17 14:21:53 +07:00
|
|
|
/**use*/
|
2023-09-19 17:42:17 +07:00
|
|
|
const $q = useQuasar();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const mixin = useCounterMixin();
|
|
|
|
|
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
|
|
|
|
|
const fullName = ref<string>("");
|
|
|
|
|
const profileId = ref<string>(route.params.id.toString());
|
2024-05-03 13:24:48 +07:00
|
|
|
const detail = ref<ResDetailDeceased>();
|
|
|
|
|
|
|
|
|
|
const dataProfile = ref<DataProfile>();
|
2023-09-19 17:42:17 +07:00
|
|
|
|
2023-11-17 14:21:53 +07:00
|
|
|
/** Hook */
|
2023-09-19 17:42:17 +07:00
|
|
|
onMounted(() => {
|
2024-05-03 13:24:48 +07:00
|
|
|
fetchData();
|
2023-09-19 17:42:17 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//นำข้อมูลจาก API มาแสดง
|
2024-05-03 13:24:48 +07:00
|
|
|
const fetchData = async () => {
|
2023-09-19 17:42:17 +07:00
|
|
|
showLoader();
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.detailDeceased(profileId.value))
|
|
|
|
|
.then((res) => {
|
|
|
|
|
const data = res.data.result;
|
2024-05-03 13:24:48 +07:00
|
|
|
dataProfile.value = data as DataProfile;
|
2023-09-19 17:42:17 +07:00
|
|
|
detail.value = data;
|
2024-05-03 13:24:48 +07:00
|
|
|
console.log(detail.value?.firstName);
|
|
|
|
|
|
2023-09-19 17:42:17 +07:00
|
|
|
fullName.value = `${data.prefix}${data.firstName} ${data.lastName}`;
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//เปิดdetail ของ deceased
|
|
|
|
|
const openDeceased = (id: string) => {
|
2024-08-01 14:44:43 +07:00
|
|
|
router.push(`/retirement/deceased/detail/${id}`);
|
2023-09-19 17:42:17 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//ไปหน้าถัดไป
|
|
|
|
|
const nextPage = (page: string) => {
|
|
|
|
|
window.open(page, "_blank");
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-17 14:21:53 +07:00
|
|
|
/**
|
|
|
|
|
* ฟังก์ชั่น ดาว์โหลด
|
|
|
|
|
* @param type typeของรายละเอียด
|
|
|
|
|
*/
|
2023-09-19 17:42:17 +07:00
|
|
|
const fileDownload = async (type: string) => {
|
|
|
|
|
showLoader();
|
|
|
|
|
await http
|
2024-08-16 15:40:06 +07:00
|
|
|
.get(config.API.DeceasedReport(type, profileId.value))
|
2023-09-19 17:42:17 +07:00
|
|
|
.then((res) => {
|
2024-08-16 15:40:06 +07:00
|
|
|
const data = res.data.result;
|
|
|
|
|
genReport(
|
|
|
|
|
data,
|
|
|
|
|
`รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม-${fullName.value}`,
|
|
|
|
|
type
|
2023-09-19 17:42:17 +07:00
|
|
|
);
|
|
|
|
|
})
|
2024-06-14 11:06:31 +07:00
|
|
|
.catch(async (e) => {
|
|
|
|
|
messageError($q, JSON.parse(await e.response.data.text()));
|
2023-09-19 17:42:17 +07:00
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
2023-08-08 16:50:50 +07:00
|
|
|
<template>
|
|
|
|
|
<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"
|
2024-08-01 14:44:43 +07:00
|
|
|
@click="router.push(`/retirement/deceased`)"
|
2023-08-08 16:50:50 +07:00
|
|
|
/>
|
2023-10-06 10:10:50 +07:00
|
|
|
รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม {{ fullName }}
|
2023-08-08 16:50:50 +07:00
|
|
|
</div>
|
2024-05-03 13:24:48 +07:00
|
|
|
|
|
|
|
|
<CardProfile :data="dataProfile as DataProfile" />
|
2023-08-08 16:50:50 +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>
|
|
|
|
|
<q-space />
|
|
|
|
|
<div class="q-gutter-x-sm">
|
|
|
|
|
<q-btn
|
|
|
|
|
flat
|
|
|
|
|
outline
|
|
|
|
|
color="red"
|
|
|
|
|
dense
|
|
|
|
|
icon-right="mdi-file-pdf"
|
|
|
|
|
class="q-px-sm"
|
2023-09-01 11:51:12 +07:00
|
|
|
@click="fileDownload('pdf')"
|
2023-08-08 16:50:50 +07:00
|
|
|
/>
|
|
|
|
|
<q-btn
|
|
|
|
|
flat
|
|
|
|
|
outline
|
|
|
|
|
color="blue"
|
|
|
|
|
dense
|
|
|
|
|
icon-right="mdi-file-word"
|
|
|
|
|
class="q-px-sm"
|
2023-09-01 11:51:12 +07:00
|
|
|
@click="fileDownload('docx')"
|
2023-08-08 16:50:50 +07:00
|
|
|
/>
|
|
|
|
|
</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-center">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="col-12 text-top">เลขที่ใบมรณบัตร</div>
|
|
|
|
|
<div class="col-12 text-detail">
|
2024-05-03 13:24:48 +07:00
|
|
|
{{ detail?.number }}
|
2023-08-08 16:50:50 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-6 col-sm-3 row items-center">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="col-12 text-top">สถานที่ออกใบมรณบัตร</div>
|
2024-05-03 13:24:48 +07:00
|
|
|
<div class="col-12 text-detail">{{ detail?.location }}</div>
|
2023-08-08 16:50:50 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-6 col-sm-3 row items-center">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="col-12 text-top">เหตุผลการเสียชีวิต</div>
|
2024-05-03 13:24:48 +07:00
|
|
|
<div class="col-12 text-detail">{{ detail?.reason }}</div>
|
2023-08-08 16:50:50 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-6 col-sm-3 row items-center">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="col-12 text-top">วันที่เสียชีวิต</div>
|
2024-05-03 13:24:48 +07:00
|
|
|
<div class="col-12 text-detail">
|
|
|
|
|
{{ detail?.date ? date2Thai(detail?.date) : "-" }}
|
|
|
|
|
</div>
|
2023-08-08 16:50:50 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-6 col-sm-3 row items-center">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="col-12 text-top">ใบมรณบัตร</div>
|
|
|
|
|
<div class="col-12 text-detail">
|
|
|
|
|
<q-btn
|
|
|
|
|
flat
|
|
|
|
|
round
|
|
|
|
|
color="red"
|
|
|
|
|
icon="mdi-file-pdf"
|
2024-05-03 13:24:48 +07:00
|
|
|
@click="detail?.pathName ? nextPage(detail?.pathName) : null"
|
2023-08-08 16:50:50 +07:00
|
|
|
>
|
|
|
|
|
<q-tooltip>ใบมรณบัตร</q-tooltip></q-btn
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-05-03 13:24:48 +07:00
|
|
|
</div>
|
2023-09-01 11:51:12 +07:00
|
|
|
|
2024-08-16 15:40:06 +07:00
|
|
|
<div class="col-12" v-if="checkPermission($route)?.attrIsUpdate">
|
2024-05-03 13:24:48 +07:00
|
|
|
<div class="row">
|
|
|
|
|
<q-space />
|
|
|
|
|
<q-btn
|
|
|
|
|
color="public"
|
|
|
|
|
label="ส่งหนังสือเวียน"
|
|
|
|
|
@click="openDeceased(profileId)"
|
|
|
|
|
/>
|
2023-09-01 11:51:12 +07:00
|
|
|
</div>
|
2023-08-08 16:50:50 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
</template>
|
2023-09-01 11:51:12 +07:00
|
|
|
|
2023-08-08 16:50:50 +07:00
|
|
|
<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;
|
|
|
|
|
}
|
|
|
|
|
.custom-header-table {
|
|
|
|
|
max-height: 64vh;
|
|
|
|
|
|
|
|
|
|
.q-table tr:nth-child(odd) td {
|
|
|
|
|
background: white;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table tr:nth-child(even) td {
|
|
|
|
|
background: #f8f8f8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table thead tr {
|
|
|
|
|
background: #ecebeb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table thead tr th {
|
|
|
|
|
position: sticky;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* this will be the loading indicator */
|
|
|
|
|
.q-table thead tr:last-child th {
|
|
|
|
|
/* height of all previous header rows */
|
|
|
|
|
top: 48px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table thead tr:first-child th {
|
|
|
|
|
top: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|