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