feat: create export pdf in rekapitulasi gangguan rating per posko

This commit is contained in:
kur0nek-o
2024-03-26 11:59:33 +07:00
parent 9c982dc21b
commit 1d71f2b660
2 changed files with 285 additions and 10 deletions

View File

@ -1,7 +1,14 @@
<template>
<Filters @run-search="() => filterData(filters)" :report-button="true" class="mb-4">
<Filters
@run-report="() => exportToPDF(reportMeta, data, true)"
@reset-form="data = []"
@run-search="() => filterData(filters)"
:report-button="true"
class="mb-4"
>
<Type1 @update:filters="(value) => (filters = value)" :showPosko="false" />
</Filters>
<div id="data">
<DxDataGrid
ref="dataGridRef"
@ -633,6 +640,7 @@ import InputText from '@/components/InputText.vue'
import vue3starRatings from 'vue3-star-ratings'
import { apolloClient } from '@/utils/api/api.graphql'
import { provideApolloClient } from '@vue/apollo-composable'
import { exportToPDF } from '@/report/Gangguan/Rekap/RGangguan_RatingPerPosko'
const client = apolloClient()
provideApolloClient(client)
@ -647,6 +655,11 @@ 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' },
periode: ''
})
const getDetail = () => {
loadingSubData.value = true
@ -707,15 +720,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')
@ -790,6 +795,8 @@ const filterData = (params: any) => {
}
})
}
reportMeta.value = filters.value
})
onError((error) => {
console.log(error)