feat: create pdf export in Daftar Gangguan Dialihkan ke Posko Lain
This commit is contained in:
parent
585a29dd77
commit
6ec891487a
@ -364,6 +364,7 @@ import { useQuery } from '@vue/apollo-composable'
|
|||||||
import { queries } from '@/utils/api/api.graphql'
|
import { queries } from '@/utils/api/api.graphql'
|
||||||
import { dummyData } from '@/utils/dummy'
|
import { dummyData } from '@/utils/dummy'
|
||||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||||
|
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
||||||
|
|
||||||
const position = { of: '#dataTable' }
|
const position = { of: '#dataTable' }
|
||||||
const showIndicator = ref(true)
|
const showIndicator = ref(true)
|
||||||
@ -377,13 +378,9 @@ const closeDetail = () => (showDetail.value = false)
|
|||||||
const onExporting = (e: any) => {
|
const onExporting = (e: any) => {
|
||||||
if (e.format === 'pdf') {
|
if (e.format === 'pdf') {
|
||||||
const doc = new jsPDF({
|
const doc = new jsPDF({
|
||||||
orientation: 'landscape',
|
orientation: 'landscape'
|
||||||
unit: 'mm',
|
|
||||||
format: 'F4'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Initialize page number
|
|
||||||
const pageNumber = ref(1)
|
|
||||||
autoTable(doc, {
|
autoTable(doc, {
|
||||||
head: [
|
head: [
|
||||||
[
|
[
|
||||||
@ -407,7 +404,6 @@ const onExporting = (e: any) => {
|
|||||||
'Posko'
|
'Posko'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
startY: 10,
|
|
||||||
body: data.value.map((item) => [
|
body: data.value.map((item) => [
|
||||||
item.no_laporan,
|
item.no_laporan,
|
||||||
item.pembuat_laporan,
|
item.pembuat_laporan,
|
||||||
@ -429,25 +425,74 @@ const onExporting = (e: any) => {
|
|||||||
item.posko
|
item.posko
|
||||||
]),
|
]),
|
||||||
styles: {
|
styles: {
|
||||||
fontSize: 6,
|
fontSize: 3
|
||||||
cellWidth: 'wrap'
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
doc.setProperties({
|
|
||||||
title: 'Daftar Gangguan Dialihkan Ke Posko Lain',
|
|
||||||
subject: 'Daftar Gangguan Dialihkan Ke Posko Lain'
|
|
||||||
})
|
|
||||||
|
|
||||||
pageNumber.value++ // Increment the pageNumber
|
doc.save('Daftar Gangguan Dialihkan Ke Posko Lain.pdf')
|
||||||
doc.save(`Daftar Gangguan Dialihkan Ke Posko Lain.pdf`)
|
|
||||||
|
|
||||||
// exportToPdf({
|
|
||||||
// jsPDFDocument: doc,
|
|
||||||
// component: e.component,
|
|
||||||
// }).then(() => {
|
|
||||||
// doc.save(`Daftar Gangguan Dialihkan Ke Posko Lain.pdf`)
|
|
||||||
|
|
||||||
|
// const doc = new jsPDF({
|
||||||
|
// orientation: 'landscape',
|
||||||
|
// unit: 'mm',
|
||||||
|
// format: 'F4'
|
||||||
// })
|
// })
|
||||||
|
// // Initialize page number
|
||||||
|
// const pageNumber = ref(1)
|
||||||
|
// autoTable(doc, {
|
||||||
|
// head: [
|
||||||
|
// [
|
||||||
|
// 'No Laporan',
|
||||||
|
// 'Pembuat Laporan',
|
||||||
|
// 'Tgl Lapor',
|
||||||
|
// 'Tgl Dialihkan',
|
||||||
|
// 'Tgl Response',
|
||||||
|
// 'Tgl Recovery',
|
||||||
|
// 'Durasi Response Time',
|
||||||
|
// 'Durasi Recovery Time',
|
||||||
|
// 'Posko Awal',
|
||||||
|
// 'Posko Tujuan',
|
||||||
|
// 'Status',
|
||||||
|
// 'IDPEL/NO METER',
|
||||||
|
// 'Nama Pelapor',
|
||||||
|
// 'Alamat Pelapor',
|
||||||
|
// 'No Telp Pelapor',
|
||||||
|
// 'Keterangan Pelapor',
|
||||||
|
// 'Sumber Lapor',
|
||||||
|
// 'Posko'
|
||||||
|
// ]
|
||||||
|
// ],
|
||||||
|
// startY: 10,
|
||||||
|
// body: data.value.map((item) => [
|
||||||
|
// item.no_laporan,
|
||||||
|
// item.pembuat_laporan,
|
||||||
|
// item.waktu_lapor,
|
||||||
|
// item.waktu_dialihkan,
|
||||||
|
// item.waktu_response,
|
||||||
|
// item.waktu_recovery,
|
||||||
|
// item.durasi_response_time,
|
||||||
|
// item.durasi_recovery_time,
|
||||||
|
// item.nama_posko_lama,
|
||||||
|
// item.nama_posko_baru,
|
||||||
|
// item.status_akhir,
|
||||||
|
// item.idpel_nometer,
|
||||||
|
// item.nama_pelapor,
|
||||||
|
// item.alamat_pelapor,
|
||||||
|
// item.no_telp_pelapor,
|
||||||
|
// item.keterangan_pelapor,
|
||||||
|
// item.media,
|
||||||
|
// item.posko
|
||||||
|
// ]),
|
||||||
|
// styles: {
|
||||||
|
// fontSize: 6,
|
||||||
|
// cellWidth: 'wrap'
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// doc.setProperties({
|
||||||
|
// title: 'Daftar Gangguan Dialihkan Ke Posko Lain',
|
||||||
|
// subject: 'Daftar Gangguan Dialihkan Ke Posko Lain'
|
||||||
|
// })
|
||||||
|
// pageNumber.value++ // Increment the pageNumber
|
||||||
|
// doc.save(`Daftar Gangguan Dialihkan Ke Posko Lain.pdf`)
|
||||||
} else {
|
} else {
|
||||||
const workbook = new Workbook()
|
const workbook = new Workbook()
|
||||||
const worksheet = workbook.addWorksheet('Daftar Gangguan Dialihkan Ke Posko Lain')
|
const worksheet = workbook.addWorksheet('Daftar Gangguan Dialihkan Ke Posko Lain')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user