แก้ชื่อรายงานลงเวลาและการลาให้ถูกต้อง (แก้ id รายงานเป็น number) และลบไฟล์ที่ไม่ได้ใช้แล้วทิ้ง
This commit is contained in:
parent
f258a9fcfe
commit
c9f23a4369
4 changed files with 63 additions and 1097 deletions
|
|
@ -16,6 +16,7 @@ import config from "@/app.config";
|
|||
import type { DataStructureTree } from "@/interface/main";
|
||||
import type {
|
||||
DataOption,
|
||||
DataOption2,
|
||||
DataDateMonthObject,
|
||||
} from "@/modules/09_leave/interface/index/Main";
|
||||
|
||||
|
|
@ -54,43 +55,28 @@ const pageName = ref<string>(route.name as string);
|
|||
const dateWeek = ref<Date[]>(getCurrentWeek());
|
||||
const date = ref<Date>(new Date());
|
||||
|
||||
const typeReport = ref<string>("");
|
||||
const optionReport = ref<DataOption[]>([]);
|
||||
const optionReportMain = ref<DataOption[]>(
|
||||
const typeReport = ref<number | null>(null);
|
||||
const optionReport = ref<DataOption2[]>([
|
||||
{
|
||||
id: 3,
|
||||
name: "รายงานการเข้างาน",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "รายงานการเข้างานสาย",
|
||||
},
|
||||
{ id: 1, name: "รายงานการลางานตามประเภทการลา" },
|
||||
{
|
||||
id: 2,
|
||||
name: "รายงานการลางาน จำแนกตามเพศ ประเภทการลา หน่วยงาน/ส่วนราชการ",
|
||||
},
|
||||
]);
|
||||
const optionReportMain = ref<DataOption2[]>(
|
||||
route.name?.toString() === "reportLeave"
|
||||
? [
|
||||
{
|
||||
id: "3",
|
||||
name: "รายงานการเข้างาน",
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
name: "รายงานการเข้างานสาย",
|
||||
},
|
||||
{ id: "1", name: "รายงานการลางานตามประเภทการลา" },
|
||||
{
|
||||
id: "2",
|
||||
name: "รายงานการลางาน จำแนกตามเพศ ประเภทการลา หน่วยงาน/ส่วนราชการ",
|
||||
},
|
||||
]
|
||||
? optionReport.value
|
||||
: route.name?.toString() === "leaveReport"
|
||||
? [
|
||||
{ id: "1", name: "รายงานการลางานตามประเภทการลา" },
|
||||
{
|
||||
id: "2",
|
||||
name: "รายงานการลางาน จำแนกตามเพศ ประเภทการลา หน่วยงาน/ส่วนราชการ",
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
id: "3",
|
||||
name: "รายงานการเข้างาน",
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
name: "รายงานการเข้างานสาย",
|
||||
},
|
||||
]
|
||||
? optionReport.value.filter((item) => item.id === 1 || item.id === 2)
|
||||
: optionReport.value.filter((item) => item.id === 3 || item.id === 4)
|
||||
);
|
||||
|
||||
const employeeClass = ref<string>("officer");
|
||||
|
|
@ -158,7 +144,7 @@ function onSelectedNode(data: any) {
|
|||
*/
|
||||
async function updateLeaveday() {
|
||||
const list =
|
||||
typeReport.value == "3" || typeReport.value == "4"
|
||||
typeReport.value == 3 || typeReport.value == 4
|
||||
? leaveType.value
|
||||
: yearType.value;
|
||||
switch (list) {
|
||||
|
|
@ -251,11 +237,11 @@ async function fetchLeaveday(
|
|||
};
|
||||
|
||||
const pathAPI =
|
||||
typeReport.value === "1"
|
||||
typeReport.value === 1
|
||||
? config.API.leaveReportLeaveday(type)
|
||||
: typeReport.value === "2"
|
||||
: typeReport.value === 2
|
||||
? config.API.leaveReportLeave2(type)
|
||||
: typeReport.value === "3"
|
||||
: typeReport.value === 3
|
||||
? config.API.leaveReportTimeRecords(type)
|
||||
: config.API.leaveReportTimeLate(type);
|
||||
|
||||
|
|
@ -349,7 +335,7 @@ function clearData() {
|
|||
nodeId.value = "";
|
||||
nodeLevel.value = 0;
|
||||
org.value = "";
|
||||
typeReport.value = "";
|
||||
typeReport.value = null;
|
||||
yearType.value = "FULL";
|
||||
leaveType.value = "DAY";
|
||||
pdfSrc.value = undefined;
|
||||
|
|
@ -370,7 +356,7 @@ function onSearch() {
|
|||
updateLeaveday();
|
||||
fetchLeaveday(
|
||||
employeeClass.value,
|
||||
typeReport.value == "3" || typeReport.value == "4"
|
||||
typeReport.value == 3 || typeReport.value == 4
|
||||
? leaveType.value
|
||||
: yearType.value,
|
||||
dateStart.value,
|
||||
|
|
@ -389,7 +375,7 @@ function getCurrentWeek() {
|
|||
}
|
||||
|
||||
function updateValue(val: string) {
|
||||
if (typeReport.value == "3" || typeReport.value == "4") {
|
||||
if (typeReport.value == 3 || typeReport.value == 4) {
|
||||
leaveType.value = val;
|
||||
} else {
|
||||
yearType.value = val;
|
||||
|
|
@ -409,7 +395,7 @@ const isLoad = ref<boolean>(false);
|
|||
* @param isName ชื่อไฟล์
|
||||
* @param fileType pdf/xlsx
|
||||
*/
|
||||
function getReport(isName: string) {
|
||||
function getReport() {
|
||||
showLoader();
|
||||
const body = {
|
||||
type:
|
||||
|
|
@ -449,7 +435,7 @@ function getReport(isName: string) {
|
|||
// สร้างลิงก์เพื่อดาวน์โหลดไฟล์
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = `${isName}.xlsx`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
|
||||
link.download = `${reportName()}.xlsx`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
|
|
@ -464,6 +450,19 @@ function getReport(isName: string) {
|
|||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
const reportName = () => {
|
||||
const employeeClassName =
|
||||
employeeClass.value === "officer"
|
||||
? " (ข้าราชการ กทม. สามัญ)"
|
||||
: " (ลูกจ้างประจำ กทม.)";
|
||||
|
||||
const reportNameVal =
|
||||
optionReportMain.value.find((item) => item.id === typeReport.value)?.name ||
|
||||
"";
|
||||
return reportNameVal + employeeClassName;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
fetchDataTree();
|
||||
});
|
||||
|
|
@ -509,7 +508,7 @@ onMounted(() => {
|
|||
round
|
||||
color="primary"
|
||||
icon="download"
|
||||
v-if="checkPermission($route)?.attrIsGet && typeReport !== '3'"
|
||||
v-if="checkPermission($route)?.attrIsGet && typeReport !== 3"
|
||||
>
|
||||
<q-menu>
|
||||
<q-list style="min-width: 150px">
|
||||
|
|
@ -517,23 +516,7 @@ onMounted(() => {
|
|||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
genReportXLSX(
|
||||
detailReport,
|
||||
`${
|
||||
typeReport === '1'
|
||||
? `รายงานการลางานตามประเภทการลา (${
|
||||
employeeClass === 'officer'
|
||||
? 'ข้าราชการ กทม. สามัญ'
|
||||
: 'ลูกจ้างประจำ กทม.'
|
||||
})`
|
||||
: `รายงานการลางาน จำแนกตามเพศ ประเภทการลา หน่วยงาน/ส่วนราชการ (${
|
||||
employeeClass === 'officer'
|
||||
? 'ข้าราชการ กทม. สามัญ'
|
||||
: 'ลูกจ้างประจำ กทม.'
|
||||
})`
|
||||
}`,
|
||||
'pdf'
|
||||
)
|
||||
genReportXLSX(detailReport, `${reportName()}`, 'pdf')
|
||||
"
|
||||
>
|
||||
<q-item-section avatar
|
||||
|
|
@ -544,24 +527,7 @@ onMounted(() => {
|
|||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
genReportXLSX(
|
||||
detailReport,
|
||||
`${
|
||||
typeReport === '1'
|
||||
? `รายงานการลางานตามประเภทการลา (${
|
||||
employeeClass === 'officer'
|
||||
? 'ข้าราชการ กทม. สามัญ'
|
||||
: 'ลูกจ้างประจำ กทม.'
|
||||
})`
|
||||
: `รายงานการลางาน จำแนกตามเพศ ประเภทการลา หน่วยงาน/ส่วนราชการ (${
|
||||
employeeClass === 'officer'
|
||||
? 'ข้าราชการ กทม. สามัญ'
|
||||
: 'ลูกจ้างประจำ กทม.'
|
||||
})`
|
||||
}`
|
||||
)
|
||||
"
|
||||
@click="genReportXLSX(detailReport, `${reportName()}`)"
|
||||
>
|
||||
<q-item-section avatar
|
||||
><q-icon color="green" name="mdi-file-excel"
|
||||
|
|
@ -577,16 +543,8 @@ onMounted(() => {
|
|||
round
|
||||
color="primary"
|
||||
icon="download"
|
||||
v-if="checkPermission($route)?.attrIsGet && typeReport == '3'"
|
||||
@click="
|
||||
getReport(
|
||||
`${`รายงานการลางาน จำแนกตามเพศ ประเภทการลา หน่วยงาน/ส่วนราชการ (${
|
||||
employeeClass === 'officer'
|
||||
? 'ข้าราชการ กทม. สามัญ'
|
||||
: 'ลูกจ้างประจำ กทม.'
|
||||
})`}`
|
||||
)
|
||||
"
|
||||
v-if="checkPermission($route)?.attrIsGet && typeReport == 3"
|
||||
@click="getReport()"
|
||||
>
|
||||
</q-btn>
|
||||
</div>
|
||||
|
|
@ -744,12 +702,12 @@ onMounted(() => {
|
|||
class="bg-white"
|
||||
dense
|
||||
:model-value="
|
||||
typeReport == '3' || typeReport == '4'
|
||||
typeReport == 3 || typeReport == 4
|
||||
? leaveType
|
||||
: yearType
|
||||
"
|
||||
:options="
|
||||
typeReport == '3' || typeReport == '4'
|
||||
typeReport == 3 || typeReport == 4
|
||||
? leaveTypeOptionOption
|
||||
: yearTypeOptionOption
|
||||
"
|
||||
|
|
@ -765,8 +723,8 @@ onMounted(() => {
|
|||
class="col-12"
|
||||
v-if="
|
||||
yearType !== 'MONTH' &&
|
||||
typeReport !== '3' &&
|
||||
typeReport !== '4'
|
||||
typeReport !== 3 &&
|
||||
typeReport !== 4
|
||||
"
|
||||
>
|
||||
<datepicker
|
||||
|
|
@ -805,8 +763,8 @@ onMounted(() => {
|
|||
class="col-12"
|
||||
v-if="
|
||||
yearType !== 'MONTH' &&
|
||||
typeReport !== '3' &&
|
||||
typeReport !== '4'
|
||||
typeReport !== 3 &&
|
||||
typeReport !== 4
|
||||
"
|
||||
>
|
||||
<datepicker
|
||||
|
|
@ -848,8 +806,8 @@ onMounted(() => {
|
|||
class="col-12"
|
||||
v-if="
|
||||
yearType !== 'MONTH' &&
|
||||
typeReport !== '3' &&
|
||||
typeReport !== '4'
|
||||
typeReport !== 3 &&
|
||||
typeReport !== 4
|
||||
"
|
||||
>
|
||||
<datepicker
|
||||
|
|
@ -885,15 +843,7 @@ onMounted(() => {
|
|||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div
|
||||
class="col-12"
|
||||
v-if="
|
||||
(typeReport == '1' && yearType == 'MONTH') ||
|
||||
(typeReport == '2' && yearType == 'MONTH') ||
|
||||
(typeReport == '3' && leaveType == 'MONTH') ||
|
||||
(typeReport == '4' && leaveType == 'MONTH')
|
||||
"
|
||||
>
|
||||
<div class="col-12" v-if="yearType == 'MONTH'">
|
||||
<datepicker
|
||||
v-model="dateMonth"
|
||||
:locale="'th'"
|
||||
|
|
@ -925,15 +875,7 @@ onMounted(() => {
|
|||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div
|
||||
class="col-12"
|
||||
v-if="
|
||||
(typeReport == '1' && yearType == 'WEEKLY') ||
|
||||
(typeReport == '2' && yearType == 'WEEKLY') ||
|
||||
(typeReport == '3' && leaveType == 'WEEKLY') ||
|
||||
(typeReport == '4' && leaveType == 'WEEKLY')
|
||||
"
|
||||
>
|
||||
<div class="col-12" v-if="leaveType == 'WEEKLY'">
|
||||
<datepicker
|
||||
v-model="dateWeek"
|
||||
:locale="'th'"
|
||||
|
|
@ -967,8 +909,8 @@ onMounted(() => {
|
|||
<div
|
||||
class="col-12"
|
||||
v-if="
|
||||
(leaveType == 'DAY' && typeReport == '3') ||
|
||||
(leaveType == 'DAY' && typeReport == '4')
|
||||
(leaveType == 'DAY' && typeReport == 3) ||
|
||||
(leaveType == 'DAY' && typeReport == 4)
|
||||
"
|
||||
>
|
||||
<datepicker
|
||||
|
|
@ -1008,7 +950,7 @@ onMounted(() => {
|
|||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
v-if="typeReport !== '3'"
|
||||
v-if="typeReport !== 3"
|
||||
dense
|
||||
class="q-px-md"
|
||||
label="ค้นหา"
|
||||
|
|
@ -1017,9 +959,7 @@ onMounted(() => {
|
|||
type="submit"
|
||||
:disable="
|
||||
typeReport &&
|
||||
(typeReport == '2' ||
|
||||
typeReport == '3' ||
|
||||
typeReport == '4') &&
|
||||
(typeReport == 2 || typeReport == 3 || typeReport == 4) &&
|
||||
org
|
||||
"
|
||||
/>
|
||||
|
|
@ -1028,7 +968,7 @@ onMounted(() => {
|
|||
</div>
|
||||
<div class="col-lg-9 col-md-9 col-sm-9 col-xs-12 col-xs-12 flex">
|
||||
<q-splitter
|
||||
v-if="typeReport !== '3'"
|
||||
v-if="typeReport !== 3"
|
||||
disable
|
||||
v-model="splitterModel"
|
||||
horizontal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue