fix: pdf style daftar keluhan recovery time
This commit is contained in:
parent
cea4af20ac
commit
6d2bae4248
@ -517,8 +517,8 @@ const onExporting = (e: any) => {
|
|||||||
item.waktu_lapor,
|
item.waktu_lapor,
|
||||||
item.waktu_response,
|
item.waktu_response,
|
||||||
item.waktu_recovery,
|
item.waktu_recovery,
|
||||||
item.durasi_response_time,
|
parseInt(item.durasi_response_time) ? formatWaktu(item.durasi_response_time) : '-',
|
||||||
item.durasi_recovery_time,
|
parseInt(item.durasi_recovery_time) ? formatWaktu(item.durasi_recovery_time) : '-',
|
||||||
item.status_akhir,
|
item.status_akhir,
|
||||||
item.referensi_marking,
|
item.referensi_marking,
|
||||||
item.idpel_nometer,
|
item.idpel_nometer,
|
||||||
|
@ -504,8 +504,8 @@ const onExporting = (e: any) => {
|
|||||||
item.waktu_lapor,
|
item.waktu_lapor,
|
||||||
item.waktu_response,
|
item.waktu_response,
|
||||||
item.waktu_recovery,
|
item.waktu_recovery,
|
||||||
item.durasi_response_time,
|
parseInt(item.durasi_response_time) ? formatWaktu(item.durasi_response_time) : '-',
|
||||||
item.durasi_recovery_time,
|
parseInt(item.durasi_recovery_time) ? formatWaktu(item.durasi_recovery_time) : '-',
|
||||||
item.status_akhir,
|
item.status_akhir,
|
||||||
item.referensi_marking,
|
item.referensi_marking,
|
||||||
item.idpel_nometer,
|
item.idpel_nometer,
|
||||||
|
@ -339,6 +339,38 @@ const onSelectionChanged = ({ selectedRowsData }: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onExporting = (e: any) => {
|
const onExporting = (e: any) => {
|
||||||
|
const periode = reportMeta.value.periode ? reportMeta.value.periode.split(' s/d ') : ''
|
||||||
|
const minTime = reportMeta.value.minTime ? reportMeta.value.minTime : ''
|
||||||
|
const maxTime = reportMeta.value.maxTime ? reportMeta.value.maxTime : ''
|
||||||
|
|
||||||
|
let dateFromFormat = ''
|
||||||
|
let dateToFormat = ''
|
||||||
|
let dayTo = ''
|
||||||
|
let durasi = ''
|
||||||
|
|
||||||
|
if (minTime == '1441' && maxTime != '143998560') {
|
||||||
|
durasi = 'Melebihi SLA (>1 hari)'
|
||||||
|
} else if (minTime == '1' && maxTime == '1440') {
|
||||||
|
durasi = 'Dibawah / Sesuai SLA (<=1 hari)'
|
||||||
|
} else {
|
||||||
|
durasi = 'Durasi Menit'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (periode != '') {
|
||||||
|
const dateFrom = new Date(periode[0].split('-').reverse().join('-'))
|
||||||
|
const dateTo = new Date(periode[1].split('-').reverse().join('-'))
|
||||||
|
|
||||||
|
dateFromFormat = `${dateFrom.getDate()}-${dateFrom.toLocaleString('default', {
|
||||||
|
month: 'long'
|
||||||
|
})}-${dateFrom.getFullYear()}`
|
||||||
|
|
||||||
|
dateToFormat = `${dateTo.getDate()}-${dateTo.toLocaleString('default', {
|
||||||
|
month: 'long'
|
||||||
|
})}-${dateTo.getFullYear()}`
|
||||||
|
|
||||||
|
dayTo = dateTo.toLocaleString('default', { weekday: 'long' })
|
||||||
|
}
|
||||||
|
|
||||||
if (e.format === 'pdf') {
|
if (e.format === 'pdf') {
|
||||||
const doc = new jsPDF({
|
const doc = new jsPDF({
|
||||||
orientation: 'landscape'
|
orientation: 'landscape'
|
||||||
@ -346,7 +378,60 @@ const onExporting = (e: any) => {
|
|||||||
|
|
||||||
autoTable(doc, {
|
autoTable(doc, {
|
||||||
head: [
|
head: [
|
||||||
|
['PT. PLN(Persero)', '', ''],
|
||||||
[
|
[
|
||||||
|
{ content: 'UNIT INDUK', styles: { cellWidth: 25 } },
|
||||||
|
{ content: ':', styles: { cellWidth: 1 } },
|
||||||
|
reportMeta.value.uid
|
||||||
|
? reportMeta.value.uid.name.toUpperCase()
|
||||||
|
: 'Semua Unit Induk Distribusi/Wilayah'.toUpperCase()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'UNIT PELAKSANA PELAYANAN PELANGGAN',
|
||||||
|
':',
|
||||||
|
reportMeta.value.up3
|
||||||
|
? reportMeta.value.up3.name.toUpperCase()
|
||||||
|
: 'Semua Unit Pelaksanaan Pelayanan Pelanggan'.toUpperCase()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'UNIT LAYANAN PELANGGAN',
|
||||||
|
':',
|
||||||
|
reportMeta.value.ulp
|
||||||
|
? reportMeta.value.ulp.name.toUpperCase()
|
||||||
|
: 'Semua Unit Layanan Pelanggan'.toUpperCase()
|
||||||
|
],
|
||||||
|
['Durasi', ':', `${durasi} ${durasi == 'Durasi Menit' ? minTime + ' - ' + maxTime : ''}`]
|
||||||
|
],
|
||||||
|
styles: {
|
||||||
|
fontSize: 3,
|
||||||
|
cellPadding: 0.1,
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold'
|
||||||
|
},
|
||||||
|
theme: 'plain',
|
||||||
|
startY: 10
|
||||||
|
})
|
||||||
|
|
||||||
|
autoTable(doc, {
|
||||||
|
head: [
|
||||||
|
['Daftar Keluhan Recovery Time'.toUpperCase()],
|
||||||
|
[`PERIODE TANGGAL : ${dateFromFormat} SD TGL ${dateToFormat}`]
|
||||||
|
],
|
||||||
|
styles: {
|
||||||
|
fontSize: 3,
|
||||||
|
cellPadding: 0.1,
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold',
|
||||||
|
halign: 'center'
|
||||||
|
},
|
||||||
|
theme: 'plain',
|
||||||
|
startY: 18
|
||||||
|
})
|
||||||
|
|
||||||
|
autoTable(doc, {
|
||||||
|
head: [
|
||||||
|
[
|
||||||
|
'No',
|
||||||
'No Laporan',
|
'No Laporan',
|
||||||
'Tgl Lapor',
|
'Tgl Lapor',
|
||||||
'Tgl Response',
|
'Tgl Response',
|
||||||
@ -362,27 +447,75 @@ const onExporting = (e: any) => {
|
|||||||
'Nama ULP'
|
'Nama ULP'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
body: data.value.map((i) => [
|
body: data.value.map((item: any, i: any) => [
|
||||||
i.no_laporan,
|
{ content: ++i, styles: { halign: 'right' } },
|
||||||
i.waktu_lapor,
|
item.no_laporan,
|
||||||
i.waktu_response,
|
item.waktu_lapor,
|
||||||
i.waktu_recovery,
|
item.waktu_response,
|
||||||
parseInt(i.durasi_response_time) ? formatWaktu(i.durasi_response_time) : '-',
|
item.waktu_recovery,
|
||||||
parseInt(i.durasi_recovery_time) ? formatWaktu(i.durasi_recovery_time) : '-',
|
parseInt(item.durasi_response_time) ? formatWaktu(item.durasi_response_time) : '-',
|
||||||
i.status_akhir,
|
parseInt(item.durasi_recovery_time) ? formatWaktu(item.durasi_recovery_time) : '-',
|
||||||
i.idpel_nometer,
|
item.status_akhir,
|
||||||
i.nama_pelapor,
|
item.idpel_nometer,
|
||||||
i.alamat_pelapor,
|
item.nama_pelapor,
|
||||||
i.no_telp_pelapor,
|
item.alamat_pelapor,
|
||||||
i.keterangan_pelapor,
|
item.no_telp_pelapor,
|
||||||
i.nama_ulp
|
item.keterangan_pelapor,
|
||||||
|
item.nama_ulp
|
||||||
]),
|
]),
|
||||||
styles: {
|
styles: {
|
||||||
fontSize: 4
|
fontSize: 3,
|
||||||
}
|
cellPadding: 1,
|
||||||
|
lineColor: [0, 0, 0],
|
||||||
|
lineWidth: 0.1,
|
||||||
|
cellWidth: 'auto'
|
||||||
|
},
|
||||||
|
rowPageBreak: 'auto',
|
||||||
|
headStyles: {
|
||||||
|
fillColor: [192, 192, 192],
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold',
|
||||||
|
cellWidth: 'wrap',
|
||||||
|
halign: 'center'
|
||||||
|
},
|
||||||
|
bodyStyles: {
|
||||||
|
textColor: [0, 0, 0]
|
||||||
|
},
|
||||||
|
didParseCell: function (data) {
|
||||||
|
if (data.row.section === 'head') {
|
||||||
|
data.cell.text = data.cell.text.map(function (word: any) {
|
||||||
|
return word.toUpperCase()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
startY: 23
|
||||||
})
|
})
|
||||||
|
|
||||||
doc.save('Daftar Keluhan Recovery Time.pdf')
|
autoTable(doc, {
|
||||||
|
head: [
|
||||||
|
[`${dayTo}, ${dateToFormat}`],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
content: '(.........................................)',
|
||||||
|
styles: { minCellHeight: 8, valign: 'bottom' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
styles: {
|
||||||
|
fontSize: 3,
|
||||||
|
cellPadding: 0.1,
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold',
|
||||||
|
halign: 'center'
|
||||||
|
},
|
||||||
|
theme: 'plain',
|
||||||
|
tableWidth: 50,
|
||||||
|
margin: { left: 230 }
|
||||||
|
})
|
||||||
|
|
||||||
|
doc.save('Laporan Daftar Keluhan Recovery Time.pdf', { returnPromise: true }).then(() => {
|
||||||
|
console.log('pdf berhasil disimpan')
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
const workbook = new Workbook()
|
const workbook = new Workbook()
|
||||||
const worksheet = workbook.addWorksheet('Daftar Keluhan Recovery Time')
|
const worksheet = workbook.addWorksheet('Daftar Keluhan Recovery Time')
|
||||||
@ -422,6 +555,7 @@ const { onResult, onError, loading, refetch } = useQuery(
|
|||||||
const filterData = (params: any) => {
|
const filterData = (params: any) => {
|
||||||
const dateValue = params.periode.split(' s/d ')
|
const dateValue = params.periode.split(' s/d ')
|
||||||
const { ulp, uid, up3, minTime, maxTime } = params
|
const { ulp, uid, up3, minTime, maxTime } = params
|
||||||
|
|
||||||
refetch({
|
refetch({
|
||||||
dateFrom: dateValue[0]
|
dateFrom: dateValue[0]
|
||||||
? dateValue[0].split('-').reverse().join('-')
|
? dateValue[0].split('-').reverse().join('-')
|
||||||
@ -435,20 +569,33 @@ const filterData = (params: any) => {
|
|||||||
idUid: uid ? uid.id : 0,
|
idUid: uid ? uid.id : 0,
|
||||||
idUp3: up3 ? up3.id : 0
|
idUp3: up3 ? up3.id : 0
|
||||||
})
|
})
|
||||||
|
|
||||||
onResult((queryResult) => {
|
onResult((queryResult) => {
|
||||||
if (queryResult.data != undefined) {
|
if (queryResult.data != undefined) {
|
||||||
data.value = queryResult.data.daftarKeluhanRecoveryTime
|
data.value = queryResult.data.daftarKeluhanRecoveryTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reportMeta.value = filters.value
|
||||||
console.log(queryResult.data)
|
console.log(queryResult.data)
|
||||||
console.log(queryResult.loading)
|
console.log(queryResult.loading)
|
||||||
console.log(queryResult.networkStatus)
|
console.log(queryResult.networkStatus)
|
||||||
})
|
})
|
||||||
|
|
||||||
onError((error) => {
|
onError((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const filters = ref()
|
const filters = ref()
|
||||||
|
const reportMeta = ref({
|
||||||
|
uid: { id: 0, name: 'Semua Unit Induk Distribusi/Wilayah' },
|
||||||
|
up3: { id: 0, name: 'Semua Unit Pelaksanaan Pelayanan Pelanggan' },
|
||||||
|
ulp: { id: 0, name: 'Semua Unit Layanan Pelanggan' },
|
||||||
|
periode: '',
|
||||||
|
minTime: '',
|
||||||
|
maxTime: ''
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (import.meta.env.DEV) {
|
if (import.meta.env.DEV) {
|
||||||
data.value = dummyData.keluhan.daftar.daftarKeluhanRecoveryTime
|
data.value = dummyData.keluhan.daftar.daftarKeluhanRecoveryTime
|
||||||
|
@ -367,10 +367,10 @@ const onExporting = (e: any) => {
|
|||||||
let dayTo = ''
|
let dayTo = ''
|
||||||
let durasi = ''
|
let durasi = ''
|
||||||
|
|
||||||
if (minTime == '46' && maxTime != '143998560') {
|
if (minTime == '1441' && maxTime != '143998560') {
|
||||||
durasi = 'Melebihi SLA (>45 Menit)'
|
durasi = 'Melebihi SLA (>1 hari)'
|
||||||
} else if (minTime == '1' && maxTime == '45') {
|
} else if (minTime == '1' && maxTime == '1440') {
|
||||||
durasi = 'Dibawah / Sesuai SLA (<=45 Menit)'
|
durasi = 'Dibawah / Sesuai SLA (<=1 hari)'
|
||||||
} else {
|
} else {
|
||||||
durasi = 'Durasi Menit'
|
durasi = 'Durasi Menit'
|
||||||
}
|
}
|
||||||
@ -472,8 +472,8 @@ const onExporting = (e: any) => {
|
|||||||
item.waktu_lapor,
|
item.waktu_lapor,
|
||||||
item.waktu_response,
|
item.waktu_response,
|
||||||
item.waktu_recovery,
|
item.waktu_recovery,
|
||||||
item.durasi_response_time,
|
parseInt(item.durasi_response_time) ? formatWaktu(item.durasi_response_time) : '-',
|
||||||
item.durasi_recovery_time,
|
parseInt(item.durasi_recovery_time) ? formatWaktu(item.durasi_recovery_time) : '-',
|
||||||
item.status_akhir,
|
item.status_akhir,
|
||||||
item.idpel_nometer,
|
item.idpel_nometer,
|
||||||
item.nama_pelapor,
|
item.nama_pelapor,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user