fix report

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-21 13:11:22 +07:00
parent b194cb2a25
commit b925026c2f
4 changed files with 61 additions and 57 deletions

View file

@ -45,6 +45,8 @@ const detailReport = ref<any>();
* @param endDate นสนส
*/
async function getReportRecruit() {
pdfSrc.value = undefined;
page.value = 1;
showLoader();
await http
.get(
@ -70,8 +72,6 @@ async function getReportRecruit() {
* @param data อมลบญชนลา
*/
async function genReport(data: any) {
pdfSrc.value = undefined;
page.value = 1;
await axios
.post(`${config.API.reportTemplate}/xlsx`, data, {
headers: {
@ -202,14 +202,15 @@ function filterFnOptions(val: any, update: Function) {
</div>
<q-space />
<div class="q-py-xs">
<q-btn
flat
round
color="primary"
icon="download"
:disable="
!checkPermission($route)?.attrIsGet &&
isReport &&
!checkPermission($route)?.attrIsGet ||
isReport ||
reportSelect.id == ''
"
>

View file

@ -142,7 +142,7 @@ async function onUpdateFilter() {
.post(config.API.disciplineReportByType(employeeClass.value), body)
.then(async (res) => {
const data = res.data.result;
detailReport.value = data;
// detailReport.value = data;
data && (await genReportPreview(data));
})
.catch(async (e) => {
@ -299,6 +299,7 @@ onMounted(async () => {
color="primary"
icon="download"
v-if="checkPermission($route)?.attrIsGet"
:loading="isLoadPDF"
>
<q-menu>
<q-list style="min-width: 150px">

View file

@ -239,56 +239,58 @@ onMounted(async () => {
</div>
<q-space />
<q-btn
:disable="
!typeReport ||
((typeReport == 'main' || typeReport == 'report3') &&
!organization)
"
:loading="loadingBtn"
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="
genReportXLSX(
detailReport,
`รายการโครงการ/หลักสูตรการฝึกอบรมที่หน่วยงานของกรุงเทพมหานครเป็นผู้จัด`,
'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,
`รายการโครงการ/หลักสูตรการฝึกอบรมที่หน่วยงานของกรุงเทพมหานครเป็นผู้จัด`,
'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>
<q-btn
:disable="
!typeReport ||
((typeReport == 'main' || typeReport == 'report3') &&
!organization)
"
:loading="loadingBtn"
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="
genReportXLSX(
detailReport,
`รายการโครงการ/หลักสูตรการฝึกอบรมที่หน่วยงานของกรุงเทพมหานครเป็นผู้จัด`,
'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,
`รายการโครงการ/หลักสูตรการฝึกอบรมที่หน่วยงานของกรุงเทพมหานครเป็นผู้จัด`,
'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>
<div v-if="typeReport" class="row col-12">

View file

@ -52,8 +52,8 @@ async function genReportXLSX(
URL.revokeObjectURL(url);
}
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();