fix(checkin-report): resolve preview display issue for typeReport 4

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-04-01 11:33:33 +07:00
parent 514de15f09
commit a6018507c9

View file

@ -269,6 +269,7 @@ async function fetchLeaveday(
* @param data อมลบญชนลา * @param data อมลบญชนลา
*/ */
async function fetchDocumentTemplate(data: any) { async function fetchDocumentTemplate(data: any) {
if (typeReport.value === 4) return;
await axios await axios
.post(`${config.API.reportTemplate}/xlsx`, data, { .post(`${config.API.reportTemplate}/xlsx`, data, {
headers: { headers: {
@ -352,7 +353,7 @@ function clearData() {
}; };
} }
function onSearch() { async function onSearch() {
isReport.value = false; isReport.value = false;
isLoadPDF.value = true; isLoadPDF.value = true;
pdfSrc.value = undefined; pdfSrc.value = undefined;
@ -467,6 +468,19 @@ const reportName = () => {
return reportNameVal + employeeClassName; return reportNameVal + employeeClassName;
}; };
async function handleDownload() {
updateLeaveday();
await fetchLeaveday(
employeeClass.value,
typeReport.value == 3 || typeReport.value == 4
? leaveType.value
: yearType.value,
dateStart.value,
dateEnd.value
);
await genReportXLSX(detailReport.value, `${reportName()}`);
}
onMounted(() => { onMounted(() => {
fetchDataTree(); fetchDataTree();
}); });
@ -512,7 +526,11 @@ onMounted(() => {
round round
color="primary" color="primary"
icon="download" icon="download"
v-if="checkPermission($route)?.attrIsGet && typeReport !== 3" v-if="
checkPermission($route)?.attrIsGet &&
typeReport !== 3 &&
typeReport !== 4
"
> >
<q-menu> <q-menu>
<q-list style="min-width: 150px"> <q-list style="min-width: 150px">
@ -547,8 +565,11 @@ onMounted(() => {
round round
color="primary" color="primary"
icon="download" icon="download"
v-if="checkPermission($route)?.attrIsGet && typeReport == 3" v-if="
@click="getReport()" checkPermission($route)?.attrIsGet &&
(typeReport == 3 || typeReport == 4)
"
@click="typeReport == 3 ? getReport() : handleDownload()"
> >
</q-btn> </q-btn>
</div> </div>
@ -957,7 +978,7 @@ onMounted(() => {
<q-separator /> <q-separator />
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn <q-btn
v-if="typeReport !== 3" v-if="typeReport !== 3 && typeReport !== 4"
dense dense
class="q-px-md" class="q-px-md"
label="ค้นหา" label="ค้นหา"
@ -976,7 +997,7 @@ onMounted(() => {
</div> </div>
<div class="col-lg-9 col-md-9 col-sm-9 col-xs-12 col-xs-12 flex"> <div class="col-lg-9 col-md-9 col-sm-9 col-xs-12 col-xs-12 flex">
<q-splitter <q-splitter
v-if="typeReport !== 3" v-if="typeReport !== 3 && typeReport !== 4"
disable disable
v-model="splitterModel" v-model="splitterModel"
horizontal horizontal