Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2025-02-11 13:40:04 +07:00
commit ab86a54653
8 changed files with 543 additions and 12 deletions

View file

@ -85,6 +85,10 @@ const formData = reactive<FormDataAgency>({
isCommission: false,
isInformation: false,
misId: "",
DEPARTMENT_CODE: "",
DIVISION_CODE: "",
SECTION_CODE: "",
JOB_CODE: "",
});
/**
@ -152,9 +156,13 @@ function onSubmit() {
[nameId]: rootId,
responsibility:
formData.responsibility != null ? formData.responsibility : "",
DEPARTMENT_CODE: formData.DEPARTMENT_CODE,
DIVISION_CODE: formData.DIVISION_CODE,
SECTION_CODE: formData.SECTION_CODE,
JOB_CODE: formData.JOB_CODE,
};
//
//
if (actionType.value === "ADD") {
await http
.post(config.API.createOrgLevel(type.toLocaleLowerCase()), body)
@ -223,6 +231,10 @@ function closeClear() {
formData.isCommission = false;
formData.isInformation = false;
formData.misId = "";
formData.DEPARTMENT_CODE = "";
formData.DIVISION_CODE = "";
formData.SECTION_CODE = "";
formData.JOB_CODE = "";
props.close?.();
}
@ -250,9 +262,12 @@ function selectOrgLevele(val: string, status: boolean = true) {
name: "สำนักงาน",
id: "OFFICE",
},
{ name: "ส่วนราชการ", id: "GOVERNMENT" },
{ name: "สถาบัน", id: "INSTITUTION" },
{ name: "โรงพยาบาล", id: "HOSPITAL" },
{ name: "เทียบเท่ากอง", id: "EQUIVALENT" },
{ name: "ศูนย์", id: "CENTER" },
{ name: "ศูนย์บริการการแพทย์", id: "MEDICAL" },
{ name: "ศูนย์บริการสาธารณสุข", id: "HEALTHMAJOR" },
{ name: "หน่วย", id: "UNIT" },
];
break;
@ -270,15 +285,47 @@ function selectOrgLevele(val: string, status: boolean = true) {
{ name: "ฝ่าย", id: "FACTION" },
{
name: "กลุ่มงาน",
id: "WORK",
id: "GROUPWORK",
},
{
name: "สถานีดับเพลิงและกู้ภัย",
name: "ศูนย์",
id: "CENTER",
},
{
name: "ศูนย์บริการสาธารณสุขสาขา",
id: "HEALTHBRANCH",
},
{
name: "ศูนย์ฝึกอาชีพ",
id: "TRAINING",
},
{
name: "โรงเรียนฝึกอาชีพ",
id: "SCHOOL",
},
{
name: "บ้านพักผู้สูงอายุ",
id: "ELDERLY",
},
{
name: "สวนสาธารณะ",
id: "PARK",
},
{
name: "สถานีดับเพลิง",
id: "FIRESTATION",
},
{
name: "โรงเรียน",
id: "SCHOOL",
name: "งาน",
id: "WORK",
},
{
name: "โรงเรียนประถมศึกษา",
id: "PRIMARYSCHOOL",
},
{
name: "โรงเรียนมัธยมศึกษา",
id: "SECONDARYSCHOOL",
},
];
@ -423,6 +470,10 @@ watch(
formData.isCommission = props.dataNode.isCommission ?? false;
formData.isInformation = props.dataNode.isInformation ?? false;
formData.misId = props.dataNode.misId;
formData.DEPARTMENT_CODE = props.dataNode.DEPARTMENT_CODE;
formData.DIVISION_CODE = props.dataNode.DIVISION_CODE;
formData.SECTION_CODE = props.dataNode.SECTION_CODE;
formData.JOB_CODE = props.dataNode.JOB_CODE;
orgLevelOption.value =
props.dataNode.orgTreeRank === "DEPARTMENT"
? orgLevelOptionMain.value
@ -629,6 +680,54 @@ watch(
:class="classInput(false)"
/>
</div>
<div class="col-12">
<div class="col-12 row q-col-gutter-sm">
<div class="col-3">
<q-input
v-model="formData.DEPARTMENT_CODE"
dense
outlined
label="DEPARTMENT CODE"
hide-bottom-space
:class="classInput(false)"
mask="##"
/>
</div>
<div class="col-3">
<q-input
v-model="formData.DIVISION_CODE"
dense
outlined
label="DIVISION CODE"
hide-bottom-space
:class="classInput(false)"
mask="##"
/>
</div>
<div class="col-3">
<q-input
v-model="formData.SECTION_CODE"
dense
outlined
label="SECTION CODE"
hide-bottom-space
:class="classInput(false)"
mask="##"
/>
</div>
<div class="col-3">
<q-input
v-model="formData.JOB_CODE"
dense
outlined
label="JOB CODE"
hide-bottom-space
:class="classInput(false)"
mask="##"
/>
</div>
</div>
</div>
<div class="col-12">
<q-input
v-model="formData.responsibility"

View file

@ -118,7 +118,7 @@ watch(
<template>
<template>
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 40vw">
<q-card style="min-width: 70%">
<DialogHeader
:tittle="type == 0 ? `ประวัติหน่วยงาน` : `ประวัติส่วนราชการ`"
:close="() => (modal = false)"
@ -166,7 +166,10 @@ watch(
:key="col.name"
:props="props"
>
<div>
<div class="table_ellipsis2" v-if="col.name == 'name'">
{{ col.value ?? "-" }}
</div>
<div v-else>
{{ col.value ?? "-" }}
</div>
</q-td>

View file

@ -179,7 +179,7 @@ watch(
</script>
<template>
<q-dialog v-model="modal" persistent>
<q-card style="width: 1000px; max-width: 100vw">
<q-card style="min-width: 80%">
<Header
:tittle="'ประวัติตำแหน่ง'"
:close="

View file

@ -40,6 +40,10 @@ interface FormDataAgency {
isInformation?: boolean;
isCommission?: boolean;
misId: string;
DEPARTMENT_CODE: string;
DIVISION_CODE: string;
SECTION_CODE: string;
JOB_CODE: string;
}
interface FormDataPosition {

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, reactive, onMounted, watch } from "vue";
import { ref, reactive, onMounted, watch, defineAsyncComponent } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
@ -23,7 +23,9 @@ import type {
} from "@/modules/04_registryPerson/interface/response/Main";
/** importComponents*/
import TableView from "@/modules/04_registryPerson/components/TableView.vue";
const TableView = defineAsyncComponent(
() => import("@/modules/04_registryPerson/components/TableView.vue")
);
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();

View file

@ -18,6 +18,11 @@ const reportInsignia = () =>
const reportExam = () =>
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 [
{
path: "/report/org",
@ -129,4 +134,24 @@ export default [
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",
},
},
];

View file

@ -0,0 +1,391 @@
<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 { 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 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;
})
.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>

View 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>