feat: create export detail pdf xlsx anomali
This commit is contained in:
parent
944c7c62b3
commit
e8708e45f1
@ -1067,7 +1067,12 @@ import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers'
|
||||
import { queries, requestGraphQl } from '@/utils/api/api.graphql'
|
||||
import InputText from '@/components/InputText.vue'
|
||||
import DetailDialog from '@/components/Dialogs/DetailDialog.vue'
|
||||
import { exportToPDF, exportToXLSX } from '@/report/Anomali/Gangguan/Anomali_LAPPGU_LPT'
|
||||
import {
|
||||
exportToPDF,
|
||||
exportToXLSX,
|
||||
exportDetailToPDF,
|
||||
exportDetailToXLSX
|
||||
} from '@/report/Anomali/Gangguan/Anomali_LAPPGU_LPT'
|
||||
import BufferDialog from '@/components/Dialogs/BufferDialog.vue'
|
||||
|
||||
const position = { of: '#data' }
|
||||
@ -1191,7 +1196,14 @@ const onExporting = (e: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const onExportingDetail = (e: any) => {}
|
||||
const onExportingDetail = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
exportDetailToPDF(reportMeta.value, dataSub.value)
|
||||
} else if (e.format === 'xlsx') {
|
||||
exportDetailToXLSX(reportMeta.value, e)
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
const onDataSubSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
const data = selectedRowsData[0]
|
||||
|
@ -754,7 +754,12 @@ import { formatWaktu } from '@/components/Form/FiltersType/reference'
|
||||
import { queries, requestGraphQl } from '@/utils/api/api.graphql'
|
||||
import DetailDialog from '@/components/Dialogs/DetailDialog.vue'
|
||||
import InputText from '@/components/InputText.vue'
|
||||
import { exportToPDF, exportToXLSX } from '@/report/Anomali/Keluhan/Anomali_LAPPKU_LPT'
|
||||
import {
|
||||
exportToPDF,
|
||||
exportToXLSX,
|
||||
exportDetailToPDF,
|
||||
exportDetailToXLSX
|
||||
} from '@/report/Anomali/Keluhan/Anomali_LAPPKU_LPT'
|
||||
import BufferDialog from '@/components/Dialogs/BufferDialog.vue'
|
||||
|
||||
const position = { of: '#data' }
|
||||
@ -881,7 +886,14 @@ const showDetail = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const onExportingDetail = (e: any) => {}
|
||||
const onExportingDetail = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
exportDetailToPDF(reportMeta.value, dataSub.value)
|
||||
} else if (e.format === 'xlsx') {
|
||||
exportDetailToXLSX(reportMeta.value, e)
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
const onDataSubSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
const data = selectedRowsData[0]
|
||||
|
@ -22,7 +22,7 @@ import { formatNumber, formatPercentage } from '@/utils/numbers'
|
||||
|
||||
const reportName = 'Laporan Anomali Penanganan Pengaduan Gangguan Unit'
|
||||
const fontSize = 5
|
||||
const detailFontSize = 5
|
||||
const detailFontSize = 3
|
||||
|
||||
const formatData = (rawData: any) => {
|
||||
const formattedData: any = []
|
||||
@ -423,40 +423,66 @@ const exportDetailToPDF = (reportMeta: any, rawData: any) => {
|
||||
head: [
|
||||
[
|
||||
'No',
|
||||
'UIW/D',
|
||||
'UP3',
|
||||
'Rayon',
|
||||
'No Laporan',
|
||||
'Tgl Lapor',
|
||||
'Dalam Proses Bidang',
|
||||
'Selesai Bidang Unit',
|
||||
'No Laporan Referensi',
|
||||
'Tgl/Jam Lapor',
|
||||
'Tgl/Jam Datang',
|
||||
'Tgl/Jam Nyala',
|
||||
'Durasi Response Time',
|
||||
'Durasi Recovery Time',
|
||||
'Status',
|
||||
'Durasi Penugasan Regu',
|
||||
'Durasi Perjalanan Regu',
|
||||
'Jarak Closing',
|
||||
'Dispacth Oleh',
|
||||
'IDPEL/NO METER',
|
||||
'Nama Pelapor',
|
||||
'Alamat Pelapor',
|
||||
'No Telp Pelapor',
|
||||
'Keterangan Pelapor',
|
||||
'Rayon',
|
||||
'Uraian',
|
||||
'Response Pelanggan'
|
||||
'Sumber Lapor',
|
||||
'Diselesaikan Oleh',
|
||||
'Status',
|
||||
'Status Induk',
|
||||
'Referensi Marking Induk',
|
||||
'Kode Gangguan',
|
||||
'Jenis Gangguan',
|
||||
'Penyebab',
|
||||
'Tindakan'
|
||||
]
|
||||
],
|
||||
body: rawData.map((item: any, i: any) => [
|
||||
{ content: i + 1, styles: { halign: 'right' } },
|
||||
item.nama_uid,
|
||||
item.nama_up3,
|
||||
item.nama_ulp,
|
||||
item.no_laporan,
|
||||
item.no_laporan_referensi,
|
||||
item.waktu_lapor,
|
||||
item.waktu_response,
|
||||
item.waktu_recovery,
|
||||
item.durasi_response_time ? formatWaktu(item.durasi_response_time) : '-',
|
||||
item.durasi_recovery_time ? formatWaktu(item.durasi_recovery_time) : '-',
|
||||
item.status_akhir,
|
||||
item.durasi_dispatch_time ? formatWaktu(item.durasi_dispatch_time) : '-',
|
||||
item.durasi_perjalanan ? formatWaktu(item.durasi_perjalanan) : '-',
|
||||
item.distance,
|
||||
item.dispatch_by,
|
||||
item.idpel_nometer,
|
||||
item.nama_pelapor,
|
||||
item.alamat_pelapor,
|
||||
item.no_telp_pelapor,
|
||||
item.keterangan_pelapor,
|
||||
item.nama_ulp,
|
||||
item.uraian,
|
||||
item.respon_pelanggan
|
||||
item.media,
|
||||
item.diselesaikan_oleh,
|
||||
item.status_akhir,
|
||||
item.status_induk,
|
||||
item.referensi_marking_induk,
|
||||
item.kode_gangguan,
|
||||
item.jenis_gangguan,
|
||||
item.penyebab,
|
||||
item.tindakan
|
||||
]),
|
||||
styles: {
|
||||
fontSize: detailFontSize,
|
||||
@ -470,7 +496,6 @@ const exportDetailToPDF = (reportMeta: any, rawData: any) => {
|
||||
fillColor: [192, 192, 192],
|
||||
textColor: [0, 0, 0],
|
||||
fontStyle: 'bold',
|
||||
cellWidth: 'wrap',
|
||||
halign: 'center',
|
||||
valign: 'middle'
|
||||
},
|
||||
@ -602,9 +627,9 @@ const exportDetailToXLSX = (reportMeta: any, e: any) => {
|
||||
true
|
||||
)
|
||||
|
||||
worksheet.mergeCells('A1:P1')
|
||||
worksheet.mergeCells('A3:P3')
|
||||
worksheet.mergeCells('A4:P4')
|
||||
worksheet.mergeCells('A1:AC1')
|
||||
worksheet.mergeCells('A3:AC3')
|
||||
worksheet.mergeCells('A4:AC4')
|
||||
|
||||
exportToExcel({
|
||||
component: e.component,
|
||||
|
@ -302,7 +302,11 @@ const exportDetailToPDF = (reportMeta: any, rawData: any) => {
|
||||
head: [
|
||||
[
|
||||
'No',
|
||||
'UIW/D',
|
||||
'UP3',
|
||||
'Rayon',
|
||||
'No Laporan',
|
||||
'No Laporan Referensi',
|
||||
'Tgl Lapor',
|
||||
'Dalam Proses Bidang',
|
||||
'Selesai Bidang Unit',
|
||||
@ -314,14 +318,17 @@ const exportDetailToPDF = (reportMeta: any, rawData: any) => {
|
||||
'Alamat Pelapor',
|
||||
'No Telp Pelapor',
|
||||
'Keterangan Pelapor',
|
||||
'Rayon',
|
||||
'Uraian',
|
||||
'Response Pelanggan'
|
||||
]
|
||||
],
|
||||
body: rawData.map((item: any, i: any) => [
|
||||
{ content: i + 1, styles: { halign: 'right' } },
|
||||
item.nama_uid,
|
||||
item.nama_up3,
|
||||
item.nama_ulp,
|
||||
item.no_laporan,
|
||||
item.referensi_marking,
|
||||
item.waktu_lapor,
|
||||
item.waktu_response,
|
||||
item.waktu_recovery,
|
||||
@ -333,7 +340,6 @@ const exportDetailToPDF = (reportMeta: any, rawData: any) => {
|
||||
item.alamat_pelapor,
|
||||
item.no_telp_pelapor,
|
||||
item.keterangan_pelapor,
|
||||
item.nama_ulp,
|
||||
item.uraian,
|
||||
item.respon_pelanggan
|
||||
]),
|
||||
@ -349,7 +355,6 @@ const exportDetailToPDF = (reportMeta: any, rawData: any) => {
|
||||
fillColor: [192, 192, 192],
|
||||
textColor: [0, 0, 0],
|
||||
fontStyle: 'bold',
|
||||
cellWidth: 'wrap',
|
||||
halign: 'center',
|
||||
valign: 'middle'
|
||||
},
|
||||
@ -481,9 +486,9 @@ const exportDetailToXLSX = (reportMeta: any, e: any) => {
|
||||
true
|
||||
)
|
||||
|
||||
worksheet.mergeCells('A1:P1')
|
||||
worksheet.mergeCells('A3:P3')
|
||||
worksheet.mergeCells('A4:P4')
|
||||
worksheet.mergeCells('A1:S1')
|
||||
worksheet.mergeCells('A3:S3')
|
||||
worksheet.mergeCells('A4:S4')
|
||||
|
||||
exportToExcel({
|
||||
component: e.component,
|
||||
|
Loading…
x
Reference in New Issue
Block a user