report evaluate
This commit is contained in:
parent
d71f87a17b
commit
dc437a8ade
3 changed files with 434 additions and 0 deletions
|
|
@ -18,6 +18,11 @@ const reportInsignia = () =>
|
||||||
const reportExam = () =>
|
const reportExam = () =>
|
||||||
import("@/modules/03_recruiting/views/01_compete/CompeteReport.vue");
|
import("@/modules/03_recruiting/views/01_compete/CompeteReport.vue");
|
||||||
|
|
||||||
|
const ReportEvaluate = () =>
|
||||||
|
import("@/modules/21_report/views/04_reportEvaluate.vue");
|
||||||
|
const ReportSalary = () =>
|
||||||
|
import("@/modules/21_report/views/05_reportSalary.vue");
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
path: "/report/org",
|
path: "/report/org",
|
||||||
|
|
@ -129,4 +134,24 @@ export default [
|
||||||
Role: "STAFF",
|
Role: "STAFF",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/report/evaluate",
|
||||||
|
name: "reportEvaluate",
|
||||||
|
component: ReportEvaluate,
|
||||||
|
meta: {
|
||||||
|
Auth: true,
|
||||||
|
Key: "REPORT_EVALUATE",
|
||||||
|
Role: "STAFF",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/report/salary",
|
||||||
|
name: "reportSalary",
|
||||||
|
component: ReportSalary,
|
||||||
|
meta: {
|
||||||
|
Auth: true,
|
||||||
|
Key: "REPORT_SALARY",
|
||||||
|
Role: "STAFF",
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
402
src/modules/21_report/views/04_reportEvaluate.vue
Normal file
402
src/modules/21_report/views/04_reportEvaluate.vue
Normal file
|
|
@ -0,0 +1,402 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
import genReportXLSX from "@/plugins/genreportxlsx";
|
||||||
|
import { useStructureTree } from "@/stores/structureTree";
|
||||||
|
import { checkPermission } from "@/utils/permissions";
|
||||||
|
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
|
import type { DataStructureTree } from "@/interface/main";
|
||||||
|
|
||||||
|
import LoadView from "@/components/LoadView.vue";
|
||||||
|
|
||||||
|
const $q = useQuasar();
|
||||||
|
const { fetchStructureTree } = useStructureTree();
|
||||||
|
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||||
|
|
||||||
|
const loadingBtn = ref<boolean>(false);
|
||||||
|
|
||||||
|
const filterTree = ref<string>("");
|
||||||
|
const nodeId = ref<string>("");
|
||||||
|
const nodeName = ref<string>("");
|
||||||
|
const node = ref<DataStructureTree[]>([]);
|
||||||
|
|
||||||
|
const year = ref<number>(new Date().getFullYear());
|
||||||
|
const splitterModel = ref(14);
|
||||||
|
|
||||||
|
const detailReport = ref<any>();
|
||||||
|
|
||||||
|
const numOfPages = ref<number>(0);
|
||||||
|
const page = ref<number>(1);
|
||||||
|
const pdfSrc = ref<any>();
|
||||||
|
|
||||||
|
async function fetchDataTree() {
|
||||||
|
const dataTree = await fetchStructureTree("SYS_EVA_REQ", true);
|
||||||
|
if (dataTree) {
|
||||||
|
const data = dataTree.map((item: DataStructureTree) => ({
|
||||||
|
...item,
|
||||||
|
children: null,
|
||||||
|
}));
|
||||||
|
node.value = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchReport() {
|
||||||
|
loadingBtn.value = true;
|
||||||
|
await http
|
||||||
|
.get(
|
||||||
|
config.API.evaluationReport +
|
||||||
|
`?year=${year.value + 543}&rootId=${nodeId.value}`
|
||||||
|
)
|
||||||
|
.then(async (res) => {
|
||||||
|
const data = await res.data.result;
|
||||||
|
await fetchDocumentTemplate(data);
|
||||||
|
detailReport.value = data;
|
||||||
|
// const org = organizationOpsMain.value.find((item: DataOption) => {
|
||||||
|
// item.id == organization.value;
|
||||||
|
// });
|
||||||
|
// genReportXLSX(
|
||||||
|
// data,
|
||||||
|
// org
|
||||||
|
// ? `รายงานสรุปจำนวนผลงานการประเมิน_${org.name ? org.name : "ทั้งหมด"}`
|
||||||
|
// : "รายงานสรุปจำนวนผลงานการประเมิน",
|
||||||
|
// "pdf"
|
||||||
|
// );
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loadingBtn.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เรียกไฟล์ PDF
|
||||||
|
* @param data ข้อมูลบัญชีวันลา
|
||||||
|
*/
|
||||||
|
async function fetchDocumentTemplate(data: any) {
|
||||||
|
await axios
|
||||||
|
.post(`${config.API.reportTemplate}/xlsx`, data, {
|
||||||
|
headers: {
|
||||||
|
accept: "application/pdf",
|
||||||
|
"content-Type": "application/json",
|
||||||
|
},
|
||||||
|
responseType: "blob",
|
||||||
|
})
|
||||||
|
.then(async (res) => {
|
||||||
|
const blob = new Blob([res.data]);
|
||||||
|
const objectUrl = URL.createObjectURL(blob);
|
||||||
|
const pdfData = usePDF(`${objectUrl}`);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
pdfSrc.value = pdfData.pdf.value;
|
||||||
|
numOfPages.value = pdfData.pages.value;
|
||||||
|
}, 1500);
|
||||||
|
})
|
||||||
|
.catch(async (e) => {
|
||||||
|
messageError($q, JSON.parse(await e.response.data.text()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDownloadFile(type: string) {
|
||||||
|
genReportXLSX(
|
||||||
|
detailReport.value,
|
||||||
|
`รายงานสรุปจำนวนผลงานการประเมิน_${nodeName.value}`,
|
||||||
|
type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เลือกหน่วยงาน
|
||||||
|
* @param id id หน่วยงาน
|
||||||
|
* @param level ระดับหน่วยงาน
|
||||||
|
*/
|
||||||
|
function onSelectedNode(id: string, name: string) {
|
||||||
|
if (id !== nodeId.value) {
|
||||||
|
nodeId.value = id;
|
||||||
|
nodeName.value = name;
|
||||||
|
fetchReport();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** กลับหน้าก่อนหน้าของรายงาน */
|
||||||
|
function backPage() {
|
||||||
|
if (page.value !== 1) {
|
||||||
|
page.value--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ไปหน้าต่อไปของรายงาน */
|
||||||
|
function nextPage() {
|
||||||
|
if (page.value < numOfPages.value) {
|
||||||
|
page.value++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchDataTree();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="toptitle text-dark col-12 row items-center">
|
||||||
|
รายงานประเมินบุคคล
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="q-pa-sm q-gutter-sm">
|
||||||
|
<q-card flat bordered class="col-12">
|
||||||
|
<div class="row q-col-gutter-sm q-pa-sm">
|
||||||
|
<div class="row col-12">
|
||||||
|
<datepicker
|
||||||
|
menu-class-name="modalfix"
|
||||||
|
v-model="year"
|
||||||
|
:locale="'th'"
|
||||||
|
autoApply
|
||||||
|
year-picker
|
||||||
|
:enableTimePicker="false"
|
||||||
|
@update:model-value="fetchReport"
|
||||||
|
>
|
||||||
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
parseInt(value + 543)
|
||||||
|
}}</template>
|
||||||
|
<template #trigger>
|
||||||
|
<q-input
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
:model-value="year === 0 ? 'ทั้งหมด' : Number(year) + 543"
|
||||||
|
:label="`${'ปีงบประมาณ'}`"
|
||||||
|
bg-color="white"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon
|
||||||
|
name="event"
|
||||||
|
class="cursor-pointer"
|
||||||
|
style="color: var(--q-primary)"
|
||||||
|
>
|
||||||
|
</q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
</datepicker>
|
||||||
|
|
||||||
|
<q-space />
|
||||||
|
<q-btn
|
||||||
|
:loading="loadingBtn"
|
||||||
|
:disable="!nodeId"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="primary"
|
||||||
|
icon="download"
|
||||||
|
v-if="checkPermission($route)?.attrIsGet"
|
||||||
|
>
|
||||||
|
<q-menu>
|
||||||
|
<q-list style="min-width: 150px">
|
||||||
|
<q-item
|
||||||
|
clickable
|
||||||
|
v-close-popup
|
||||||
|
@click.stop.pervent="onDownloadFile('pdf')"
|
||||||
|
>
|
||||||
|
<q-item-section avatar
|
||||||
|
><q-icon color="red" name="mdi-file-pdf"
|
||||||
|
/></q-item-section>
|
||||||
|
<q-item-section>ไฟล์ .pdf</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item
|
||||||
|
clickable
|
||||||
|
v-close-popup
|
||||||
|
@click.stop.pervent="onDownloadFile('xlsx')"
|
||||||
|
>
|
||||||
|
<q-item-section avatar
|
||||||
|
><q-icon color="green" name="mdi-file-excel"
|
||||||
|
/></q-item-section>
|
||||||
|
<q-item-section>ไฟล์ .xlsx</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
</q-menu>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-card>
|
||||||
|
|
||||||
|
<q-card flat bordered class="col-12">
|
||||||
|
<q-card-section :horizontal="$q.screen.gt.sm">
|
||||||
|
<q-card-section class="col-lg-3 col-md-4 col-xs-12 q-gutter-sm">
|
||||||
|
<div class="col">
|
||||||
|
<q-input dense outlined v-model="filterTree" label="ค้นหา">
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-icon name="search" />
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-white tree-container q-pa-xs">
|
||||||
|
<q-tree
|
||||||
|
dense
|
||||||
|
:nodes="node"
|
||||||
|
node-key="orgTreeId"
|
||||||
|
label-key="labelName"
|
||||||
|
:filter="filterTree.trim()"
|
||||||
|
no-results-label="ไม่พบข้อมูลที่ค้นหา"
|
||||||
|
no-nodes-label="ไม่มีข้อมูล"
|
||||||
|
>
|
||||||
|
<template v-slot:default-header="prop">
|
||||||
|
<q-item
|
||||||
|
@click.stop="
|
||||||
|
onSelectedNode(prop.node.orgTreeId, prop.node.orgTreeName)
|
||||||
|
"
|
||||||
|
:active="nodeId === prop.node.orgTreeId"
|
||||||
|
clickable
|
||||||
|
active-class="my-list-link text-primary text-weight-medium"
|
||||||
|
class="row col-12 items-center text-dark q-py-xs q-pl-sm rounded-borders my-list"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<div class="text-weight-medium">
|
||||||
|
{{ prop.node.orgTreeName }}
|
||||||
|
</div>
|
||||||
|
<div class="text-weight-light text-grey-8">
|
||||||
|
{{ prop.node.orgCode == null ? null : prop.node.orgCode }}
|
||||||
|
{{
|
||||||
|
prop.node.orgTreeShortName == null
|
||||||
|
? null
|
||||||
|
: prop.node.orgTreeShortName
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-tree>
|
||||||
|
</div>
|
||||||
|
</q-card-section>
|
||||||
|
|
||||||
|
<q-separator :vertical="$q.screen.gt.xs" />
|
||||||
|
|
||||||
|
<q-card-section class="col-lg-9 col-md-8 col-xs-12 scroll">
|
||||||
|
<q-splitter
|
||||||
|
horizontal
|
||||||
|
style="
|
||||||
|
height: 75vh;
|
||||||
|
border: 1px solid rgb(210, 210, 210);
|
||||||
|
border-radius: 5px;
|
||||||
|
"
|
||||||
|
before-class="overflow-hidden disable"
|
||||||
|
separator-class="bg-white disabled"
|
||||||
|
>
|
||||||
|
<template v-slot:before>
|
||||||
|
<div class="q-px-sm">
|
||||||
|
<div class="row items-start items-center">
|
||||||
|
<div class="col">
|
||||||
|
<q-btn
|
||||||
|
padding="xs"
|
||||||
|
icon="mdi-chevron-left"
|
||||||
|
color="grey-2"
|
||||||
|
text-color="grey-5"
|
||||||
|
size="md"
|
||||||
|
class="my-auto"
|
||||||
|
@click="backPage"
|
||||||
|
:disable="page == 1"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md-auto">
|
||||||
|
<div class="q-pa-md flex">
|
||||||
|
หน้าที่ {{ page }} จาก {{ numOfPages }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col text-right">
|
||||||
|
<q-btn
|
||||||
|
padding="xs"
|
||||||
|
icon="mdi-chevron-right"
|
||||||
|
color="grey-2"
|
||||||
|
text-color="grey-5"
|
||||||
|
size="md"
|
||||||
|
@click="nextPage"
|
||||||
|
:disable="page === numOfPages"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:after>
|
||||||
|
<div class="q-pa-md">
|
||||||
|
<LoadView v-if="loadingBtn" />
|
||||||
|
<VuePDF
|
||||||
|
v-else
|
||||||
|
ref="vuePDFRef"
|
||||||
|
:pdf="pdfSrc"
|
||||||
|
:page="page"
|
||||||
|
fit-parent
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:default>
|
||||||
|
<div class="q-pa-md">
|
||||||
|
<div class="row items-start items-center">
|
||||||
|
<div class="col">
|
||||||
|
<q-btn
|
||||||
|
padding="xs"
|
||||||
|
icon="mdi-chevron-left"
|
||||||
|
color="grey-2"
|
||||||
|
text-color="grey-5"
|
||||||
|
size="md"
|
||||||
|
class="my-auto"
|
||||||
|
@click="backPage"
|
||||||
|
:disable="page == 1"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 col-md-auto">
|
||||||
|
<div class="q-pa-md flex">
|
||||||
|
หน้าที่ {{ page }} จาก {{ numOfPages }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col text-right">
|
||||||
|
<q-btn
|
||||||
|
padding="xs"
|
||||||
|
icon="mdi-chevron-right"
|
||||||
|
color="grey-2"
|
||||||
|
text-color="grey-5"
|
||||||
|
size="md"
|
||||||
|
@click="nextPage"
|
||||||
|
:disable="page === numOfPages"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</q-splitter>
|
||||||
|
</q-card-section>
|
||||||
|
</q-card-section>
|
||||||
|
</q-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scope>
|
||||||
|
.q-item.hover-green:hover {
|
||||||
|
background-color: #d5f1ee57;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
.q-item.hover-green {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-container {
|
||||||
|
overflow: auto;
|
||||||
|
height: 70vh;
|
||||||
|
border: 1px solid #e6e6e7;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
.my-list-link {
|
||||||
|
color: rgb(118, 168, 222);
|
||||||
|
border-radius: 5px;
|
||||||
|
background: #a3d3fb48 !important;
|
||||||
|
font-weight: 600;
|
||||||
|
border: 1px solid rgba(175, 185, 196, 0.217);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
7
src/modules/21_report/views/05_reportSalary.vue
Normal file
7
src/modules/21_report/views/05_reportSalary.vue
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="toptitle text-dark col-12 row items-center">รายงานเงินเดือน</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue