This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-06 15:25:36 +07:00
parent 4120aee9f2
commit 5ad5857df4
2 changed files with 44 additions and 11 deletions

View file

@ -255,7 +255,12 @@ onMounted(async () => {
/></q-item-section>
<q-item-section>ไฟล .docx</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="downloadReport('xlsx')">
<q-item
clickable
v-close-popup
@click="downloadReport('xlsx')"
v-if="typeReport !== 'report1'"
>
<q-item-section avatar
><q-icon color="green" name="mdi-file-excel"
/></q-item-section>

View file

@ -11,6 +11,7 @@ import { checkPermission } from "@/utils/permissions";
import http from "@/plugins/http";
import config from "@/app.config";
import genReportXLSX from "@/plugins/genreportxlsx";
import genReportDocx from "@/plugins/genreport";
import type { DataStructureTree } from "@/interface/main";
import type {
@ -260,6 +261,16 @@ function getCurrentWeek() {
return [firstDayOfWeek, lastDayOfWeek];
}
function downloadReport(type: string) {
const fileName =
typeReport.value === "1" ? "รายงานการเข้างาน" : "รายงานการเข้างานสาย";
// if (type === "pdf") {
// genReportDocx(detailReport.value, fileName, type);
// } else {
genReportXLSX(detailReport.value, fileName, type);
// }
}
onMounted(() => {
fetchDataTree();
});
@ -291,6 +302,16 @@ onMounted(() => {
</div>
<q-space />
<!-- @click.stop.pervent="
genReportXLSX(
detailReport,
`${
typeReport === '1'
? 'รายงานการเข้างาน'
: 'รายงานการเข้างานสาย'
}`
)
" -->
<q-btn
v-if="checkPermission($route)?.attrIsGet"
@ -300,17 +321,24 @@ onMounted(() => {
round
color="primary"
icon="download"
@click.stop.pervent="
genReportXLSX(
detailReport,
`${
typeReport === '1'
? 'รายงานการเข้างาน'
: 'รายงานการเข้างานสาย'
}`
)
"
>
<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('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>