Refactoring code module 06_retirement

This commit is contained in:
STW_TTTY\stwtt 2024-09-18 15:18:57 +07:00
parent 1225254062
commit ea921b39b0
29 changed files with 730 additions and 823 deletions

View file

@ -2,21 +2,18 @@
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";
import genReport from "@/plugins/genreport";
/** 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";
import { checkPermission } from "@/utils/permissions";
import genReport from "@/plugins/genreport";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
import type { ResDetailDeceased } from "@/modules/06_retirement/interface/response/Deceased";
import CardProfile from "@/components/CardProfile.vue";
/**use*/
const $q = useQuasar();
@ -30,13 +27,8 @@ const detail = ref<ResDetailDeceased>();
const dataProfile = ref<DataProfile>();
/** Hook */
onMounted(() => {
fetchData();
});
// API
const fetchData = async () => {
/** นำข้อมูลจาก API มาแสดง */
async function fetchData() {
showLoader();
await http
.get(config.API.detailDeceased(profileId.value))
@ -52,23 +44,23 @@ const fetchData = async () => {
.finally(() => {
hideLoader();
});
};
}
//detail deceased
const openDeceased = (id: string) => {
/** เปิดdetail ของ deceased */
function openDeceased(id: string) {
router.push(`/retirement/deceased/detail/${id}`);
};
}
//
const nextPage = (page: string) => {
/** ไปหน้าถัดไป */
function nextPage(page: string) {
window.open(page, "_blank");
};
}
/**
* งก ดาวโหลด
* @param type typeของรายละเอยด
*/
const fileDownload = async (type: string) => {
async function fileDownload(type: string) {
showLoader();
await http
.get(config.API.DeceasedReport(type, profileId.value))
@ -86,7 +78,12 @@ const fileDownload = async (type: string) => {
hideLoader();
})
.finally(() => {});
};
}
/** Hook */
onMounted(() => {
fetchData();
});
</script>
<template>