diff --git a/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue b/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue index ab7b216..a8687bb 100755 --- a/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue +++ b/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue @@ -1107,6 +1107,8 @@ const filterData = (params: any) => { data.value = queryResult.data.rekapitulasiAllGangguan loadingData.value = false } + + reportMeta.value = filters.value }) onError((error) => { diff --git a/src/report/Gangguan/Rekap/RGangguan_ALL.ts b/src/report/Gangguan/Rekap/RGangguan_ALL.ts index edfc07a..922f73c 100644 --- a/src/report/Gangguan/Rekap/RGangguan_ALL.ts +++ b/src/report/Gangguan/Rekap/RGangguan_ALL.ts @@ -48,22 +48,20 @@ const groupingData = (data: any) => { groupedData[regional][uid].summary = { total: 0, total_selesai: 0, - persen_selesai: [], total_inproses: 0, - persen_inproses: [], avg_durasi_dispatch: [], max_durasi_dispatch: 0, - min_durasi_dispatch: 0, + min_durasi_dispatch: item.min_durasi_dispatch, total_diatas_sla_dispatch: 0, total_dibawah_sla_dispatch: 0, avg_durasi_response: [], max_durasi_response: 0, - min_durasi_response: 0, + min_durasi_response: item.min_durasi_response, total_diatas_sla_response: 0, total_dibawah_sla_response: 0, avg_durasi_recovery: [], max_durasi_recovery: 0, - min_durasi_recovery: 0, + min_durasi_recovery: item.min_durasi_recovery, total_diatas_sla_recovery: 0, total_dibawah_sla_recovery: 0 } @@ -71,26 +69,42 @@ const groupingData = (data: any) => { groupedData[regional][uid].summary.total += item.total groupedData[regional][uid].summary.total_selesai += item.total_selesai - groupedData[regional][uid].summary.persen_selesai.push(item.persen_selesai) groupedData[regional][uid].summary.total_inproses += item.total_inproses - groupedData[regional][uid].summary.persen_inproses.push(item.persen_inproses) groupedData[regional][uid].summary.avg_durasi_dispatch.push(item.avg_durasi_dispatch) - groupedData[regional][uid].summary.max_durasi_dispatch += item.max_durasi_dispatch - groupedData[regional][uid].summary.min_durasi_dispatch += item.min_durasi_dispatch + groupedData[regional][uid].summary.max_durasi_dispatch = + groupedData[regional][uid].summary.max_durasi_dispatch < item.max_durasi_dispatch + ? item.max_durasi_dispatch + : groupedData[regional][uid].summary.max_durasi_dispatch + groupedData[regional][uid].summary.min_durasi_dispatch = + groupedData[regional][uid].summary.min_durasi_dispatch > item.min_durasi_dispatch + ? item.min_durasi_dispatch + : groupedData[regional][uid].summary.min_durasi_dispatch groupedData[regional][uid].summary.total_diatas_sla_dispatch += item.total_diatas_sla_dispatch groupedData[regional][uid].summary.total_dibawah_sla_dispatch += item.total_dibawah_sla_dispatch groupedData[regional][uid].summary.avg_durasi_response.push(item.avg_durasi_response) - groupedData[regional][uid].summary.max_durasi_response += item.max_durasi_response - groupedData[regional][uid].summary.min_durasi_response += item.min_durasi_response + groupedData[regional][uid].summary.max_durasi_response = + groupedData[regional][uid].summary.max_durasi_response < item.max_durasi_response + ? item.max_durasi_response + : groupedData[regional][uid].summary.max_durasi_response + groupedData[regional][uid].summary.min_durasi_response = + groupedData[regional][uid].summary.min_durasi_response > item.min_durasi_response + ? item.min_durasi_response + : groupedData[regional][uid].summary.min_durasi_response groupedData[regional][uid].summary.total_diatas_sla_response += item.total_diatas_sla_response groupedData[regional][uid].summary.total_dibawah_sla_response += item.total_dibawah_sla_response groupedData[regional][uid].summary.avg_durasi_recovery.push(item.avg_durasi_recovery) - groupedData[regional][uid].summary.max_durasi_recovery += item.max_durasi_recovery - groupedData[regional][uid].summary.min_durasi_recovery += item.min_durasi_recovery + groupedData[regional][uid].summary.max_durasi_recovery = + groupedData[regional][uid].summary.max_durasi_recovery < item.max_durasi_recovery + ? item.max_durasi_recovery + : groupedData[regional][uid].summary.max_durasi_recovery + groupedData[regional][uid].summary.min_durasi_recovery = + groupedData[regional][uid].summary.min_durasi_recovery > item.min_durasi_recovery + ? item.min_durasi_recovery + : groupedData[regional][uid].summary.min_durasi_recovery groupedData[regional][uid].summary.total_diatas_sla_recovery += item.total_diatas_sla_recovery groupedData[regional][uid].summary.total_dibawah_sla_recovery += @@ -107,55 +121,138 @@ const formatData = (rawData: any) => { const formattedData: any = [] for (const regional in data) { - formattedData.push([{ content: regional, colSpan: 21, styles: { fontStyle: 'bold' } }]) + let no = 1 + const total: any = { + total: 0, + total_selesai: 0, + persen_selesai: 0, + total_inproses: 0, + persen_inproses: 0, + avg_durasi_dispatch: [], + max_durasi_dispatch: [], + min_durasi_dispatch: [], + total_diatas_sla_dispatch: 0, + total_dibawah_sla_dispatch: 0, + avg_durasi_response: [], + max_durasi_response: [], + min_durasi_response: [], + total_diatas_sla_response: 0, + total_dibawah_sla_response: 0, + avg_durasi_recovery: [], + max_durasi_recovery: [], + min_durasi_recovery: [], + total_diatas_sla_recovery: 0, + total_dibawah_sla_recovery: 0 + } + + formattedData.push([{ content: regional, colSpan: 22, styles: { fontStyle: 'bold' } }]) for (const uid in data[regional]) { const summary = data[regional][uid].summary + const avgDurasiDispatch = summary.avg_durasi_dispatch.length + ? summary.avg_durasi_dispatch.reduce((a: any, b: any) => a + b) / + summary.avg_durasi_dispatch.length + : 0 + const avgDurasiResponse = summary.avg_durasi_response.length + ? summary.avg_durasi_response.reduce((a: any, b: any) => a + b) / + summary.avg_durasi_response.length + : 0 + const avgDurasiRecovery = summary.avg_durasi_recovery.length + ? summary.avg_durasi_recovery.reduce((a: any, b: any) => a + b) / + summary.avg_durasi_recovery.length + : 0 formattedData.push([ + { content: no++, styles: { halign: 'right' } }, uid, formatNumber(summary.total), formatNumber(summary.total_selesai), - summary.persen_selesai.length - ? summary.persen_selesai.reduce((a: any, b: any) => a + b) / summary.persen_selesai.length - : 0, + summary.total_selesai != summary.total + ? formatPercentage((summary.total_selesai / summary.total) * 100) + : '100%', summary.total_inproses, - summary.persen_inproses.length - ? summary.persen_inproses.reduce((a: any, b: any) => a + b) / - summary.persen_inproses.length - : 0, - formatNumber( - summary.avg_durasi_dispatch.length - ? summary.avg_durasi_dispatch.reduce((a: any, b: any) => a + b) / - summary.avg_durasi_dispatch.length - : 0 - ), + '0%', + formatNumber(avgDurasiDispatch), formatWaktu(summary.max_durasi_dispatch), formatWaktu(summary.min_durasi_dispatch), formatNumber(summary.total_diatas_sla_dispatch), formatNumber(summary.total_dibawah_sla_dispatch), - formatNumber( - summary.avg_durasi_response.length - ? summary.avg_durasi_response.reduce((a: any, b: any) => a + b) / - summary.avg_durasi_response.length - : 0 - ), + formatNumber(avgDurasiResponse), formatWaktu(summary.max_durasi_response), formatWaktu(summary.min_durasi_response), formatNumber(summary.total_diatas_sla_response), formatNumber(summary.total_dibawah_sla_response), - formatNumber( - summary.avg_durasi_recovery.length - ? summary.avg_durasi_recovery.reduce((a: any, b: any) => a + b) / - summary.avg_durasi_recovery.length - : 0 - ), + formatNumber(avgDurasiRecovery), formatWaktu(summary.max_durasi_recovery), formatWaktu(summary.min_durasi_recovery), formatNumber(summary.total_diatas_sla_recovery), formatNumber(summary.total_dibawah_sla_recovery) ]) + + total.total += summary.total + total.total_selesai += summary.total_selesai + total.total_inproses += summary.total_inproses + total.avg_durasi_dispatch.push(avgDurasiDispatch) + + total.max_durasi_dispatch.push(summary.max_durasi_dispatch) + total.min_durasi_dispatch.push(summary.min_durasi_dispatch) + + total.total_diatas_sla_dispatch += summary.total_diatas_sla_dispatch + total.total_dibawah_sla_dispatch += summary.total_dibawah_sla_dispatch + total.avg_durasi_response.push(avgDurasiResponse) + + total.max_durasi_response.push(summary.max_durasi_response) + total.min_durasi_response.push(summary.min_durasi_response) + + total.total_diatas_sla_response += summary.total_diatas_sla_response + total.total_dibawah_sla_response += summary.total_dibawah_sla_response + total.avg_durasi_recovery.push(avgDurasiRecovery) + + total.max_durasi_recovery.push(summary.max_durasi_recovery) + total.min_durasi_recovery.push(summary.min_durasi_recovery) + + total.total_diatas_sla_recovery += summary.total_diatas_sla_recovery + total.total_dibawah_sla_recovery += summary.total_dibawah_sla_recovery } + + formattedData.push([ + { content: 'Total', colSpan: 2, styles: { fontStyle: 'bold' } }, + formatNumber(total.total), + formatNumber(total.total_selesai), + formatPercentage((total.total_selesai / total.total) * 100), + total.total_inproses, + '0%', + formatNumber( + total.avg_durasi_dispatch.length + ? total.avg_durasi_dispatch.reduce((a: any, b: any) => a + b) / + total.avg_durasi_dispatch.length + : 0 + ), + formatWaktu(Math.max(...total.max_durasi_dispatch)), + formatWaktu(Math.min(...total.min_durasi_dispatch)), + formatNumber(total.total_diatas_sla_dispatch), + formatNumber(total.total_dibawah_sla_dispatch), + formatNumber( + total.avg_durasi_response.length + ? total.avg_durasi_response.reduce((a: any, b: any) => a + b) / + total.avg_durasi_response.length + : 0 + ), + formatWaktu(Math.max(...total.max_durasi_response)), + formatWaktu(Math.min(...total.min_durasi_response)), + formatNumber(total.total_diatas_sla_response), + formatNumber(total.total_dibawah_sla_response), + formatNumber( + total.avg_durasi_recovery.length + ? total.avg_durasi_recovery.reduce((a: any, b: any) => a + b) / + total.avg_durasi_recovery.length + : 0 + ), + formatWaktu(Math.max(...total.max_durasi_recovery)), + formatWaktu(Math.min(...total.min_durasi_recovery)), + formatNumber(total.total_diatas_sla_recovery), + formatNumber(total.total_dibawah_sla_recovery) + ]) } return formattedData @@ -247,6 +344,10 @@ const exportToPDF = (reportMeta: any, rawData: any) => { autoTable(doc, { head: [ [ + { + content: 'No', + rowSpan: 2 + }, { content: 'Nama Unit', rowSpan: 2