From e9eca5c93ea76da6090e86b6bfb34b44de9ae398 Mon Sep 17 00:00:00 2001 From: Dede Fuji Abdul Date: Tue, 2 Apr 2024 23:58:31 +0700 Subject: [PATCH] feat: update avg calculate mthod in summery grouping RGangguanAll --- .../Pages/Gangguan/Rekap/RGangguan_ALL.vue | 713 ++++++++++++++---- 1 file changed, 575 insertions(+), 138 deletions(-) diff --git a/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue b/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue index b0066ab..59e8dbd 100755 --- a/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue +++ b/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue @@ -160,6 +160,36 @@ css-class="custom-table-column" cell-template="formatDPT" /> + + + + + + @@ -319,7 +410,8 @@ :show-in-group-footer="false" :align-by-column="true" column="total_selesai" - summary-type="sum" + name="total_selesai" + summary-type="custom" css-class="!text-right" :customize-text="(e: any) => formatNumber(e.value)" /> @@ -327,23 +419,17 @@ :show-in-group-footer="false" :align-by-column="true" column="persen_selesai" - summary-type="avg" + name="persen_selesai" + summary-type="custom" css-class="!text-right" :customize-text="(e: any) => formatPercentage(e.value)" /> - @@ -351,7 +437,8 @@ :show-in-group-footer="false" :align-by-column="true" column="persen_inproses" - summary-type="avg" + name="persen_inproses" + summary-type="custom" css-class="!text-right" :customize-text="(e: any) => formatPercentage(e.value)" /> @@ -359,7 +446,26 @@ :show-in-group-footer="false" :align-by-column="true" column="avg_durasi_dispatch" - summary-type="avg" + name="avg_durasi_dispatch" + summary-type="custom" + css-class="!text-right" + :customize-text="(e: any) => formatNumber(e.value)" + /> + + @@ -400,7 +506,26 @@ :show-in-group-footer="false" :align-by-column="true" column="avg_durasi_response" - summary-type="avg" + name="avg_durasi_response" + summary-type="custom" + css-class="!text-right" + :customize-text="(e: any) => formatNumber(e.value)" + /> + + @@ -440,7 +565,26 @@ :show-in-group-footer="false" :align-by-column="true" column="avg_durasi_recovery" - summary-type="avg" + name="avg_durasi_recovery" + summary-type="custom" + css-class="!text-right" + :customize-text="(e: any) => formatNumber(e.value)" + /> + + @@ -1150,21 +1294,139 @@ const setAgreementDialog = (column: string) => { } } +let total = 0 +let total_selesai = 0 +let total_inproses = 0 +let count_durasi_dispatch = 0 +let total_durasi_dispatch = 0 +let count_durasi_response = 0 +let total_durasi_response = 0 +let count_durasi_recovery = 0 +let total_durasi_recovery = 0 const calculateCustomSummary = (options: any) => { - if (options.name == 'persenSelesai') { - console.log(options.component.persen_selesai) + if (options.name === 'total') { + if (options.summaryProcess === 'calculate') { + total += options.value + } else if (options.summaryProcess === 'finalize') { + options.totalValue = total + } + } - switch (options.summaryProcess) { - case 'start': - // Initializing "totalValue" here - options.totalValue = 1 - break - case 'calculate': - // Modifying "totalValue" here - break - case 'finalize': - // Assigning the final value to "totalValue" here - break + if (options.name === 'total_selesai') { + if (options.summaryProcess === 'calculate') { + total_selesai += options.value + } else if (options.summaryProcess === 'finalize') { + options.totalValue = total_selesai + } + } + + if (options.name === 'total_inproses') { + if (options.summaryProcess === 'calculate') { + total_inproses += options.value + } else if (options.summaryProcess === 'finalize') { + options.totalValue = total_inproses + } + } + + if (options.name === 'persen_selesai') { + if (options.summaryProcess === 'start') { + total = 0 + total_selesai = 0 + } else if (options.summaryProcess === 'finalize') { + options.totalValue = (total_selesai / total) * 100 + } + } + + if (options.name === 'persen_inproses') { + if (options.summaryProcess === 'start') { + total = 0 + total_inproses = 0 + } else if (options.summaryProcess === 'finalize') { + options.totalValue = (total_inproses / total) * 100 + } + } + + if (options.name === 'persen_selesai') { + if (options.summaryProcess === 'start') { + total = 0 + total_selesai = 0 + } else if (options.summaryProcess === 'finalize') { + options.totalValue = (total_selesai / total) * 100 + } + } + + if (options.name === 'count_durasi_dispatch') { + if (options.summaryProcess === 'calculate') { + count_durasi_dispatch += options.value + } else if (options.summaryProcess === 'finalize') { + options.totalValue = count_durasi_dispatch + } + } + + if (options.name === 'total_durasi_dispatch') { + if (options.summaryProcess === 'calculate') { + total_durasi_dispatch += options.value + } else if (options.summaryProcess === 'finalize') { + options.totalValue = total_durasi_dispatch + } + } + + if (options.name === 'avg_durasi_dispatch') { + if (options.summaryProcess === 'start') { + count_durasi_dispatch = 0 + total_durasi_dispatch = 0 + } else if (options.summaryProcess === 'finalize') { + options.totalValue = total_durasi_dispatch / count_durasi_dispatch + } + } + + if (options.name === 'count_durasi_response') { + if (options.summaryProcess === 'calculate') { + count_durasi_response += options.value + } else if (options.summaryProcess === 'finalize') { + options.totalValue = count_durasi_response + } + } + + if (options.name === 'total_durasi_response') { + if (options.summaryProcess === 'calculate') { + total_durasi_response += options.value + } else if (options.summaryProcess === 'finalize') { + options.totalValue = total_durasi_response + } + } + + if (options.name === 'avg_durasi_response') { + if (options.summaryProcess === 'start') { + count_durasi_response = 0 + total_durasi_response = 0 + } else if (options.summaryProcess === 'finalize') { + options.totalValue = total_durasi_response / count_durasi_response + } + } + + if (options.name === 'count_durasi_recovery') { + if (options.summaryProcess === 'calculate') { + count_durasi_recovery += options.value + } else if (options.summaryProcess === 'finalize') { + options.totalValue = count_durasi_recovery + } + } + + if (options.name === 'total_durasi_recovery') { + if (options.summaryProcess === 'calculate') { + total_durasi_recovery += options.value + } else if (options.summaryProcess === 'finalize') { + options.totalValue = total_durasi_recovery + } + } + + if (options.name === 'avg_durasi_recovery') { + if (options.summaryProcess === 'start') { + count_durasi_recovery = 0 + total_durasi_recovery = 0 + } else if (options.summaryProcess === 'finalize') { + options.totalValue = total_durasi_recovery / count_durasi_recovery } } } @@ -1375,29 +1637,29 @@ onMounted(() => { nama_ulp: 'ULP DOMPU', id_posko: 443201, nama_posko: 'POSKO ULP DOMPU', - total: 34, - total_selesai: 34, - persen_selesai: 100, - total_inproses: 0, - persen_inproses: 0, - avg_durasi_dispatch: 4.735294117647059, - min_durasi_dispatch: 11, - max_durasi_dispatch: 2562, - total_dibawah_sla_dispatch: 19, - total_diatas_sla_dispatch: 15, - avg_durasi_response: 29.848484848484848, - min_durasi_response: 625, - max_durasi_response: 4202, - total_dibawah_sla_response: 27, - total_diatas_sla_response: 6, - avg_durasi_recovery: 50.53125, - min_durasi_recovery: 1282, - max_durasi_recovery: 5794, - total_dibawah_sla_recovery: 32, + total: 426, + total_selesai: 374, + persen_selesai: 87.79342723004694, + total_inproses: 52, + persen_inproses: 12.206572769953052, + avg_durasi_dispatch: 2.4715447154471546, + min_durasi_dispatch: 0, + max_durasi_dispatch: 723, + total_dibawah_sla_dispatch: 331, + total_diatas_sla_dispatch: 38, + avg_durasi_response: 12.729411764705882, + min_durasi_response: 160, + max_durasi_response: 2004, + total_dibawah_sla_response: 340, + total_diatas_sla_response: 0, + avg_durasi_recovery: 21.4070796460177, + min_durasi_recovery: 160, + max_durasi_recovery: 2619, + total_dibawah_sla_recovery: 339, total_diatas_sla_recovery: 0, - total_dispatch: 34, - total_response: 33, - total_recovery: 32 + count_durasi_dispatch: 394, + count_durasi_response: 365, + count_durasi_recovery: 364 }, { id: 316201, @@ -1410,29 +1672,64 @@ onMounted(() => { nama_ulp: 'ULP MARISA', id_posko: 316201, nama_posko: 'POSKO ULP MARISA', - total: 19, - total_selesai: 19, - persen_selesai: 100, - total_inproses: 0, - persen_inproses: 0, - avg_durasi_dispatch: 1.6111111111111112, - min_durasi_dispatch: 12, - max_durasi_dispatch: 437, - total_dibawah_sla_dispatch: 16, - total_diatas_sla_dispatch: 2, - avg_durasi_response: 17.22222222222222, - min_durasi_response: 483, - max_durasi_response: 2541, - total_dibawah_sla_response: 18, + total: 152, + total_selesai: 121, + persen_selesai: 79.60526315789474, + total_inproses: 31, + persen_inproses: 20.394736842105264, + avg_durasi_dispatch: 1.5221238938053097, + min_durasi_dispatch: 1, + max_durasi_dispatch: 1748, + total_dibawah_sla_dispatch: 101, + total_diatas_sla_dispatch: 12, + avg_durasi_response: 10.786516853932584, + min_durasi_response: 54, + max_durasi_response: 2349, + total_dibawah_sla_response: 89, total_diatas_sla_response: 0, - avg_durasi_recovery: 31.38888888888889, - min_durasi_recovery: 1183, - max_durasi_recovery: 3216, - total_dibawah_sla_recovery: 18, + avg_durasi_recovery: 19.32183908045977, + min_durasi_recovery: 54, + max_durasi_recovery: 3723, + total_dibawah_sla_recovery: 87, total_diatas_sla_recovery: 0, - total_dispatch: 18, - total_response: 18, - total_recovery: 18 + count_durasi_dispatch: 118, + count_durasi_response: 94, + count_durasi_recovery: 92 + }, + { + id: 422401, + nama_regional: 'REGIONAL SULMAPANA', + id_uid: 42, + nama_uid: 'WILAYAH PAPUA DAN PAPUA BARAT', + id_up3: 422, + nama_up3: 'UP3 BIAK', + id_ulp: 42240, + nama_ulp: 'ULP WAROPEN', + id_posko: 422401, + nama_posko: 'POSKO ULP WAROPEN', + total: 15, + total_selesai: 13, + persen_selesai: 86.66666666666667, + total_inproses: 2, + persen_inproses: 13.333333333333334, + avg_durasi_dispatch: 1.0769230769230769, + min_durasi_dispatch: 0, + max_durasi_dispatch: 218, + total_dibawah_sla_dispatch: 13, + total_diatas_sla_dispatch: 0, + avg_durasi_response: 11.833333333333334, + min_durasi_response: 119, + max_durasi_response: 1756, + total_dibawah_sla_response: 12, + total_diatas_sla_response: 0, + avg_durasi_recovery: 20.545454545454547, + min_durasi_recovery: 119, + max_durasi_recovery: 1908, + total_dibawah_sla_recovery: 11, + total_diatas_sla_recovery: 0, + count_durasi_dispatch: 15, + count_durasi_response: 14, + count_durasi_recovery: 13 }, { id: 433801, @@ -1445,29 +1742,29 @@ onMounted(() => { nama_ulp: 'ULP SUMBA BARAT DAYA', id_posko: 433801, nama_posko: 'POSKO ULP SUMBA BARAT DAYA', - total: 34, - total_selesai: 34, - persen_selesai: 100, - total_inproses: 0, - persen_inproses: 0, - avg_durasi_dispatch: 2.5185185185185186, - min_durasi_dispatch: 17, - max_durasi_dispatch: 473, - total_dibawah_sla_dispatch: 23, - total_diatas_sla_dispatch: 4, - avg_durasi_response: 35.34615384615385, - min_durasi_response: 768, - max_durasi_response: 5726, - total_dibawah_sla_response: 19, - total_diatas_sla_response: 7, - avg_durasi_recovery: 57.34615384615385, - min_durasi_recovery: 1571, - max_durasi_recovery: 7213, - total_dibawah_sla_recovery: 26, + total: 188, + total_selesai: 162, + persen_selesai: 86.17021276595744, + total_inproses: 26, + persen_inproses: 13.829787234042554, + avg_durasi_dispatch: 1.4675324675324675, + min_durasi_dispatch: 2, + max_durasi_dispatch: 567, + total_dibawah_sla_dispatch: 147, + total_diatas_sla_dispatch: 7, + avg_durasi_response: 12.777777777777779, + min_durasi_response: 241, + max_durasi_response: 2772, + total_dibawah_sla_response: 134, + total_diatas_sla_response: 1, + avg_durasi_recovery: 26.119402985074625, + min_durasi_recovery: 453, + max_durasi_recovery: 3755, + total_dibawah_sla_recovery: 134, total_diatas_sla_recovery: 0, - total_dispatch: 27, - total_response: 26, - total_recovery: 26 + count_durasi_dispatch: 158, + count_durasi_response: 139, + count_durasi_recovery: 138 }, { id: 514603, @@ -1480,29 +1777,29 @@ onMounted(() => { nama_ulp: 'ULP NGANJUK', id_posko: 514603, nama_posko: 'POSKO ULP NGANJUK', - total: 183, - total_selesai: 183, - persen_selesai: 100, - total_inproses: 0, - persen_inproses: 0, - avg_durasi_dispatch: 11.38888888888889, - min_durasi_dispatch: 12, - max_durasi_dispatch: 4932, - total_dibawah_sla_dispatch: 53, - total_diatas_sla_dispatch: 37, - avg_durasi_response: 14.10204081632653, - min_durasi_response: 315, - max_durasi_response: 2385, - total_dibawah_sla_response: 49, - total_diatas_sla_response: 0, - avg_durasi_recovery: 21.73469387755102, - min_durasi_recovery: 424, - max_durasi_recovery: 3989, - total_dibawah_sla_recovery: 49, + total: 1436, + total_selesai: 1238, + persen_selesai: 86.2116991643454, + total_inproses: 198, + persen_inproses: 13.788300835654596, + avg_durasi_dispatch: 7.207339449541284, + min_durasi_dispatch: 4, + max_durasi_dispatch: 2760, + total_dibawah_sla_dispatch: 508, + total_diatas_sla_dispatch: 582, + avg_durasi_response: 21.72106824925816, + min_durasi_response: 130, + max_durasi_response: 5415, + total_dibawah_sla_response: 945, + total_diatas_sla_response: 66, + avg_durasi_recovery: 27.93168316831683, + min_durasi_recovery: 130, + max_durasi_recovery: 5978, + total_dibawah_sla_recovery: 1010, total_diatas_sla_recovery: 0, - total_dispatch: 90, - total_response: 49, - total_recovery: 49 + count_durasi_dispatch: 1180, + count_durasi_response: 1101, + count_durasi_recovery: 1100 }, { id: 532931, @@ -1515,29 +1812,169 @@ onMounted(() => { nama_ulp: 'ULP LELES', id_posko: 532931, nama_posko: 'POSKO ULP LELES', - total: 36, - total_selesai: 36, - persen_selesai: 100, - total_inproses: 0, - persen_inproses: 0, - avg_durasi_dispatch: 0.6388888888888888, - min_durasi_dispatch: 5, - max_durasi_dispatch: 271, - total_dibawah_sla_dispatch: 36, - total_diatas_sla_dispatch: 0, - avg_durasi_response: 10.38888888888889, - min_durasi_response: 295, - max_durasi_response: 1270, - total_dibawah_sla_response: 36, - total_diatas_sla_response: 0, - avg_durasi_recovery: 21.63888888888889, - min_durasi_recovery: 926, - max_durasi_recovery: 1886, - total_dibawah_sla_recovery: 36, + total: 370, + total_selesai: 324, + persen_selesai: 87.56756756756758, + total_inproses: 46, + persen_inproses: 12.432432432432433, + avg_durasi_dispatch: 0.9965635738831615, + min_durasi_dispatch: 3, + max_durasi_dispatch: 1495, + total_dibawah_sla_dispatch: 285, + total_diatas_sla_dispatch: 6, + avg_durasi_response: 16.597173144876326, + min_durasi_response: 247, + max_durasi_response: 5372, + total_dibawah_sla_response: 261, + total_diatas_sla_response: 22, + avg_durasi_recovery: 25.93594306049822, + min_durasi_recovery: 475, + max_durasi_recovery: 7354, + total_dibawah_sla_recovery: 281, total_diatas_sla_recovery: 0, - total_dispatch: 36, - total_response: 36, - total_recovery: 36 + count_durasi_dispatch: 295, + count_durasi_response: 287, + count_durasi_recovery: 285 + }, + { + id: 543601, + nama_regional: 'REGIONAL JMB', + id_uid: 2, + nama_uid: 'DISTRIBUSI JAKARTA RAYA', + id_up3: 9, + nama_up3: 'UP3 CIPUTAT', + id_ulp: 54360, + nama_ulp: 'UP3 CIPUTAT', + id_posko: 543601, + nama_posko: 'POSKO CIPUTAT', + total: 3446, + total_selesai: 2826, + persen_selesai: 82.0081253627394, + total_inproses: 620, + persen_inproses: 17.99187463726059, + avg_durasi_dispatch: 3.46793930494371, + min_durasi_dispatch: 1, + max_durasi_dispatch: 2761, + total_dibawah_sla_dispatch: 1740, + total_diatas_sla_dispatch: 303, + avg_durasi_response: 30.737704918032787, + min_durasi_response: 29, + max_durasi_response: 8303, + total_dibawah_sla_response: 1465, + total_diatas_sla_response: 243, + avg_durasi_recovery: 49.72835112692764, + min_durasi_recovery: 29, + max_durasi_recovery: 10280, + total_dibawah_sla_recovery: 1686, + total_diatas_sla_recovery: 0, + count_durasi_dispatch: 2123, + count_durasi_response: 1789, + count_durasi_recovery: 1768 + }, + { + id: 327601, + nama_regional: 'REGIONAL SULMAPANA', + id_uid: 32, + nama_uid: 'WILAYAH SULAWESI SELATAN, TENGGARA DAN BARAT', + id_up3: 32700, + nama_up3: 'UP3 BULUKUMBA', + id_ulp: 32760, + nama_ulp: 'ULP SINJAI', + id_posko: 327601, + nama_posko: 'POSKO ULP SINJAI', + total: 401, + total_selesai: 344, + persen_selesai: 85.785536159601, + total_inproses: 57, + persen_inproses: 14.214463840399002, + avg_durasi_dispatch: 1.3757396449704142, + min_durasi_dispatch: 1, + max_durasi_dispatch: 2875, + total_dibawah_sla_dispatch: 319, + total_diatas_sla_dispatch: 19, + avg_durasi_response: 17.36760124610592, + min_durasi_response: 615, + max_durasi_response: 3359, + total_dibawah_sla_response: 318, + total_diatas_sla_response: 3, + avg_durasi_recovery: 31.22429906542056, + min_durasi_recovery: 994, + max_durasi_recovery: 3849, + total_dibawah_sla_recovery: 321, + total_diatas_sla_recovery: 0, + count_durasi_dispatch: 340, + count_durasi_response: 323, + count_durasi_recovery: 323 + }, + { + id: 146301, + nama_regional: 'REGIONAL SUMKAL', + id_uid: 140, + nama_uid: 'WILAYAH SUMATERA SELATAN, JAMBI & BENGKULU (S2JB)', + id_up3: 1403, + nama_up3: 'UP3 BENGKULU', + id_ulp: 14630, + nama_ulp: 'ULP MUARA AMAN', + id_posko: 146301, + nama_posko: 'POSKO ULP MUARA AMAN', + total: 16, + total_selesai: 14, + persen_selesai: 87.5, + total_inproses: 2, + persen_inproses: 12.5, + avg_durasi_dispatch: 3.8, + min_durasi_dispatch: 91, + max_durasi_dispatch: 991, + total_dibawah_sla_dispatch: 9, + total_diatas_sla_dispatch: 1, + avg_durasi_response: 13.555555555555555, + min_durasi_response: 625, + max_durasi_response: 1117, + total_dibawah_sla_response: 9, + total_diatas_sla_response: 0, + avg_durasi_recovery: 24.444444444444443, + min_durasi_recovery: 1305, + max_durasi_recovery: 1825, + total_dibawah_sla_recovery: 9, + total_diatas_sla_recovery: 0, + count_durasi_dispatch: 10, + count_durasi_response: 9, + count_durasi_recovery: 9 + }, + { + id: 561201, + nama_regional: 'REGIONAL JMB', + id_uid: 56, + nama_uid: 'DISTRIBUSI BANTEN', + id_up3: 534, + nama_up3: 'UP3 BANTEN UTARA', + id_ulp: 56120, + nama_ulp: 'ULP CILEGON', + id_posko: 561201, + nama_posko: 'POSKO ULP CILEGON', + total: 1177, + total_selesai: 1057, + persen_selesai: 89.80458793542905, + total_inproses: 120, + persen_inproses: 10.195412064570943, + avg_durasi_dispatch: 2.6475972540045767, + min_durasi_dispatch: 2, + max_durasi_dispatch: 2544, + total_dibawah_sla_dispatch: 796, + total_diatas_sla_dispatch: 78, + avg_durasi_response: 19.35131396957123, + min_durasi_response: 90, + max_durasi_response: 4412, + total_dibawah_sla_response: 713, + total_diatas_sla_response: 10, + avg_durasi_recovery: 32.180281690140845, + min_durasi_recovery: 90, + max_durasi_recovery: 4951, + total_dibawah_sla_recovery: 710, + total_diatas_sla_recovery: 0, + count_durasi_dispatch: 894, + count_durasi_response: 743, + count_durasi_recovery: 730 } ] dataSub.value = []