feat: create pdf export in rekapitulasi gangguan per jenis gangguan SE004

This commit is contained in:
kur0nek-o
2024-03-25 09:23:43 +07:00
parent 0487301697
commit 3b6f7efccd
3 changed files with 458 additions and 11 deletions

View File

@ -4,6 +4,7 @@
<Filters
@reset-form="data = []"
:report-button="true"
@run-report="() => exportToPDF(reportMeta, data, true)"
@run-search="() => filterData(filters)"
class="mb-4"
>
@ -788,6 +789,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_JenisGangguanSE'
const client = apolloClient()
provideApolloClient(client)
@ -802,6 +804,12 @@ const dataSubSelected = ref<any>(null)
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 closeDialog = () => {
dialogDetail.value = false
@ -809,15 +817,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')
@ -860,6 +860,8 @@ const filterData = (params: any) => {
data.value = queryResult.data.rekapitulasiJenisGangguanSE004
console.log(queryResult.data.rekapitulasiJenisGangguanSE004)
}
reportMeta.value = filters.value
})
onError((queryError) => {