แก้ report

This commit is contained in:
STW_TTTY\stwtt 2024-09-12 11:37:34 +07:00
parent f65eab4e5e
commit b640c7cf0c
4 changed files with 40 additions and 79 deletions

View file

@ -189,7 +189,7 @@ const SaveData = async () => {
const fecthlistRecevice = async () => { const fecthlistRecevice = async () => {
showLoader(); showLoader();
await http await http
.get(config.API.receiveData()) .get(config.API.receiveData()+`?keyword=`)
.then((res: any) => { .then((res: any) => {
const response = res.data.result; const response = res.data.result;
@ -378,7 +378,7 @@ onMounted(() => {
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
:filter="filterKeyword" :filter="filterKeyword"
row-key="fullname" row-key="id"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -8,6 +8,7 @@ import { checkPermission } from "@/utils/permissions";
// import CurrencyInput from "@/components/CurruncyInput.vue"; // import CurrencyInput from "@/components/CurruncyInput.vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import genReport from "@/plugins/genreport";
import type { QTableProps, QForm } from "quasar"; import type { QTableProps, QForm } from "quasar";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main"; import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
@ -16,6 +17,7 @@ import type {
ResponseDataDetail, ResponseDataDetail,
rowFile, rowFile,
} from "@/modules/05_placement/interface/response/Transfer"; } from "@/modules/05_placement/interface/response/Transfer";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue"; import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import CardProfile from "@/components/CardProfile.vue"; import CardProfile from "@/components/CardProfile.vue";
import { tokenParsed } from "@/plugins/auth"; import { tokenParsed } from "@/plugins/auth";
@ -67,31 +69,22 @@ const responseData = ref<ResponseDataDetail>({
status: "", status: "",
fullname: "", fullname: "",
}); });
const downloadFile = (response: any, filename: string) => {
const link = document.createElement("a"); async function fileDownload(no: number, type: string, fileName: string) {
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
const fileDownload = async (no: number, type: string, fileName: string) => {
showLoader(); showLoader();
await http await http
.get(config.API.reportTransferFile(no, type, id.value), { .get(config.API.reportTransferFile(no, type, id.value))
responseType: "blob",
})
.then(async (res) => { .then(async (res) => {
downloadFile(res, `${fileName}.${type}`); const data = res.data.result;
await genReport(data, fileName, type);
hideLoader();
}) })
.catch(async (e) => { .catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text())); messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
hideLoader(); hideLoader();
}); })
}; .finally(() => {});
}
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {

View file

@ -1,21 +1,23 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, computed, watch } from "vue"; import { ref, onMounted, computed } from "vue";
import AddList from "../ListRetirement/AddList.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, QForm } from "quasar"; import { useQuasar, QForm } from "quasar";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { useRouter } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import genReport from "@/plugins/genreport";
import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; import DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue"; import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
import AddList from "../ListRetirement/AddList.vue";
const modalPersonal = ref<boolean>(false); const modalPersonal = ref<boolean>(false);
const personId = ref<string>(""); const personId = ref<string>("");
/** Use */ /** Use */
const route = useRoute(); const route = useRoute();
const router = useRouter();
const checkRoutePermisson = ref<boolean>(route.name == "retirementidDetail"); const checkRoutePermisson = ref<boolean>(route.name == "retirementidDetail");
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
@ -60,21 +62,12 @@ const visibleColumns = ref<string[]>([
"organizationOrganization", "organizationOrganization",
"position", "position",
"positionType", "positionType",
// "organizationAgency",
// "organizationGovernmentAgency",
"positionNumber", "positionNumber",
"govGroup", "govGroup",
"govOffice", "govOffice",
"organization", "organization",
// "bureau",
]); ]);
/** Hook */
onMounted(() => {
retireld.value = retireld_params.toString();
fecthlistprofile(retireld.value);
});
/** /**
* งกนป Dialog * งกนป Dialog
*/ */
@ -110,9 +103,6 @@ const fecthlistprofile = async (id: string) => {
positionNumber: e.posNo, positionNumber: e.posNo,
positionType: e.posTypeName, positionType: e.posTypeName,
positionLevel: e.posLevelName, positionLevel: e.posLevelName,
// organizationAgency: e.organizationAgency,
// organizationGovernmentAgency: e.organizationGovernmentAgency,
// bureau: e.oc,
reason: e.reason, reason: e.reason,
remove: e.remove, remove: e.remove,
root: e.root, root: e.root,
@ -185,26 +175,6 @@ const fecthlistprofile = async (id: string) => {
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
// {
// name: "organizationAgency",
// align: "left",
// label: " (//)",
// title: "",
// subtitle: "//",
// field: "organizationAgency",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
// {
// name: "organizationGovernmentAgency",
// align: "left",
// label: " (//)",
// title: "",
// subtitle: "//",
// field: "organizationGovernmentAgency",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
{ {
name: "organization", name: "organization",
align: "left", align: "left",
@ -349,34 +319,26 @@ const uploadFile = async (event: any, signDate: any) => {
} }
}; };
// downloadAttachment /**
const downloadAttachment = async (type: string, id: string) => { * ดาวหโหลด ไฟล
* @param type pdf/docx
* @param id
*/
async function downloadAttachment(type: string, id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.reportRetireList(type, id), { .get(config.API.reportRetireList(type, id))
responseType: "blob",
})
.then(async (res) => { .then(async (res) => {
downloadFile(res, `${"รายชื่อผู้เกษียณอายุราชการ"}.${type}`); const data = res.data.result;
await genReport(data, `รายชื่อผู้เกษียณอายุราชการ`, type);
hideLoader();
}) })
.catch(async (e) => { .catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text())); messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
hideLoader(); hideLoader();
}); })
}; .finally(() => {});
}
// downloadFile
const downloadFile = (response: any, filename: string) => {
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
// //
const saveEdiitReport = (reason: string) => { const saveEdiitReport = (reason: string) => {
@ -429,6 +391,12 @@ function onclickViewinfo(id: string) {
function updatemodalPersonal(modal: boolean) { function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal; modalPersonal.value = modal;
} }
/** Hook */
onMounted(() => {
retireld.value = retireld_params.toString();
fecthlistprofile(retireld.value);
});
</script> </script>
<template> <template>

View file

@ -147,7 +147,7 @@ onMounted(async () => {
const user = await tokenParsed(); const user = await tokenParsed();
if (user) { if (user) {
const commander = await user.role.includes("commander"); const commander = await user.role.includes("commander");
const oligarch = await kuser.role.includes("oligarch"); const oligarch = await user.role.includes("oligarch");
const officer = await user.role.includes("officer"); const officer = await user.role.includes("officer");
if (commander) { if (commander) {
roleUser.value = "commander"; roleUser.value = "commander";