Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into develop
This commit is contained in:
commit
b156b7dcfb
21 changed files with 2102 additions and 402 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# docker buildx build --platform=linux/amd64 -f docker/Dockerfile . -t hrms-git.chin.in.th/bma-hrms/hrms-mgt:0.1
|
||||
|
||||
# Build Stage
|
||||
FROM node:latest as build-stage
|
||||
FROM node:20-alpine as build-stage
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ export default {
|
|||
leaveDeleteReject: (id: string) => `${leave}/admin/delete/reject/${id}`,
|
||||
|
||||
/**รายงาน */
|
||||
leaveReportTimeRecords: () => `${leaveReport}/time-records/officer`,
|
||||
leaveReportTimeRecords: (type: string) =>
|
||||
`${leaveReport}/time-records/${type}`,
|
||||
leaveReportTimeLate: (type: string) => `${leaveReport}/late/${type}`,
|
||||
|
||||
leaveReportLeaveday: (type: string) => `${leaveReport}/leaveday/${type}`,
|
||||
leaveReportLeave2: (type: string) => `${leaveReport}/leave2/${type}`,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -41,4 +41,6 @@ export default {
|
|||
exportCandidateList: (id: string) => `${recruit_report}candidate/${id}`,
|
||||
exportPassExamList: (id: string) => `${recruit_report}pass/${id}`,
|
||||
periodRecruitToPlacement: (examId: string) => `${recruit}placement/${examId}`,
|
||||
|
||||
reportRecruit:(type:string)=>`${recruit}${type}`
|
||||
};
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ async function getSearch() {
|
|||
};
|
||||
await http
|
||||
.post(
|
||||
config.API.orgSearchPersonal(),
|
||||
config.API.orgSearchPersonal()+`?page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}`,
|
||||
body
|
||||
)
|
||||
.then((res) => {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ const Payment = () =>
|
|||
import("@/modules/03_recruiting/views/02_qualify/Payment.vue");
|
||||
const EditorWeb = () =>
|
||||
import("@/modules/03_recruiting/views/03_editor/index.vue");
|
||||
const CompeteReport = () =>
|
||||
import("@/modules/03_recruiting/views/01_compete/CompeteReport.vue");
|
||||
|
||||
export default [
|
||||
{
|
||||
|
|
@ -64,6 +66,16 @@ export default [
|
|||
Role: "STAFF",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/compete/report",
|
||||
name: "competeReport",
|
||||
component: CompeteReport,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: "SYS_EXAM_CONTEST_REPORT",
|
||||
Role: "STAFF",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/compete/period/add",
|
||||
name: "competePeriodAdd",
|
||||
|
|
|
|||
369
src/modules/03_recruiting/views/01_compete/CompeteReport.vue
Normal file
369
src/modules/03_recruiting/views/01_compete/CompeteReport.vue
Normal file
|
|
@ -0,0 +1,369 @@
|
|||
<script setup lang="ts">
|
||||
import axios from "axios";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import type { DataOption } from "@/modules/09_leave/interface/index/Main";
|
||||
|
||||
/** use*/
|
||||
const mixin = useCounterMixin();
|
||||
const $q = useQuasar();
|
||||
const { showLoader, hideLoader, date2Thai, dateToISO, messageError } = mixin;
|
||||
|
||||
const apiGenReport =
|
||||
"https://report-server.frappet.synology.me/api/v1/report-template/xlsx";
|
||||
|
||||
const year = ref<number>(new Date().getFullYear());
|
||||
|
||||
const reportSelect = ref<string>("report1");
|
||||
const reportSelectMain = ref<DataOption[]>([
|
||||
{
|
||||
id: "report1",
|
||||
name: "จำนวนผู้เข้าสอบแข่งขันเพื่อบรรจุเข้ารับราชการเป็นข้าราชการ กทม. สามัญ",
|
||||
},
|
||||
{
|
||||
id: "report2",
|
||||
name: "จำนวนผู้ผ่านการสอบแข่งขันเพื่อบรรจุเข้ารับราชการเป็นข้าราชการ กทม. สามัญ",
|
||||
},
|
||||
]);
|
||||
const reportSelectOption = ref<DataOption[]>(reportSelectMain.value);
|
||||
|
||||
const detailReport = ref<any>();
|
||||
|
||||
/**
|
||||
* function เรียกข้อมูลบัญชีแสดงวันลา
|
||||
* @param type สถานภาพ
|
||||
* @param year ปั
|
||||
* @param startDate วันเริ่มต้น
|
||||
* @param endDate วันสิ้นสุด
|
||||
*/
|
||||
async function getReportRecruit() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
config.API.reportRecruit(reportSelect.value) +
|
||||
`?year=${year.value+543}`
|
||||
)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
data && (await genReport(data));
|
||||
detailReport.value = data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function เรียกไฟล์ PDF
|
||||
* @param data ข้อมูลบัญชีวันลา
|
||||
*/
|
||||
async function genReport(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);
|
||||
fileBlob.value = blob;
|
||||
const pdfData = await 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()));
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function เรียกไฟล์ XLSX
|
||||
* @param data ข้อมูลบัญชีวันลา
|
||||
*/
|
||||
async function genReportXLSX(data: any) {
|
||||
await axios
|
||||
.post(`${config.API.reportTemplate}/xlsx`, data, {
|
||||
headers: {
|
||||
accept:
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"content-Type": "application/json",
|
||||
},
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(async (res) => {
|
||||
const blob = new Blob([res.data]);
|
||||
downloadReport(blob, "xlsx");
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function Download ไฟล์
|
||||
* @param data ข้อมูลบัญชีวันลา
|
||||
* @param type นามสกุลไฟล์
|
||||
*/
|
||||
async function downloadReport(data: any, type: string) {
|
||||
const link = document.createElement("a");
|
||||
var fileName = "บัญชีแสดงวันลา";
|
||||
link.href = window.URL.createObjectURL(new Blob([data]));
|
||||
link.setAttribute("download", `${fileName}.${type}`);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
|
||||
const splitterModel = ref(14);
|
||||
const numOfPages = ref<number>(0);
|
||||
const page = ref<number>(1);
|
||||
const pdfSrc = ref<any>();
|
||||
// const modalFull = ref<boolean>(false);
|
||||
const fileBlob = ref<any>();
|
||||
/** ไปหน้าต่อไปของรายงาน */
|
||||
function nextPage() {
|
||||
if (page.value < numOfPages.value) {
|
||||
page.value++;
|
||||
}
|
||||
}
|
||||
|
||||
/** กลับหน้าก่อนหน้าของรายงาน */
|
||||
function backPage() {
|
||||
if (page.value !== 1) {
|
||||
page.value--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function ค้นหาข้อมูล Option
|
||||
* @param val คำค้นหา
|
||||
* @param update function
|
||||
* @param type ประเภท option
|
||||
*/
|
||||
function filterFnOptions(val: any, update: Function) {
|
||||
update(() => {
|
||||
reportSelectOption.value = reportSelectMain.value.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getReportRecruit();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">รายงานระบบการสรรหาบุคคล</div>
|
||||
|
||||
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
|
||||
<div class="q-pa-md q-gutter-y-sm">
|
||||
<q-toolbar style="padding: 0">
|
||||
<div class="q-pr-xs">
|
||||
<q-select
|
||||
outlined
|
||||
dense
|
||||
v-model="reportSelect"
|
||||
:options="reportSelectOption"
|
||||
label="รายงาน"
|
||||
emit-value
|
||||
map-options
|
||||
hide-selected
|
||||
fill-input
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
use-input
|
||||
style="width: 500px"
|
||||
@update:model-value="getReportRecruit"
|
||||
@filter="(inputValue: any,
|
||||
doneFn: Function) => filterFnOptions(inputValue, doneFn)"
|
||||
><template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey"> ไม่มีข้อมูล </q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-select>
|
||||
</div>
|
||||
<div>
|
||||
<datepicker
|
||||
v-model="year"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
year-picker
|
||||
:enableTimePicker="false"
|
||||
@update:model-value="getReportRecruit"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="bg-white"
|
||||
dense
|
||||
outlined
|
||||
:model-value="Number(year) + 543"
|
||||
:label="`${'ปีงบประมาณ'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<q-space />
|
||||
<div class="q-py-xs">
|
||||
<q-btn
|
||||
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="downloadReport(fileBlob, '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="genReportXLSX(detailReport)"
|
||||
>
|
||||
<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>
|
||||
</q-toolbar>
|
||||
<q-splitter
|
||||
v-model="splitterModel"
|
||||
horizontal
|
||||
style="
|
||||
height: 70vh;
|
||||
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">
|
||||
<VuePDF 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>
|
||||
</div>
|
||||
</q-card>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch,computed } from "vue";
|
||||
import { ref, watch, computed } from "vue";
|
||||
import axios from "axios";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
|
@ -33,9 +33,9 @@ const rangeAge = ref<RangeAge>({
|
|||
max: 80,
|
||||
});
|
||||
|
||||
const objMarkerLabel = computed(()=>{
|
||||
return { 50: `ช่วงอายุ ${rangeAge.value.min}-${rangeAge.value.max} ปี`}
|
||||
})
|
||||
const objMarkerLabel = computed(() => {
|
||||
return { 50: `ช่วงอายุ ${rangeAge.value.min}-${rangeAge.value.max} ปี` };
|
||||
});
|
||||
|
||||
const loadingBtn = ref<boolean>(false);
|
||||
const year = ref<number>(new Date().getFullYear());
|
||||
|
|
@ -218,7 +218,6 @@ function redirectToPagePetition() {
|
|||
|
||||
function onGovernment() {
|
||||
modalReport.value = true;
|
||||
getReport();
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
|
|
@ -240,8 +239,7 @@ async function getReport() {
|
|||
)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
detailReport.value = data;
|
||||
console.log("🚀 ~ .then ~ data:", data);
|
||||
genReportXLSX(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -649,7 +647,6 @@ watch(
|
|||
autoApply
|
||||
year-picker
|
||||
:enableTimePicker="false"
|
||||
@update:model-value="getReport"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
|
|
@ -676,15 +673,14 @@ watch(
|
|||
</datepicker>
|
||||
</div>
|
||||
<div class="q-pr-xs col-4">
|
||||
<div class="q-px-sm">
|
||||
<div class="q-px-sm q-mx-md">
|
||||
<q-range
|
||||
:model-value="rangeAge"
|
||||
v-model="rangeAge"
|
||||
:min="20"
|
||||
:max="80"
|
||||
label-always
|
||||
label
|
||||
:marker-labels="objMarkerLabel"
|
||||
color="primary"
|
||||
@change="(val:RangeAge) => { rangeAge = val,getReport() }"
|
||||
>
|
||||
</q-range>
|
||||
</div>
|
||||
|
|
@ -696,7 +692,7 @@ watch(
|
|||
color="primary"
|
||||
icon="download"
|
||||
label="ดาวน์โหลดรายงาน"
|
||||
@click="genReportXLSX(detailReport)"
|
||||
@click="getReport"
|
||||
style="width: 100%"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลดรายงาน</q-tooltip>
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ const formDataSalary = reactive<FormSalaryNew>({
|
|||
refCommandNo: "", //เลขที่คำสั่ง
|
||||
templateDoc: "", //ต้นแบบ (template) เอกสารอ้างอิง
|
||||
doc: "", //เอกสารอ้างอิง
|
||||
amountSpecial: null, //เงินค่าตอบแทนพิเศษ
|
||||
});
|
||||
|
||||
const modalDialogSalary = ref<boolean>(false); //แสดง popup ตำแหน่งเงินเดือน
|
||||
|
|
@ -748,6 +749,17 @@ onMounted(() => {
|
|||
{{ col.value ? col.value : "-" }}
|
||||
<q-tooltip v-if="col.value">ดูคำสั่ง</q-tooltip>
|
||||
</div>
|
||||
<div v-else-if="col.name == 'amount'">
|
||||
{{
|
||||
props.row.amount
|
||||
? `${props.row.amount}${
|
||||
props.row.amountSpecial !== 0 && props.row.amountSpecial
|
||||
? `(${props.row.amountSpecial.toLocaleString()})`
|
||||
: ""
|
||||
}`
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'refCommandNo' && !props.row.commandId">
|
||||
-
|
||||
</div>
|
||||
|
|
@ -1097,7 +1109,21 @@ onMounted(() => {
|
|||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4">
|
||||
<q-input
|
||||
:class="classInput(true)"
|
||||
ref="amountSpecialRef"
|
||||
dense
|
||||
outlined
|
||||
v-model="formDataSalary.amountSpecial"
|
||||
label="เงินค่าตอบแทนพิเศษ"
|
||||
mask="###,###,###,###"
|
||||
reverse-fill-mask
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกเงินค่าตอบแทนพิเศษ'}`]"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-12">
|
||||
<q-input
|
||||
:class="classInput(true)"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ interface FormSalaryNew {
|
|||
positionLevel: string;
|
||||
positionExecutive: string;
|
||||
salary: number | string | null;
|
||||
amountSpecial: number | string | null;
|
||||
salaryPos: number | string | null;
|
||||
salaryCompensation: number | string | null;
|
||||
refCommandNo: string;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
interface ResListSalary {
|
||||
amount: number;
|
||||
amountSpecial: number;
|
||||
createdAt: string;
|
||||
createdFullName: string;
|
||||
createdUserId: string;
|
||||
|
|
|
|||
|
|
@ -203,10 +203,12 @@ function selectType() {
|
|||
if (empType.value !== "officer") {
|
||||
store.formFilter.isShowRetire = null;
|
||||
store.formFilter.isProbation = null;
|
||||
store.formFilter.keyword = "";
|
||||
fetchOptionGroup();
|
||||
} else {
|
||||
store.formFilter.isShowRetire = false;
|
||||
store.formFilter.isProbation = false;
|
||||
store.formFilter.keyword = "";
|
||||
fetchType();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,51 +1,433 @@
|
|||
<script setup lang="ts">
|
||||
import { useRouter } from "vue-router";
|
||||
const router = useRouter();
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useStructureTree } from "@/stores/structureTree";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type { DataStructureTree } from "@/interface/main";
|
||||
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
|
||||
|
||||
import LoadView from "@/components/LoadView.vue";
|
||||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const { fetchStructureTree } = useStructureTree();
|
||||
const { messageError, showLoader, hideLoader } = useCounterMixin();
|
||||
|
||||
const employeeClass = ref<string>("officer");
|
||||
const employeeClassOption = ref<OptionData[]>([
|
||||
{ id: "officer", name: "ข้าราชการ กทม. สามัญ" },
|
||||
{ id: "employee", name: "ลูกจ้างประจำ กทม." },
|
||||
]);
|
||||
|
||||
const typeReport = ref<string>("");
|
||||
const optionReport = ref<OptionData[]>([
|
||||
{
|
||||
id: "45",
|
||||
name: "บัญชีรายชื่อข้าราชการผู้ขอพระราชทานเครื่องราชอิสริยาภรณ์",
|
||||
},
|
||||
{ id: "44", name: " บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี" },
|
||||
{ id: "43", name: " บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ 5 ปี" },
|
||||
]);
|
||||
|
||||
const roundId = ref<string>("");
|
||||
const roundOtionMain = ref<any[]>([]);
|
||||
const roundOtion = ref<any[]>([]);
|
||||
|
||||
/** tree*/
|
||||
const filterTree = ref<string>("");
|
||||
const nodeId = ref<string>("");
|
||||
const nodeLevel = ref<number>(0);
|
||||
const node = ref<DataStructureTree[]>([]);
|
||||
const expanded = ref<string[]>([]);
|
||||
|
||||
const splitterModel = ref(14);
|
||||
const numOfPages = ref<number>(0);
|
||||
const page = ref<number>(1);
|
||||
const pdfSrc = ref<any>();
|
||||
|
||||
const isLoadPDF = ref<boolean>(false);
|
||||
|
||||
// /**
|
||||
// * ฟังก์ชัน Redirect ไปหน้ารายงานที่เลือก
|
||||
// * @param type ประเภทรายงาน
|
||||
// */
|
||||
// function nextPage(type: string) {
|
||||
// router.push(`/insignia/report/${type}`);
|
||||
// }
|
||||
|
||||
async function fetchDataTree() {
|
||||
node.value = await fetchStructureTree(route.meta.Key as string, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชัน Redirect ไปหน้ารายงานที่เลือก
|
||||
* @param type ประเภทรายงาน
|
||||
* ฟังก์ชันคึงข้อมูลรอบการเสนอขอ
|
||||
*/
|
||||
function nextPage(type: string) {
|
||||
router.push(`/insignia/report/${type}`);
|
||||
async function fecthlistRound() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listRoundInsignia(), { params: { path: "REPORT" } })
|
||||
.then((res: any) => {
|
||||
roundOtionMain.value = res.data.result.map((e: any) => ({
|
||||
id: e.period_id,
|
||||
year: e.period_year,
|
||||
name: e.period_name,
|
||||
}));
|
||||
roundOtion.value = roundOtionMain.value;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function ค้นหาข้อมูลใน option
|
||||
* @param val คำค้นหา
|
||||
* @param update function
|
||||
* @param name ชื่อ Selec
|
||||
*/
|
||||
function filterSelector(val: string, update: Function, name: string) {
|
||||
update(() => {
|
||||
const needle = val.toLowerCase();
|
||||
if (name === "round") {
|
||||
roundOtion.value = roundOtionMain.value.filter(
|
||||
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onSelectedNode(id: string, level: number) {
|
||||
nodeId.value = id;
|
||||
nodeLevel.value = level;
|
||||
onUpdateFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันโหลดไฟล์
|
||||
* @param type ประเภทไฟล์
|
||||
* @param download
|
||||
*/
|
||||
async function onUpdateFilter() {
|
||||
if (typeReport.value && roundId.value && nodeId.value) {
|
||||
isLoadPDF.value = true;
|
||||
pdfSrc.value = undefined;
|
||||
|
||||
await http
|
||||
.get(config.API.reportInsignia(typeReport.value, "pdf", roundId.value), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(async (res) => {
|
||||
const url = URL.createObjectURL(new Blob([res.data]));
|
||||
const pdfData = await usePDF(url);
|
||||
await setTimeout(() => {
|
||||
pdfSrc.value = pdfData.pdf.value;
|
||||
numOfPages.value = pdfData.pages.value;
|
||||
}, 1000);
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
isLoadPDF.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** ไปหน้าต่อไปของรายงาน */
|
||||
function nextPage() {
|
||||
if (page.value < numOfPages.value) {
|
||||
page.value++;
|
||||
}
|
||||
}
|
||||
|
||||
/** กลับหน้าก่อนหน้าของรายงาน */
|
||||
function backPage() {
|
||||
if (page.value !== 1) {
|
||||
page.value--;
|
||||
}
|
||||
}
|
||||
|
||||
function downloadReport(type: string) {}
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([fetchDataTree(), fecthlistRound()]);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
รายงานเครื่องราชอิสริยาภรณ์
|
||||
</div>
|
||||
<div>
|
||||
<q-card flat bordered class="col-12 q-mt-sm">
|
||||
<div class="q-pa-md">
|
||||
<q-item clickable @click="nextPage('45')" dense class="hover-green">
|
||||
<q-item-section avatar>
|
||||
<q-icon color="primary" name="mdi-file" size="xs" />
|
||||
</q-item-section>
|
||||
<q-item-section class="text-dark">
|
||||
บัญชีรายชื่อข้าราชการผู้ขอพระราชทานเครื่องราชอิสริยาภรณ์
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<q-item clickable @click="nextPage('43')" dense class="hover-green">
|
||||
<q-item-section avatar>
|
||||
<q-icon color="primary" name="mdi-file" size="xs" />
|
||||
</q-item-section>
|
||||
<q-item-section class="text-dark">
|
||||
บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<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">
|
||||
<q-select
|
||||
outlined
|
||||
dense
|
||||
v-model="employeeClass"
|
||||
:options="employeeClassOption"
|
||||
label="สถานภาพ"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
style="width: 230px"
|
||||
@update:model-value="onUpdateFilter"
|
||||
>
|
||||
</q-select>
|
||||
|
||||
<q-item clickable @click="nextPage('44')" dense class="hover-green">
|
||||
<q-item-section avatar>
|
||||
<q-icon color="primary" name="mdi-file" size="xs" />
|
||||
</q-item-section>
|
||||
<q-item-section class="text-dark">
|
||||
บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-space />
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
:disable="!nodeId || !employeeClass || !roundId"
|
||||
color="primary"
|
||||
icon="download"
|
||||
v-if="checkPermission($route)?.attrIsGet"
|
||||
>
|
||||
<q-menu>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item clickable v-close-popup @click="downloadReport('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="downloadReport('docx')">
|
||||
<q-item-section avatar
|
||||
><q-icon color="blue" name="mdi-file-word"
|
||||
/></q-item-section>
|
||||
<q-item-section>ไฟล์ .docx</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="downloadReport('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 class="row col-12">
|
||||
<q-card bordered class="col-12 filter-card q-pa-sm">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<div class="col-md-4 col-xs-12">
|
||||
<q-select
|
||||
class="bg-white"
|
||||
hide-bottom-space
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
v-model="typeReport"
|
||||
:label="`${'รายงาน'}`"
|
||||
emit-value
|
||||
map-options
|
||||
:options="optionReport"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@update:model-value="onUpdateFilter"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-xs-12">
|
||||
<q-select
|
||||
class="bg-white"
|
||||
use-input
|
||||
fill-input
|
||||
hide-selected
|
||||
dense
|
||||
lazy-rules
|
||||
outlined
|
||||
v-model="roundId"
|
||||
:options="roundOtion"
|
||||
label="เลือกรอบ"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
emit-value
|
||||
map-options
|
||||
@update:model-value="onUpdateFilter"
|
||||
@filter="(inputValue:string,doneFn:Function) =>
|
||||
filterSelector(inputValue, doneFn,'round') "
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-select>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</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"
|
||||
v-model:expanded="expanded"
|
||||
: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.orgLevel)
|
||||
"
|
||||
: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
|
||||
v-model="splitterModel"
|
||||
horizontal
|
||||
style="
|
||||
height: 65vh;
|
||||
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="isLoadPDF" />
|
||||
<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>
|
||||
|
||||
|
|
@ -57,4 +439,18 @@ function nextPage(type: string) {
|
|||
.q-item.hover-green {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.tree-container {
|
||||
overflow: auto;
|
||||
height: 60vh;
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ interface DataOption2 {
|
|||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface DataDateMonthObject {
|
||||
month: number;
|
||||
year: number;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ const ChangeRoundMain = () =>
|
|||
const SpecialTimeMain = () =>
|
||||
import("@/modules/09_leave/views/04_SpecialTimeMain.vue");
|
||||
const leaveReport = () => import("@/modules/09_leave/views/06_ReportMain.vue");
|
||||
|
||||
const CheckinReport = () =>
|
||||
import("@/modules/09_leave/views/07_ReportCheckin.vue");
|
||||
export default [
|
||||
{
|
||||
path: "/round-time",
|
||||
|
|
@ -91,24 +94,15 @@ export default [
|
|||
Role: "STAFF",
|
||||
},
|
||||
},
|
||||
// {
|
||||
// path: "/statistics-report",
|
||||
// name: "/statistics-report",
|
||||
// component: reportMain,
|
||||
// meta: {
|
||||
// Auth: true,
|
||||
// Key: [9],
|
||||
// Role: "leave",
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: "/statistics-report/:type",
|
||||
// name: "/statistics-report-detail",
|
||||
// component: reportDetail,
|
||||
// meta: {
|
||||
// Auth: true,
|
||||
// Key: [9],
|
||||
// Role: "leave",
|
||||
// },
|
||||
// },
|
||||
|
||||
{
|
||||
path: "/checkinReport",
|
||||
name: "checkinReport",
|
||||
component: CheckinReport,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: "SYS_WORK_REPORT",
|
||||
Role: "STAFF",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { ref } from "vue";
|
|||
/** import Components */
|
||||
import Tab1 from "@/modules/09_leave/components/02_WorkList/Tab1.vue";
|
||||
import Tab2 from "@/modules/09_leave/components/02_WorkList/Tab2.vue";
|
||||
import DialogReport from "@/modules/09_leave/components/02_WorkList/DialogReport.vue";
|
||||
// import DialogReport from "@/modules/09_leave/components/02_WorkList/DialogReport.vue";
|
||||
|
||||
const tab = ref("1");
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ function onClickOpenDialog() {
|
|||
<div class="row">
|
||||
<span class="toptitle text-dark item-center">รายการลงเวลาปฏิบัติงาน</span>
|
||||
<q-space />
|
||||
<q-btn
|
||||
<!-- <q-btn
|
||||
dense
|
||||
flat
|
||||
class="text-blue"
|
||||
|
|
@ -26,7 +26,7 @@ function onClickOpenDialog() {
|
|||
@click="onClickOpenDialog"
|
||||
>
|
||||
<q-tooltip>รายงานสถิติการลงเวลา</q-tooltip>
|
||||
</q-btn>
|
||||
</q-btn> -->
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
|
@ -60,7 +60,7 @@ function onClickOpenDialog() {
|
|||
</q-card>
|
||||
</div>
|
||||
|
||||
<DialogReport :modal="modalReport" :close="onClickOpenDialog" />
|
||||
<!-- <DialogReport :modal="modalReport" :close="onClickOpenDialog" /> -->
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
|||
|
|
@ -4,33 +4,59 @@ import { ref, onMounted } from "vue";
|
|||
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useRoute } from "vue-router";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useStructureTree } from "@/stores/structureTree";
|
||||
import genReportXLSX from "@/plugins/genreportxlsx";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type { DataOption } from "@/modules/09_leave/interface/index/Main";
|
||||
import type { DataStructureTree } from "@/interface/main";
|
||||
import type {
|
||||
DataOption,
|
||||
DataDateMonthObject,
|
||||
} from "@/modules/09_leave/interface/index/Main";
|
||||
|
||||
import LoadView from "@/components/LoadView.vue";
|
||||
|
||||
/** use*/
|
||||
const mixin = useCounterMixin();
|
||||
const $q = useQuasar();
|
||||
const { showLoader, hideLoader, date2Thai, dateToISO, messageError } = mixin;
|
||||
|
||||
const apiGenReport =
|
||||
"https://report-server.frappet.synology.me/api/v1/report-template/xlsx";
|
||||
const route = useRoute();
|
||||
const { fetchStructureTree } = useStructureTree();
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
date2Thai,
|
||||
dateToISO,
|
||||
messageError,
|
||||
monthYear2Thai,
|
||||
} = useCounterMixin();
|
||||
|
||||
const year = ref<number>(new Date().getFullYear());
|
||||
const dateStart = ref<Date>(new Date(year.value, 9, 1));
|
||||
const dateEnd = ref<Date>(new Date(year.value + 1, 8, 30));
|
||||
|
||||
const employeeClass = ref<string>("employee");
|
||||
const dateMonth = ref<DataDateMonthObject>({
|
||||
month: new Date().getMonth(),
|
||||
year: new Date().getFullYear(),
|
||||
});
|
||||
|
||||
const typeReport = ref<string>("");
|
||||
const optionReport = ref<DataOption[]>([
|
||||
{ id: "1", name: "รายงานการลางานตามประเภทการลา" },
|
||||
{ id: "2", name: "รายงานการลางาน" },
|
||||
]);
|
||||
|
||||
const employeeClass = ref<string>("officer");
|
||||
const yearType = ref<string>("FULL");
|
||||
const employeeClassMain = ref<DataOption[]>([
|
||||
{ id: "employee", name: "ลูกจ้างประจำ กทม." },
|
||||
{ id: "officer", name: "ข้าราชการ กทม. สามัญ" },
|
||||
{ id: "employee", name: "ลูกจ้างประจำ กทม." },
|
||||
]);
|
||||
const yearTypeOptionMain = ref<DataOption[]>([
|
||||
{ id: "FULL", name: "รายปี" },
|
||||
{ id: "MONTH", name: "รายเดือน" },
|
||||
{ id: "FIRSTHAFT", name: "ครึ่งปีแรก" },
|
||||
{ id: "SECONDHAFT", name: "ครึ่งปีหลัง" },
|
||||
]);
|
||||
|
|
@ -38,26 +64,76 @@ const employeeClassOption = ref<DataOption[]>(employeeClassMain.value);
|
|||
const yearTypeOptionOption = ref<DataOption[]>(yearTypeOptionMain.value);
|
||||
|
||||
const detailReport = ref<any>();
|
||||
const isReport = ref<boolean>(false);
|
||||
const isLoadPDF = ref<boolean>(false);
|
||||
|
||||
/** tree*/
|
||||
const filterTree = ref<string>("");
|
||||
const nodeId = ref<string>("");
|
||||
const nodeLevel = ref<number>(0);
|
||||
const node = ref<DataStructureTree[]>([]);
|
||||
const expanded = ref<string[]>([]);
|
||||
|
||||
async function fetchDataTree() {
|
||||
node.value = await fetchStructureTree(route.meta.Key as string, true);
|
||||
}
|
||||
|
||||
function onSelectedNode(id: string, level: number) {
|
||||
nodeId.value = id;
|
||||
nodeLevel.value = level;
|
||||
updateLeaveday();
|
||||
}
|
||||
|
||||
/** function อัปเดทบัญชีแสดงวันลา */
|
||||
async function updateLeaveday() {
|
||||
if (yearType.value === "FULL") {
|
||||
dateStart.value = new Date(year.value - 1, 9, 1);
|
||||
dateEnd.value = new Date(year.value, 8, 30);
|
||||
} else if (yearType.value === "FIRSTHAFT") {
|
||||
dateStart.value = new Date(year.value - 1, 9, 1);
|
||||
dateEnd.value = new Date(year.value, 2, 31);
|
||||
} else if (yearType.value === "SECONDHAFT") {
|
||||
dateStart.value = new Date(year.value, 3, 1);
|
||||
dateEnd.value = new Date(year.value, 8, 30);
|
||||
if (!nodeId.value || !typeReport.value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fetchLeaveday(
|
||||
employeeClass.value,
|
||||
yearType.value,
|
||||
dateStart.value,
|
||||
dateEnd.value
|
||||
);
|
||||
isReport.value = false;
|
||||
isLoadPDF.value = true;
|
||||
pdfSrc.value = undefined;
|
||||
switch (yearType.value) {
|
||||
case "FULL":
|
||||
dateStart.value = new Date(year.value - 1, 9, 1);
|
||||
dateEnd.value = new Date(year.value, 8, 30);
|
||||
break;
|
||||
|
||||
case "MONTH":
|
||||
const mount = dateMonth.value.month + 1;
|
||||
// วันเริ่มต้นของเดือน
|
||||
dateStart.value = new Date(dateMonth.value.year, mount - 1, 1);
|
||||
// วันสิ้นสุดของเดือนถัดไป
|
||||
dateEnd.value = new Date(dateMonth.value.year, mount, 0);
|
||||
break;
|
||||
|
||||
case "FIRSTHAFT":
|
||||
dateStart.value = new Date(year.value - 1, 9, 1);
|
||||
dateEnd.value = new Date(year.value, 2, 31);
|
||||
break;
|
||||
|
||||
case "SECONDHAFT":
|
||||
dateStart.value = new Date(year.value, 3, 1);
|
||||
dateEnd.value = new Date(year.value, 8, 30);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
typeReport.value === "1"
|
||||
? fetchLeaveday(
|
||||
employeeClass.value,
|
||||
yearType.value,
|
||||
dateStart.value,
|
||||
dateEnd.value
|
||||
)
|
||||
: fetchLeaveday2(
|
||||
employeeClass.value,
|
||||
yearType.value,
|
||||
dateStart.value,
|
||||
dateEnd.value
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -73,25 +149,57 @@ async function fetchLeaveday(
|
|||
startDate: Date,
|
||||
endDate: Date
|
||||
) {
|
||||
showLoader();
|
||||
const body = {
|
||||
type: year === "FULL" ? "FULL" : "HAFT",
|
||||
type: year === "FULL" ? "FULL" : year === "MONTH" ? "MONTH" : "HAFT",
|
||||
startDate: dateToISO(startDate),
|
||||
endDate: dateToISO(endDate),
|
||||
nodeId: nodeId.value,
|
||||
node: nodeLevel.value,
|
||||
};
|
||||
|
||||
await http
|
||||
.post(config.API.leaveReportLeaveday(type), body)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
data && (await genReport(data));
|
||||
data && (await fetchDocumentTemplate(data));
|
||||
isReport.value = data ? true : false;
|
||||
detailReport.value = data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
isLoadPDF.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
async function fetchLeaveday2(
|
||||
type: string,
|
||||
year: string,
|
||||
startDate: Date,
|
||||
endDate: Date
|
||||
) {
|
||||
const body = {
|
||||
type: year === "FULL" ? "FULL" : year === "MONTH" ? "MONTH" : "HAFT",
|
||||
startDate: dateToISO(startDate),
|
||||
endDate: dateToISO(endDate),
|
||||
nodeId: nodeId.value,
|
||||
node: nodeLevel.value,
|
||||
};
|
||||
|
||||
await http
|
||||
.post(config.API.leaveReportLeave2(type), body)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
data && (await fetchDocumentTemplate(data));
|
||||
isReport.value = data ? true : false;
|
||||
detailReport.value = data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
isLoadPDF.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +207,7 @@ async function fetchLeaveday(
|
|||
* function เรียกไฟล์ PDF
|
||||
* @param data ข้อมูลบัญชีวันลา
|
||||
*/
|
||||
async function genReport(data: any) {
|
||||
async function fetchDocumentTemplate(data: any) {
|
||||
await axios
|
||||
.post(`${config.API.reportTemplate}/xlsx`, data, {
|
||||
headers: {
|
||||
|
|
@ -111,7 +219,6 @@ async function genReport(data: any) {
|
|||
.then(async (res) => {
|
||||
const blob = new Blob([res.data]);
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
fileBlob.value = blob;
|
||||
const pdfData = await usePDF(`${objectUrl}`);
|
||||
|
||||
setTimeout(() => {
|
||||
|
|
@ -129,53 +236,11 @@ async function genReport(data: any) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function เรียกไฟล์ XLSX
|
||||
* @param data ข้อมูลบัญชีวันลา
|
||||
*/
|
||||
async function genReportXLSX(data: any) {
|
||||
await axios
|
||||
.post(`${config.API.reportTemplate}/xlsx`, data, {
|
||||
headers: {
|
||||
accept:
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"content-Type": "application/json",
|
||||
},
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(async (res) => {
|
||||
const blob = new Blob([res.data]);
|
||||
downloadReport(blob, "xlsx");
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function Download ไฟล์
|
||||
* @param data ข้อมูลบัญชีวันลา
|
||||
* @param type นามสกุลไฟล์
|
||||
*/
|
||||
async function downloadReport(data: any, type: string) {
|
||||
const link = document.createElement("a");
|
||||
var fileName = "บัญชีแสดงวันลา";
|
||||
link.href = window.URL.createObjectURL(new Blob([data]));
|
||||
link.setAttribute("download", `${fileName}.${type}`);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
|
||||
const splitterModel = ref(14);
|
||||
const numOfPages = ref<number>(0);
|
||||
const page = ref<number>(1);
|
||||
const pdfSrc = ref<any>();
|
||||
// const modalFull = ref<boolean>(false);
|
||||
const fileBlob = ref<any>();
|
||||
|
||||
/** ไปหน้าต่อไปของรายงาน */
|
||||
function nextPage() {
|
||||
if (page.value < numOfPages.value) {
|
||||
|
|
@ -190,42 +255,23 @@ function backPage() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function ค้นหาข้อมูล Option
|
||||
* @param val คำค้นหา
|
||||
* @param update function
|
||||
* @param type ประเภท option
|
||||
*/
|
||||
function filterFnOptions(val: any, update: Function, type: string) {
|
||||
switch (type) {
|
||||
case "employeeClass":
|
||||
update(() => {
|
||||
employeeClassOption.value = employeeClassMain.value.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
case "yearType":
|
||||
update(() => {
|
||||
yearTypeOptionOption.value = yearTypeOptionMain.value.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
}
|
||||
function monthYearThai(val: DataDateMonthObject) {
|
||||
if (val == null) return "";
|
||||
else return monthYear2Thai(val.month, val.year);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
updateLeaveday();
|
||||
fetchDataTree();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">บัญชีแสดงวันลา</div>
|
||||
|
||||
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
|
||||
<div class="q-pa-md q-gutter-y-sm">
|
||||
<q-toolbar style="padding: 0">
|
||||
<div class="q-pr-xs">
|
||||
<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">
|
||||
<q-select
|
||||
outlined
|
||||
dense
|
||||
|
|
@ -234,49 +280,16 @@ onMounted(() => {
|
|||
label="สถานภาพ"
|
||||
emit-value
|
||||
map-options
|
||||
hide-selected
|
||||
fill-input
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
use-input
|
||||
style="width: 230px"
|
||||
@update:model-value="updateLeaveday"
|
||||
@filter="(inputValue: any,
|
||||
doneFn: Function) => filterFnOptions(inputValue, doneFn,'employeeClass')"
|
||||
><template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey"> ไม่มีข้อมูล </q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
>
|
||||
</q-select>
|
||||
</div>
|
||||
<div class="q-pr-xs">
|
||||
<q-select
|
||||
outlined
|
||||
dense
|
||||
v-model="yearType"
|
||||
:options="yearTypeOptionOption"
|
||||
emit-value
|
||||
map-options
|
||||
hide-selected
|
||||
fill-input
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
use-input
|
||||
style="width: 230px"
|
||||
@update:model-value="updateLeaveday"
|
||||
@filter="(inputValue: any,
|
||||
doneFn: Function) => filterFnOptions(inputValue, doneFn,'yearType')"
|
||||
><template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey"> ไม่มีข้อมูล </q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-select>
|
||||
</div>
|
||||
<q-space />
|
||||
<div class="q-py-xs">
|
||||
|
||||
<q-space />
|
||||
<q-btn
|
||||
:disable="!isReport || !nodeId || !employeeClass"
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
|
|
@ -288,7 +301,25 @@ onMounted(() => {
|
|||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="downloadReport(fileBlob, 'pdf')"
|
||||
@click="
|
||||
genReportXLSX(
|
||||
detailReport,
|
||||
`${
|
||||
typeReport === '1'
|
||||
? `รายงานการลางานตามประเภทการลา (${
|
||||
employeeClass === 'officer'
|
||||
? 'ข้าราชการ กทม. สามัญ'
|
||||
: 'ลูกจ้างประจำ กทม.'
|
||||
})`
|
||||
: `รายงานการลางาน (${
|
||||
employeeClass === 'officer'
|
||||
? 'ข้าราชการ กทม. สามัญ'
|
||||
: 'ลูกจ้างประจำ กทม.'
|
||||
})`
|
||||
}`,
|
||||
'pdf'
|
||||
)
|
||||
"
|
||||
>
|
||||
<q-item-section avatar
|
||||
><q-icon color="red" name="mdi-file-pdf"
|
||||
|
|
@ -298,7 +329,24 @@ onMounted(() => {
|
|||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="genReportXLSX(detailReport)"
|
||||
@click="
|
||||
genReportXLSX(
|
||||
detailReport,
|
||||
`${
|
||||
typeReport === '1'
|
||||
? `รายงานการลางานตามประเภทการลา (${
|
||||
employeeClass === 'officer'
|
||||
? 'ข้าราชการ กทม. สามัญ'
|
||||
: 'ลูกจ้างประจำ กทม.'
|
||||
})`
|
||||
: `รายงานการลางาน (${
|
||||
employeeClass === 'officer'
|
||||
? 'ข้าราชการ กทม. สามัญ'
|
||||
: 'ลูกจ้างประจำ กทม.'
|
||||
})`
|
||||
}`
|
||||
)
|
||||
"
|
||||
>
|
||||
<q-item-section avatar
|
||||
><q-icon color="green" name="mdi-file-excel"
|
||||
|
|
@ -309,195 +357,368 @@ onMounted(() => {
|
|||
</q-menu>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-toolbar>
|
||||
|
||||
<q-toolbar class="q-pa-sm bg-grey-2" style="border-radius: 5px">
|
||||
<div class="q-pr-xs">
|
||||
<datepicker
|
||||
v-model="year"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
year-picker
|
||||
:enableTimePicker="false"
|
||||
@update:model-value="updateLeaveday"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="bg-white"
|
||||
dense
|
||||
outlined
|
||||
:model-value="Number(year) + 543"
|
||||
:label="`${'ปีงบประมาณ'}`"
|
||||
<div class="row col-12">
|
||||
<q-card bordered class="col-12 filter-card q-pa-sm">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<div class="col-md-3 col-xs-12">
|
||||
<q-select
|
||||
class="bg-white"
|
||||
hide-bottom-space
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
v-model="typeReport"
|
||||
:label="`${'รายงาน'}`"
|
||||
emit-value
|
||||
map-options
|
||||
:options="optionReport"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@update:model-value="updateLeaveday"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="row col-md-9 col-xs-12 q-col-gutter-sm"
|
||||
v-if="typeReport"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
<div class="col-md-3 col-xs-12">
|
||||
<q-select
|
||||
class="bg-white"
|
||||
outlined
|
||||
dense
|
||||
v-model="yearType"
|
||||
:options="yearTypeOptionOption"
|
||||
emit-value
|
||||
map-options
|
||||
hide-selected
|
||||
fill-input
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
use-input
|
||||
@update:model-value="updateLeaveday"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="q-pr-xs">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateStart"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
readonly
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="bg-white"
|
||||
outlined
|
||||
dense
|
||||
borderless
|
||||
:model-value="dateStart ? date2Thai(dateStart) : null"
|
||||
:label="`${'ตั้งเเต่วันที่'}`"
|
||||
readonly
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="event" class="cursor-pointer" color="primary">
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="q-pr-xs">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateEnd"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
readonly
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="bg-white"
|
||||
outlined
|
||||
dense
|
||||
borderless
|
||||
:model-value="dateEnd ? date2Thai(dateEnd) : null"
|
||||
:label="`${'ถึงวันที่'}`"
|
||||
readonly
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="event" class="cursor-pointer" color="primary">
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
</q-toolbar>
|
||||
<q-splitter
|
||||
v-model="splitterModel"
|
||||
horizontal
|
||||
style="
|
||||
height: 70vh;
|
||||
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 }}
|
||||
</q-select>
|
||||
</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">
|
||||
<VuePDF 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
|
||||
class="col-md-9 col-xs-12 row q-col-gutter-sm"
|
||||
v-if="yearType !== 'MONTH'"
|
||||
>
|
||||
<div class="col-md-4">
|
||||
<datepicker
|
||||
v-model="year"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
year-picker
|
||||
:enableTimePicker="false"
|
||||
@update:model-value="updateLeaveday"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="bg-white"
|
||||
dense
|
||||
outlined
|
||||
:model-value="Number(year) + 543"
|
||||
:label="`${'ปีงบประมาณ'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateStart"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
readonly
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="bg-white"
|
||||
outlined
|
||||
dense
|
||||
borderless
|
||||
:model-value="dateStart ? date2Thai(dateStart) : null"
|
||||
:label="`${'ตั้งเเต่วันที่'}`"
|
||||
readonly
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateEnd"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
readonly
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="bg-white"
|
||||
outlined
|
||||
dense
|
||||
borderless
|
||||
:model-value="dateEnd ? date2Thai(dateEnd) : null"
|
||||
:label="`${'ถึงวันที่'}`"
|
||||
readonly
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" v-else>
|
||||
<datepicker
|
||||
v-model="dateMonth"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
month-picker
|
||||
:enableTimePicker="false"
|
||||
@update:model-value="updateLeaveday"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="bg-white"
|
||||
outlined
|
||||
dense
|
||||
borderless
|
||||
:label="`${'เดือน'}`"
|
||||
:model-value="monthYearThai(dateMonth)"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
></q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</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>
|
||||
</q-card>
|
||||
</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"
|
||||
v-model:expanded="expanded"
|
||||
: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.orgLevel)
|
||||
"
|
||||
: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
|
||||
v-model="splitterModel"
|
||||
horizontal
|
||||
style="
|
||||
height: 65vh;
|
||||
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="isLoadPDF" />
|
||||
<VuePDF
|
||||
v-else
|
||||
ref="vuePDFRef"
|
||||
:pdf="pdfSrc"
|
||||
:page="page"
|
||||
fit-parent
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</q-splitter>
|
||||
</div>
|
||||
</q-card>
|
||||
</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 scoped></style>
|
||||
<style scoped>
|
||||
.tree-container {
|
||||
overflow: auto;
|
||||
height: 60vh;
|
||||
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>
|
||||
|
|
|
|||
649
src/modules/09_leave/views/07_ReportCheckin.vue
Normal file
649
src/modules/09_leave/views/07_ReportCheckin.vue
Normal file
|
|
@ -0,0 +1,649 @@
|
|||
<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 { useRoute } from "vue-router";
|
||||
import { useStructureTree } from "@/stores/structureTree";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import genReportXLSX from "@/plugins/genreportxlsx";
|
||||
|
||||
import type { DataStructureTree } from "@/interface/main";
|
||||
import type {
|
||||
DataOption,
|
||||
DataDateMonthObject,
|
||||
} from "@/modules/09_leave/interface/index/Main";
|
||||
|
||||
import LoadView from "@/components/LoadView.vue";
|
||||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const {
|
||||
date2Thai,
|
||||
monthYear2Thai,
|
||||
dateToISO,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
} = useCounterMixin();
|
||||
|
||||
const { fetchStructureTree } = useStructureTree();
|
||||
const splitterModel = ref<number>(14);
|
||||
|
||||
/** filter*/
|
||||
const typeReport = ref<string>("");
|
||||
const optionReport = ref<DataOption[]>([
|
||||
{ id: "1", name: "รายงานการเข้างาน" },
|
||||
{ id: "2", name: "รายงานการเข้างานสาย" },
|
||||
]);
|
||||
const employeeClass = ref<string>("officer");
|
||||
const employeeClassOption = ref<DataOption[]>([
|
||||
{ id: "officer", name: "ข้าราชการ กทม. สามัญ" },
|
||||
{ id: "employee", name: "ลูกจ้างประจำ กทม." },
|
||||
]);
|
||||
const filterType = ref<string>("DAY");
|
||||
const filterTypeMain = ref<DataOption[]>([
|
||||
{ id: "DAY", name: "รายวัน" },
|
||||
{ id: "WEEKLY", name: "รายสัปดาห์" },
|
||||
{ id: "MONTH", name: "รายเดือน" },
|
||||
]);
|
||||
const filterTypeOption = ref<DataOption[]>(filterTypeMain.value);
|
||||
const date = ref<Date>(new Date());
|
||||
const dateWeek = ref<Date[]>(getCurrentWeek());
|
||||
const dateMonth = ref<DataDateMonthObject>({
|
||||
month: new Date().getMonth(),
|
||||
year: new Date().getFullYear(),
|
||||
});
|
||||
const isLoadPDF = ref<boolean>(false);
|
||||
|
||||
/** tree*/
|
||||
const filterTree = ref<string>("");
|
||||
const nodeId = ref<string>("");
|
||||
const nodeLevel = ref<number>(0);
|
||||
const node = ref<DataStructureTree[]>([]);
|
||||
const expanded = ref<string[]>([]);
|
||||
|
||||
/** report*/
|
||||
const numOfPages = ref<number>(0);
|
||||
const page = ref<number>(1);
|
||||
const pdfSrc = ref<any>();
|
||||
|
||||
const detailReport = ref<any>();
|
||||
const isReport = ref<boolean>(false);
|
||||
|
||||
/** กลับหน้าก่อนหน้าของรายงาน */
|
||||
function backPage() {
|
||||
if (page.value !== 1) {
|
||||
page.value--;
|
||||
}
|
||||
}
|
||||
|
||||
/** ไปหน้าต่อไปของรายงาน */
|
||||
function nextPage() {
|
||||
if (page.value < numOfPages.value) {
|
||||
page.value++;
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchDataTree() {
|
||||
node.value = await fetchStructureTree(route.meta.Key as string, true);
|
||||
}
|
||||
|
||||
function onSelectedNode(id: string, level: number) {
|
||||
nodeId.value = id;
|
||||
nodeLevel.value = level;
|
||||
updateFilterType(filterType.value);
|
||||
}
|
||||
|
||||
/** function อัปเดทรายงานสถิติการลา*/
|
||||
async function updateFilterType(type: string) {
|
||||
if (!nodeId.value || !typeReport.value) {
|
||||
return false;
|
||||
}
|
||||
let body = {};
|
||||
isReport.value = false;
|
||||
isLoadPDF.value = true;
|
||||
pdfSrc.value = undefined;
|
||||
switch (type) {
|
||||
case "DAY":
|
||||
body = {
|
||||
startDate: dateToISO(date.value),
|
||||
endDate: dateToISO(date.value),
|
||||
type: filterType.value,
|
||||
nodeId: nodeId.value,
|
||||
node: nodeLevel.value,
|
||||
};
|
||||
break;
|
||||
|
||||
case "WEEKLY":
|
||||
const startOfWeek = new Date(dateWeek.value[0]); // ใช้ค่า index 0 เป็นวันเริ่มต้น
|
||||
const endOfWeek = new Date(dateWeek.value[1]);
|
||||
|
||||
body = {
|
||||
startDate: dateToISO(startOfWeek),
|
||||
endDate: dateToISO(endOfWeek),
|
||||
type: filterType.value,
|
||||
nodeId: nodeId.value,
|
||||
node: nodeLevel.value,
|
||||
};
|
||||
break;
|
||||
|
||||
case "MONTH":
|
||||
const mount = dateMonth.value.month + 1;
|
||||
// วันเริ่มต้นของเดือน
|
||||
const firstDay = new Date(dateMonth.value.year, mount - 1, 1);
|
||||
// วันสิ้นสุดของเดือนถัดไป
|
||||
const lastDay = new Date(dateMonth.value.year, mount, 0);
|
||||
body = {
|
||||
startDate: dateToISO(firstDay),
|
||||
endDate: dateToISO(lastDay),
|
||||
type: filterType.value,
|
||||
nodeId: nodeId.value,
|
||||
node: nodeLevel.value,
|
||||
};
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
typeReport.value === "1"
|
||||
? fetchReportTimeRecords(body)
|
||||
: fetchReportTimeLate(body);
|
||||
}
|
||||
|
||||
/**
|
||||
* function เรียกข้อมูลรายงานการเข้างาน
|
||||
* @param body วันเรื่มต้นและสิ้นสุด
|
||||
*/
|
||||
async function fetchReportTimeRecords(body: any) {
|
||||
await http
|
||||
.post(config.API.leaveReportTimeRecords(employeeClass.value), body)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
detailReport.value = data;
|
||||
isReport.value = data ? true : false;
|
||||
await fetchDocumentTemplate(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
isLoadPDF.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function เรียกข้อมูลรายงานการเข้างานสาย
|
||||
* @param body วันเรื่มต้นและสิ้นสุด
|
||||
*/
|
||||
async function fetchReportTimeLate(body: any) {
|
||||
await http
|
||||
.post(config.API.leaveReportTimeLate(employeeClass.value), body)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
detailReport.value = data;
|
||||
isReport.value = data ? true : false;
|
||||
await fetchDocumentTemplate(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
isLoadPDF.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function เรียกไฟล์ XLSX
|
||||
* @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 = await usePDF(`${objectUrl}`);
|
||||
|
||||
// แสดง PDF หลังจากโหลดเสร็จ
|
||||
setTimeout(async () => {
|
||||
pdfSrc.value = pdfData.pdf.value;
|
||||
numOfPages.value = pdfData.pages.value;
|
||||
}, 1500);
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function filterOption
|
||||
* @param val คำค้นหา
|
||||
* @param update functoin
|
||||
*/
|
||||
function filterFnOptions(val: string, update: Function) {
|
||||
update(() => {
|
||||
filterTypeOption.value = filterTypeMain.value.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function monthYearThai(val: DataDateMonthObject) {
|
||||
if (val == null) return "";
|
||||
else return monthYear2Thai(val.month, val.year);
|
||||
}
|
||||
|
||||
function formatWeekDisplay(week: Date[]) {
|
||||
if (week) {
|
||||
if (!week[0] || !week[1]) return "";
|
||||
return `${date2Thai(week[0])} - ${date2Thai(week[1])}`;
|
||||
}
|
||||
}
|
||||
|
||||
/** ฟังก์ชันคำนวณวันเริ่มต้นและวันสิ้นสุดของสัปดาห์นี้ */
|
||||
function getCurrentWeek() {
|
||||
const today = new Date();
|
||||
const firstDayOfWeek = new Date(today);
|
||||
firstDayOfWeek.setDate(today.getDate() - today.getDay() + 1); // วันจันทร์
|
||||
const lastDayOfWeek = new Date(today);
|
||||
lastDayOfWeek.setDate(today.getDate() - today.getDay() + 7); // วันอาทิตย์
|
||||
return [firstDayOfWeek, lastDayOfWeek];
|
||||
}
|
||||
|
||||
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">
|
||||
<div class="row q-col-gutter-sm">
|
||||
<q-select
|
||||
outlined
|
||||
dense
|
||||
v-model="employeeClass"
|
||||
:options="employeeClassOption"
|
||||
label="สถานภาพ"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
@update:model-value="updateFilterType(filterType)"
|
||||
>
|
||||
</q-select>
|
||||
</div>
|
||||
|
||||
<q-space />
|
||||
|
||||
<q-btn
|
||||
v-if="checkPermission($route)?.attrIsGet"
|
||||
flat
|
||||
:disable="!isReport || !nodeId || !employeeClass"
|
||||
round
|
||||
color="primary"
|
||||
icon="download"
|
||||
@click.stop.pervent="
|
||||
genReportXLSX(
|
||||
detailReport,
|
||||
`${
|
||||
typeReport === '1'
|
||||
? 'รายงานการเข้างาน'
|
||||
: 'รายงานการเข้างานสาย'
|
||||
}`
|
||||
)
|
||||
"
|
||||
>
|
||||
</q-btn>
|
||||
</div>
|
||||
|
||||
<div class="col-12 row">
|
||||
<q-card bordered class="col-12 filter-card q-pa-sm">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<div class="col-lg-2 col-md-4 col-xs-12">
|
||||
<q-select
|
||||
class="bg-white"
|
||||
hide-bottom-space
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
v-model="typeReport"
|
||||
:label="`${'รายงาน'}`"
|
||||
emit-value
|
||||
map-options
|
||||
:options="optionReport"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@update:model-value="updateFilterType(filterType)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 col-md-4 col-xs-12" v-if="typeReport">
|
||||
<q-select
|
||||
class="bg-white"
|
||||
outlined
|
||||
dense
|
||||
v-model="filterType"
|
||||
:options="filterTypeOption"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
@update:model-value="updateFilterType"
|
||||
@filter="(inputValue: string,
|
||||
doneFn: Function) => filterFnOptions(inputValue, doneFn,)"
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-select>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="col-lg-2 col-md-4 col-xs-12"
|
||||
v-if="filterType === 'DAY' && typeReport"
|
||||
>
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="date"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
@update:model-value="updateFilterType('DAY')"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="bg-white"
|
||||
outlined
|
||||
dense
|
||||
borderless
|
||||
:model-value="date ? date2Thai(date) : null"
|
||||
:label="`${'วันที่'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="col-lg-2 col-md-4 col-xs-12"
|
||||
v-if="filterType === 'WEEKLY' && typeReport"
|
||||
>
|
||||
<datepicker
|
||||
v-model="dateWeek"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
@update:model-value="updateFilterType('WEEKLY')"
|
||||
week-picker
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="bg-white"
|
||||
outlined
|
||||
dense
|
||||
borderless
|
||||
:label="`${'รายสัปดาห์'}`"
|
||||
:model-value="formatWeekDisplay(dateWeek)"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
></q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="col-lg-2 col-md-4 col-xs-12"
|
||||
v-if="filterType === 'MONTH' && typeReport"
|
||||
>
|
||||
<datepicker
|
||||
v-model="dateMonth"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
month-picker
|
||||
:enableTimePicker="false"
|
||||
@update:model-value="updateFilterType('MONTH')"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="bg-white"
|
||||
outlined
|
||||
dense
|
||||
borderless
|
||||
:label="`${'เดือน'}`"
|
||||
:model-value="monthYearThai(dateMonth)"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
></q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</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"
|
||||
v-model:expanded="expanded"
|
||||
: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.orgLevel)
|
||||
"
|
||||
: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
|
||||
v-model="splitterModel"
|
||||
horizontal
|
||||
style="
|
||||
height: 65vh;
|
||||
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="isLoadPDF" />
|
||||
<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 scoped>
|
||||
.tree-container {
|
||||
overflow: auto;
|
||||
height: 60vh;
|
||||
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>
|
||||
|
|
@ -78,8 +78,13 @@ const dataMapToSend = computed(() => {
|
|||
firstName: i.firstName,
|
||||
lastName: i.lastName,
|
||||
citizenId: i.citizenId,
|
||||
...(props.systemName?.includes("SALARY") && {
|
||||
amount: i.positionSalaryAmount,
|
||||
amountSpecial: i.amountSpecial,
|
||||
}),
|
||||
}));
|
||||
});
|
||||
|
||||
//Table
|
||||
const rows = ref<any[]>([]);
|
||||
const selected = ref<any[]>([]);
|
||||
|
|
@ -143,6 +148,7 @@ function onSubmit() {
|
|||
commandNo: commandNo.value,
|
||||
persons: selected.value ? dataMapToSend.value : [],
|
||||
};
|
||||
|
||||
await http
|
||||
.post(config.API.command + `/person`, body)
|
||||
.then(async (res) => {
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ async function fetchData() {
|
|||
isDraft.value = data.isDraft;
|
||||
isSign.value = data.isSign;
|
||||
isAttachment.value = data.isAttachment;
|
||||
store.isSalary = data.isSalary
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
|
|||
|
|
@ -6,13 +6,14 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useCommandMainStore } from "@/modules/18_command/store/Main";
|
||||
|
||||
import { useCommandDetail } from "@/modules/18_command/store/DetailStore";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
const $q = useQuasar();
|
||||
const { showLoader, hideLoader, dialogConfirm, messageError, success } =
|
||||
useCounterMixin();
|
||||
const store = useCommandMainStore();
|
||||
const storeDetail = useCommandDetail();
|
||||
|
||||
const props = defineProps({
|
||||
getData: Function,
|
||||
|
|
@ -36,6 +37,7 @@ const formData = reactive<any>({
|
|||
mouthSalaryAmount: null,
|
||||
remarkVertical: null,
|
||||
remarkHorizontal: null,
|
||||
amountSpecial: null,
|
||||
});
|
||||
|
||||
const readonly = ref<boolean>(false);
|
||||
|
|
@ -167,12 +169,28 @@ watch(
|
|||
:class="getClass(!readonly)"
|
||||
mask="###,###,###,###,###,###"
|
||||
reverse-fill-mask
|
||||
:readonly="readonly"
|
||||
:readonly="!storeDetail.isSalary"
|
||||
:label="`${'เงินเดือน'}`"
|
||||
:rules="[(val: any) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="store.isShowSalary(type)"
|
||||
class="col-xs-6 col-sm-6 col-md-6"
|
||||
>
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
v-model="formData.amountSpecial"
|
||||
:class="getClass(!readonly)"
|
||||
:readonly="!storeDetail.isSalary"
|
||||
mask="###,###,###,###,###,###"
|
||||
reverse-fill-mask
|
||||
:label="`${'เงินค่าตอบแทนพิเศษ'}`"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="store.isShowSalary(type)"
|
||||
class="col-xs-6 col-sm-6 col-md-6"
|
||||
|
|
@ -184,7 +202,7 @@ watch(
|
|||
hide-bottom-space
|
||||
v-model="formData.positionSalaryAmount"
|
||||
:class="getClass(!readonly)"
|
||||
:readonly="readonly"
|
||||
:readonly="!storeDetail.isSalary"
|
||||
mask="###,###,###,###,###,###"
|
||||
reverse-fill-mask
|
||||
:label="`${'เงินประจำตำแหน่ง'}`"
|
||||
|
|
@ -202,7 +220,7 @@ watch(
|
|||
hide-bottom-space
|
||||
v-model="formData.monthSalaryAmount"
|
||||
:class="getClass(!readonly)"
|
||||
:readonly="readonly"
|
||||
:readonly="!storeDetail.isSalary"
|
||||
mask="###,###,###,###,###,###"
|
||||
reverse-fill-mask
|
||||
:label="`${'เงินค่าตอบแทนรายเดือน'}`"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export const useCommandDetail = defineStore("commandDetailStore", () => {
|
|||
const readonly = ref<boolean>(false);
|
||||
const dataCommand = ref<FormDataDetail>();
|
||||
const status = ref<string>("");
|
||||
|
||||
const isSalary = ref<boolean>(false)
|
||||
function checkStep(val: string) {
|
||||
status.value = val;
|
||||
switch (val) {
|
||||
|
|
@ -39,5 +39,6 @@ export const useCommandDetail = defineStore("commandDetailStore", () => {
|
|||
readonly,
|
||||
status,
|
||||
dataCommand,
|
||||
isSalary
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue