fix: pdf style daftar keluhan selesai tanpa id pelanggan
This commit is contained in:
parent
6d2bae4248
commit
952c277b0f
@ -374,8 +374,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.nama_posko,
|
item.nama_posko,
|
||||||
item.waktu_media,
|
item.waktu_media,
|
||||||
item.keterangan_media
|
item.keterangan_media
|
||||||
|
@ -484,8 +484,8 @@ const onExporting = (e: any) => {
|
|||||||
item.waktu_dialihkan,
|
item.waktu_dialihkan,
|
||||||
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.nama_posko_lama,
|
item.nama_posko_lama,
|
||||||
item.nama_posko_baru,
|
item.nama_posko_baru,
|
||||||
item.status_akhir,
|
item.status_akhir,
|
||||||
|
@ -363,8 +363,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,
|
||||||
|
@ -506,8 +506,8 @@ const onExporting = (e: any) => {
|
|||||||
item.waktu_response,
|
item.waktu_response,
|
||||||
item.waktu_recovery,
|
item.waktu_recovery,
|
||||||
item.jumlah_lapor,
|
item.jumlah_lapor,
|
||||||
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,
|
||||||
|
@ -363,8 +363,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,
|
||||||
|
@ -342,8 +342,8 @@ const onExporting = (e: any) => {
|
|||||||
item.waktu_dialihkan,
|
item.waktu_dialihkan,
|
||||||
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.nama_unit_lama,
|
item.nama_unit_lama,
|
||||||
item.status_akhir,
|
item.status_akhir,
|
||||||
item.idpel_nometer,
|
item.idpel_nometer,
|
||||||
|
@ -468,8 +468,8 @@ const onExporting = (e: any) => {
|
|||||||
item.waktu_response,
|
item.waktu_response,
|
||||||
item.waktu_recovery,
|
item.waktu_recovery,
|
||||||
item.jumlah_lapor,
|
item.jumlah_lapor,
|
||||||
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,
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
id: 1,
|
id: 1,
|
||||||
name: 'Dibawah / Sesuai SLA (<= 3 hari)',
|
name: 'Dibawah / Sesuai SLA (<= 3 hari)',
|
||||||
min: '1',
|
min: '1',
|
||||||
max: '4320'
|
max: '4381'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: 'Melebihi SLA (> 3 hari)',
|
name: 'Melebihi SLA (> 3 hari)',
|
||||||
min: '4321',
|
min: '4382',
|
||||||
max: `${99999 * 60 * 24}`
|
max: `${99999 * 60 * 24}`
|
||||||
}
|
}
|
||||||
]"
|
]"
|
||||||
@ -348,10 +348,10 @@ const onExporting = (e: any) => {
|
|||||||
let dayTo = ''
|
let dayTo = ''
|
||||||
let durasi = ''
|
let durasi = ''
|
||||||
|
|
||||||
if (minTime == '1441' && maxTime != '143998560') {
|
if (minTime == '4382' && maxTime != '143998560') {
|
||||||
durasi = 'Melebihi SLA (>1 hari)'
|
durasi = 'Melebihi SLA (>3 hari)'
|
||||||
} else if (minTime == '1' && maxTime == '1440') {
|
} else if (minTime == '1' && maxTime == '4381') {
|
||||||
durasi = 'Dibawah / Sesuai SLA (<=1 hari)'
|
durasi = 'Dibawah / Sesuai SLA (<=3 hari)'
|
||||||
} else {
|
} else {
|
||||||
durasi = 'Durasi Menit'
|
durasi = 'Durasi Menit'
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
id: 1,
|
id: 1,
|
||||||
name: 'Dibawah / Sesuai SLA (<= 1 hari)',
|
name: 'Dibawah / Sesuai SLA (<= 1 hari)',
|
||||||
min: '1',
|
min: '1',
|
||||||
max: '1440'
|
max: '1501'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: 'Melebihi SLA (> 1 hari)',
|
name: 'Melebihi SLA (> 1 hari)',
|
||||||
min: '1441',
|
min: '1502',
|
||||||
max: `${99999 * 60 * 24}`
|
max: `${99999 * 60 * 24}`
|
||||||
}
|
}
|
||||||
]"
|
]"
|
||||||
@ -367,9 +367,9 @@ const onExporting = (e: any) => {
|
|||||||
let dayTo = ''
|
let dayTo = ''
|
||||||
let durasi = ''
|
let durasi = ''
|
||||||
|
|
||||||
if (minTime == '1441' && maxTime != '143998560') {
|
if (minTime == '1502' && maxTime != '143998560') {
|
||||||
durasi = 'Melebihi SLA (>1 hari)'
|
durasi = 'Melebihi SLA (>1 hari)'
|
||||||
} else if (minTime == '1' && maxTime == '1440') {
|
} else if (minTime == '1' && maxTime == '1501') {
|
||||||
durasi = 'Dibawah / Sesuai SLA (<=1 hari)'
|
durasi = 'Dibawah / Sesuai SLA (<=1 hari)'
|
||||||
} else {
|
} else {
|
||||||
durasi = 'Durasi Menit'
|
durasi = 'Durasi Menit'
|
||||||
|
@ -330,6 +330,27 @@ const onSelectionChanged = ({ selectedRowsData }: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onExporting = (e: any) => {
|
const onExporting = (e: any) => {
|
||||||
|
const periode = reportMeta.value.periode ? reportMeta.value.periode.split(' s/d ') : ''
|
||||||
|
|
||||||
|
let dateFromFormat = ''
|
||||||
|
let dateToFormat = ''
|
||||||
|
let dayTo = ''
|
||||||
|
|
||||||
|
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'
|
||||||
@ -337,7 +358,59 @@ 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()
|
||||||
|
]
|
||||||
|
],
|
||||||
|
styles: {
|
||||||
|
fontSize: 3,
|
||||||
|
cellPadding: 0.1,
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold'
|
||||||
|
},
|
||||||
|
theme: 'plain',
|
||||||
|
startY: 10
|
||||||
|
})
|
||||||
|
|
||||||
|
autoTable(doc, {
|
||||||
|
head: [
|
||||||
|
['Daftar Keluhan Selesai Tanpa ID Pelanggan'.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',
|
||||||
@ -354,7 +427,8 @@ const onExporting = (e: any) => {
|
|||||||
'Nama ULP'
|
'Nama ULP'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
body: data.value.map((item: any) => [
|
body: data.value.map((item: any, i: any) => [
|
||||||
|
{ content: ++i, styles: { halign: 'right' } },
|
||||||
item.no_laporan,
|
item.no_laporan,
|
||||||
item.waktu_lapor,
|
item.waktu_lapor,
|
||||||
item.waktu_response,
|
item.waktu_response,
|
||||||
@ -371,11 +445,60 @@ const onExporting = (e: any) => {
|
|||||||
item.nama_ulp
|
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 Selesai Tanpa ID Pelanggan.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 Selesai Tanpa ID Pelanggan.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 Selesai Tanpa ID Pelanggan')
|
const worksheet = workbook.addWorksheet('Daftar Keluhan Selesai Tanpa ID Pelanggan')
|
||||||
@ -413,6 +536,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 } = params
|
const { ulp, uid, up3 } = params
|
||||||
|
|
||||||
refetch({
|
refetch({
|
||||||
dateFrom: dateValue[0]
|
dateFrom: dateValue[0]
|
||||||
? dateValue[0].split('-').reverse().join('-')
|
? dateValue[0].split('-').reverse().join('-')
|
||||||
@ -429,16 +553,26 @@ const filterData = (params: any) => {
|
|||||||
if (queryResult.data != undefined) {
|
if (queryResult.data != undefined) {
|
||||||
data.value = queryResult.data.daftarKeluhanSelesaiTanpaIdPelanggan
|
data.value = queryResult.data.daftarKeluhanSelesaiTanpaIdPelanggan
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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: ''
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (import.meta.env.DEV) {
|
if (import.meta.env.DEV) {
|
||||||
data.value = dummyData.keluhan.daftar.daftarKeluhanSelesaiTanpaIdPelanggan
|
data.value = dummyData.keluhan.daftar.daftarKeluhanSelesaiTanpaIdPelanggan
|
||||||
|
Loading…
x
Reference in New Issue
Block a user