feat: create pdf export in rekapitulasi gangguan diselesaikan mobile apkt

This commit is contained in:
kur0nek-o
2024-03-26 11:18:10 +07:00
parent 72a2217c5a
commit 9c982dc21b
2 changed files with 431 additions and 10 deletions

View File

@ -1,7 +1,14 @@
<template>
<Filters @run-search="() => filterData(filters)" :report-button="true" class="mb-4">
<Filters
@reset-form="data = []"
@run-report="() => exportToPDF(reportMeta, data, true)"
@run-search="() => filterData(filters)"
:report-button="true"
class="mb-4"
>
<Type1 @update:filters="(value) => (filters = value)" />
</Filters>
<div id="data">
<DxDataGrid
ref="dataGridRef"
@ -779,6 +786,7 @@ import InputText from '@/components/InputText.vue'
import DetailDialog from '@/components/Dialogs/DetailDialog.vue'
import { apolloClient } from '@/utils/api/api.graphql'
import { provideApolloClient } from '@vue/apollo-composable'
import { exportToPDF } from '@/report/Gangguan/Rekap/RGangguan_DMAPKT'
const client = apolloClient()
provideApolloClient(client)
@ -793,6 +801,12 @@ const dataSubSelected = ref<any>()
const dialogDetail = ref(false)
const loadingData = ref(false)
const loadingSubData = ref(false)
const reportMeta = ref({
uid: { id: 0, name: 'Semua Unit Induk Distribusi/Wilayah' },
up3: { id: 0, name: 'Semua Unit Pelaksanaan Pelayanan Pelanggan' },
posko: { id: 0, name: 'Semua Posko' },
periode: ''
})
const getDetail = () => {
loadingSubData.value = true
@ -854,15 +868,7 @@ const closeDialog = () => {
const onExporting = (e: any) => {
if (e.format === 'pdf') {
const doc = new jsPDF()
exportToPdf({
jsPDFDocument: doc,
component: e.component,
indent: 5
}).then(() => {
doc.save(`.pdf`)
})
exportToPDF(reportMeta.value, data.value)
} else {
const workbook = new Workbook()
const worksheet = workbook.addWorksheet('Employees')
@ -918,6 +924,8 @@ const filterData = (params: any) => {
data.value = queryResult.data.rekapitulasiGangguanDiselesaikanMobileAPKT
}
console.log(queryResult.data)
reportMeta.value = filters.value
})
onError((error) => {