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

View file

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

View file

@ -1,21 +1,23 @@
<script setup lang="ts">
import { ref, onMounted, computed, watch } from "vue";
import AddList from "../ListRetirement/AddList.vue";
import { useCounterMixin } from "@/stores/mixin";
import { ref, onMounted, computed } from "vue";
import { useQuasar, QForm } from "quasar";
import { useRoute } from "vue-router";
import { useRouter } from "vue-router";
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 DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
import AddList from "../ListRetirement/AddList.vue";
const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
/** Use */
const route = useRoute();
const router = useRouter();
const checkRoutePermisson = ref<boolean>(route.name == "retirementidDetail");
const $q = useQuasar();
const mixin = useCounterMixin();
@ -60,21 +62,12 @@ const visibleColumns = ref<string[]>([
"organizationOrganization",
"position",
"positionType",
// "organizationAgency",
// "organizationGovernmentAgency",
"positionNumber",
"govGroup",
"govOffice",
"organization",
// "bureau",
]);
/** Hook */
onMounted(() => {
retireld.value = retireld_params.toString();
fecthlistprofile(retireld.value);
});
/**
* งกนป Dialog
*/
@ -110,9 +103,6 @@ const fecthlistprofile = async (id: string) => {
positionNumber: e.posNo,
positionType: e.posTypeName,
positionLevel: e.posLevelName,
// organizationAgency: e.organizationAgency,
// organizationGovernmentAgency: e.organizationGovernmentAgency,
// bureau: e.oc,
reason: e.reason,
remove: e.remove,
root: e.root,
@ -185,26 +175,6 @@ const fecthlistprofile = async (id: string) => {
headerStyle: "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",
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();
await http
.get(config.API.reportRetireList(type, id), {
responseType: "blob",
})
.get(config.API.reportRetireList(type, id))
.then(async (res) => {
downloadFile(res, `${"รายชื่อผู้เกษียณอายุราชการ"}.${type}`);
const data = res.data.result;
await genReport(data, `รายชื่อผู้เกษียณอายุราชการ`, type);
hideLoader();
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
hideLoader();
});
};
// 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);
};
})
.finally(() => {});
}
//
const saveEdiitReport = (reason: string) => {
@ -429,6 +391,12 @@ function onclickViewinfo(id: string) {
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
/** Hook */
onMounted(() => {
retireld.value = retireld_params.toString();
fecthlistprofile(retireld.value);
});
</script>
<template>

View file

@ -147,7 +147,7 @@ onMounted(async () => {
const user = await tokenParsed();
if (user) {
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");
if (commander) {
roleUser.value = "commander";