Compare commits
3 Commits
dba22ec07d
...
f8e84629f5
Author | SHA1 | Date | |
---|---|---|---|
|
f8e84629f5 | ||
|
2157fbcd07 | ||
|
05d5da7dd5 |
@ -1 +1 @@
|
|||||||
{"name":"eis","version":"0.0.173-vm","private":true,"scripts":{"dev":"vite","host":"vite --host","tailwind":"tailwindcss -i ./src/assets/css/tailwind.css -o ./src/assets/css/style.css --watch","build":"run-p type-check build-only","preview":"vite preview --host","test:unit":"vitest","build-only":"vite build","type-check":"vue-tsc --noEmit -p tsconfig.vitest.json --composite false","lint":"eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore","format":"prettier --write src/","deploy":"node deploy.js","set-version":"node version.js","version":"echo $npm_package_version"},"dependencies":{"@apollo/client":"^3.8.10","@apollo/link-context":"^2.0.0-beta.3","@flavorly/vanilla-components":"^0.7.65","@headlessui/tailwindcss":"^0.2.0","@headlessui/vue":"^1.7.19","@heroicons/vue":"^2.0.18","@lottiefiles/lottie-player":"^2.0.4","@phosphor-icons/vue":"^2.1.6","@types/qs":"^6.9.12","@types/uuid":"^9.0.8","@types/vue-select":"^3.16.8","@vue/apollo-components":"^4.0.0","@vue/apollo-composable":"^4.0.1","@vue/apollo-option":"^4.0.0","axios":"^1.6.7","devextreme":"23.2.4","devextreme-vue":"23.2.4","docx":"^8.5.0","dotenv":"^16.3.1","encrypt-storage":"^2.12.22","exceljs":"^4.4.0","file-saver":"^2.0.5","graphql":"^16.8.1","graphql-tag":"^2.12.6","jspdf":"^2.5.1","jspdf-autotable":"^3.8.2","pinia":"^2.1.3","qs":"^6.11.2","uuid":"^9.0.1","vue":"^3.3.4","vue-html-to-paper":"^2.0.3","vue-router":"^4.2.2","vue-tailwind-datepicker":"^1.6.1","vue3-star-ratings":"^3.0.5"},"devDependencies":{"@rushstack/eslint-patch":"^1.5.1","@tailwindcss/aspect-ratio":"^0.4.2","@tailwindcss/container-queries":"^0.1.1","@tailwindcss/forms":"^0.5.7","@tailwindcss/typography":"^0.5.10","@tsconfig/node18":"^2.0.1","@types/file-saver":"^2.0.6","@types/jsdom":"^21.1.1","@types/node":"^18.16.17","@vitejs/plugin-vue":"^4.2.3","@vitejs/plugin-vue-jsx":"^3.0.1","@vue/eslint-config-prettier":"^8.0.0","@vue/eslint-config-typescript":"^12.0.0","@vue/test-utils":"^2.3.2","@vue/tsconfig":"^0.4.0","autoprefixer":"^10.4.14","eslint":"^8.39.0","eslint-plugin-vue":"^9.11.0","jsdom":"^22.1.0","npm-run-all":"^4.1.5","postcss":"^8.4.24","prettier":"^3.0.3","tailwindcss":"^3.3.2","typescript":"~5.2.2","vite":"^4.3.9","vitest":"^1.3.1","vue-tsc":"^2.0.5"}}
|
{"name":"eis","version":"0.0.174-vm","private":true,"scripts":{"dev":"vite","host":"vite --host","tailwind":"tailwindcss -i ./src/assets/css/tailwind.css -o ./src/assets/css/style.css --watch","build":"run-p type-check build-only","preview":"vite preview --host","test:unit":"vitest","build-only":"vite build","type-check":"vue-tsc --noEmit -p tsconfig.vitest.json --composite false","lint":"eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore","format":"prettier --write src/","deploy":"node deploy.js","set-version":"node version.js","version":"echo $npm_package_version"},"dependencies":{"@apollo/client":"^3.8.10","@apollo/link-context":"^2.0.0-beta.3","@flavorly/vanilla-components":"^0.7.65","@headlessui/tailwindcss":"^0.2.0","@headlessui/vue":"^1.7.19","@heroicons/vue":"^2.0.18","@lottiefiles/lottie-player":"^2.0.4","@phosphor-icons/vue":"^2.1.6","@types/qs":"^6.9.12","@types/uuid":"^9.0.8","@types/vue-select":"^3.16.8","@vue/apollo-components":"^4.0.0","@vue/apollo-composable":"^4.0.1","@vue/apollo-option":"^4.0.0","axios":"^1.6.7","devextreme":"23.2.4","devextreme-vue":"23.2.4","docx":"^8.5.0","dotenv":"^16.3.1","encrypt-storage":"^2.12.22","exceljs":"^4.4.0","file-saver":"^2.0.5","graphql":"^16.8.1","graphql-tag":"^2.12.6","jspdf":"^2.5.1","jspdf-autotable":"^3.8.2","pinia":"^2.1.3","qs":"^6.11.2","uuid":"^9.0.1","vue":"^3.3.4","vue-html-to-paper":"^2.0.3","vue-router":"^4.2.2","vue-tailwind-datepicker":"^1.6.1","vue3-star-ratings":"^3.0.5"},"devDependencies":{"@rushstack/eslint-patch":"^1.5.1","@tailwindcss/aspect-ratio":"^0.4.2","@tailwindcss/container-queries":"^0.1.1","@tailwindcss/forms":"^0.5.7","@tailwindcss/typography":"^0.5.10","@tsconfig/node18":"^2.0.1","@types/file-saver":"^2.0.6","@types/jsdom":"^21.1.1","@types/node":"^18.16.17","@vitejs/plugin-vue":"^4.2.3","@vitejs/plugin-vue-jsx":"^3.0.1","@vue/eslint-config-prettier":"^8.0.0","@vue/eslint-config-typescript":"^12.0.0","@vue/test-utils":"^2.3.2","@vue/tsconfig":"^0.4.0","autoprefixer":"^10.4.14","eslint":"^8.39.0","eslint-plugin-vue":"^9.11.0","jsdom":"^22.1.0","npm-run-all":"^4.1.5","postcss":"^8.4.24","prettier":"^3.0.3","tailwindcss":"^3.3.2","typescript":"~5.2.2","vite":"^4.3.9","vitest":"^1.3.1","vue-tsc":"^2.0.5"}}
|
@ -1 +1 @@
|
|||||||
{"version":"0.0.173-vm"}
|
{"version":"0.0.174-vm"}
|
@ -1,17 +1,4 @@
|
|||||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||||
import {
|
|
||||||
Document,
|
|
||||||
AlignmentType,
|
|
||||||
Packer,
|
|
||||||
Paragraph,
|
|
||||||
Table,
|
|
||||||
TableCell,
|
|
||||||
TableRow,
|
|
||||||
VerticalAlign,
|
|
||||||
TextRun,
|
|
||||||
WidthType,
|
|
||||||
PageOrientation
|
|
||||||
} from 'docx'
|
|
||||||
import { saveAs } from 'file-saver'
|
import { saveAs } from 'file-saver'
|
||||||
import { jsPDF } from 'jspdf'
|
import { jsPDF } from 'jspdf'
|
||||||
import autoTable from 'jspdf-autotable'
|
import autoTable from 'jspdf-autotable'
|
||||||
|
@ -10,82 +10,154 @@ import { exportToWord } from './doc/Anomali_LAPPGP_LPT'
|
|||||||
const reportName = 'Anomali Penanganan Pengaduan Gangguan Petugas'
|
const reportName = 'Anomali Penanganan Pengaduan Gangguan Petugas'
|
||||||
const fontSize = 5
|
const fontSize = 5
|
||||||
|
|
||||||
const formatData = (rawData: any) => {
|
const groupingData = (data: any, reportMeta: any) => {
|
||||||
const formattedData: any = []
|
const groupedData: any = {}
|
||||||
const total: any = {
|
|
||||||
|
const reportMetaMapping: any = {
|
||||||
|
up3: 'nama_ulp',
|
||||||
|
uid: 'nama_up3',
|
||||||
|
default: 'nama_uid'
|
||||||
|
}
|
||||||
|
|
||||||
|
let key = 'nama_uid'
|
||||||
|
for (const prop in reportMetaMapping) {
|
||||||
|
if (reportMeta[prop] && reportMeta[prop].id != 0) {
|
||||||
|
key = reportMetaMapping[prop]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data.forEach((item: any) => {
|
||||||
|
const groupKey = item[key]
|
||||||
|
|
||||||
|
if (!groupedData[groupKey]) {
|
||||||
|
groupedData[groupKey] = { data: [] }
|
||||||
|
}
|
||||||
|
|
||||||
|
groupedData[groupKey].data.push(item)
|
||||||
|
})
|
||||||
|
|
||||||
|
for (const key in groupedData) {
|
||||||
|
const data = groupedData[key].data
|
||||||
|
|
||||||
|
data.forEach((item: any) => {
|
||||||
|
if (!groupedData[key].summary) {
|
||||||
|
groupedData[key].summary = {
|
||||||
total_petugas: 0,
|
total_petugas: 0,
|
||||||
anomali_pln_mobile_marking: 0,
|
petugas_pln_mobile_marking: 0,
|
||||||
anomali_pln_mobile_non_marking: 0,
|
petugas_pln_mobile_nonmarking: 0,
|
||||||
anomali_cc123_marking: 0,
|
petugas_cc123_marking: 0,
|
||||||
anomali_cc123_non_marking: 0
|
petugas_cc123_nonmarking: 0
|
||||||
// total_anomali_marking: 0,
|
// petugas_anomali_marking: 0,
|
||||||
// total_anomali_non_marking: 0,
|
// petugas_anomali_nonmarking: 0,
|
||||||
// persen_anomali_pln_mobile_marking
|
// persen_pln_mobile_marking
|
||||||
// persen_anomali_pln_mobile_non_marking
|
// persen_pln_mobile_non_marking
|
||||||
// persen_anomali_cc123_marking
|
// persen_cc123_marking
|
||||||
// persen_anomali_cc123_non_marking
|
// persen_cc123_nonmarking
|
||||||
// persen_anomali_marking
|
// persen_anomali_marking
|
||||||
// persen_anomali_non_marking
|
// persen_anomali_non_marking
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rawData.forEach((item: any) => {
|
groupedData[key].summary.total_petugas += item.total_petugas
|
||||||
total.total_petugas += item.total_petugas
|
groupedData[key].summary.petugas_pln_mobile_marking += item.petugas_pln_mobile_marking
|
||||||
total.anomali_pln_mobile_marking += item.anomali_pln_mobile_marking
|
groupedData[key].summary.petugas_pln_mobile_nonmarking += item.petugas_pln_mobile_nonmarking
|
||||||
total.anomali_pln_mobile_non_marking += item.anomali_pln_mobile_non_marking
|
groupedData[key].summary.petugas_cc123_marking += item.petugas_cc123_marking
|
||||||
total.anomali_cc123_marking += item.anomali_cc123_marking
|
groupedData[key].summary.petugas_cc123_nonmarking += item.petugas_cc123_nonmarking
|
||||||
total.anomali_cc123_non_marking += item.anomali_cc123_non_marking
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const total_anomali_marking = total.anomali_pln_mobile_marking + total.anomali_cc123_marking
|
groupedData[key].summary.petugas_anomali_marking =
|
||||||
const total_anomali_non_marking =
|
groupedData[key].summary.petugas_pln_mobile_marking +
|
||||||
total.anomali_pln_mobile_non_marking + total.anomali_cc123_non_marking
|
groupedData[key].summary.petugas_cc123_marking
|
||||||
const persen_anomali_pln_mobile_marking = total.anomali_pln_mobile_marking / total.total_petugas
|
groupedData[key].summary.petugas_anomali_nonmarking =
|
||||||
const persen_anomali_pln_mobile_non_marking =
|
groupedData[key].summary.petugas_pln_mobile_nonmarking +
|
||||||
total.anomali_pln_mobile_non_marking / total.total_petugas
|
groupedData[key].summary.petugas_cc123_nonmarking
|
||||||
const persen_anomali_cc123_marking = total.anomali_cc123_marking / total.total_petugas
|
|
||||||
const persen_anomali_cc123_non_marking = total.anomali_cc123_non_marking / total.total_petugas
|
groupedData[key].summary.persen_pln_mobile_marking =
|
||||||
const persen_anomali_marking = persen_anomali_pln_mobile_marking + persen_anomali_cc123_marking
|
(groupedData[key].summary.petugas_pln_mobile_marking /
|
||||||
const persen_anomali_non_marking =
|
groupedData[key].summary.total_petugas) *
|
||||||
persen_anomali_pln_mobile_non_marking + persen_anomali_cc123_non_marking
|
100
|
||||||
|
|
||||||
|
groupedData[key].summary.persen_pln_mobile_non_marking =
|
||||||
|
(groupedData[key].summary.petugas_pln_mobile_nonmarking /
|
||||||
|
groupedData[key].summary.total_petugas) *
|
||||||
|
100
|
||||||
|
|
||||||
|
groupedData[key].summary.persen_cc123_marking =
|
||||||
|
(groupedData[key].summary.petugas_cc123_marking / groupedData[key].summary.total_petugas) *
|
||||||
|
100
|
||||||
|
|
||||||
|
groupedData[key].summary.persen_cc123_nonmarking =
|
||||||
|
(groupedData[key].summary.petugas_cc123_nonmarking / groupedData[key].summary.total_petugas) *
|
||||||
|
100
|
||||||
|
|
||||||
|
groupedData[key].summary.persen_anomali_marking =
|
||||||
|
groupedData[key].summary.persen_pln_mobile_marking +
|
||||||
|
groupedData[key].summary.persen_cc123_marking
|
||||||
|
groupedData[key].summary.persen_anomali_non_marking =
|
||||||
|
groupedData[key].summary.persen_pln_mobile_non_marking +
|
||||||
|
groupedData[key].summary.persen_cc123_nonmarking
|
||||||
|
}
|
||||||
|
|
||||||
|
return groupedData
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTitle = (reportMeta: any) => {
|
||||||
|
if (reportMeta.up3.id != 0) {
|
||||||
|
return 'nama_up3'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reportMeta.uid.id != 0) {
|
||||||
|
return 'nama_uid'
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'nama_regional'
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatData = (rawData: any, reportMeta: any) => {
|
||||||
|
const formattedData: any = []
|
||||||
|
const groupedData: any = {}
|
||||||
|
|
||||||
|
const data = groupingData(rawData, reportMeta)
|
||||||
|
const title = getTitle(reportMeta)
|
||||||
|
|
||||||
|
for (const key in data) {
|
||||||
|
const groupKey = data[key].data[0][title]
|
||||||
|
|
||||||
|
if (!groupedData[groupKey]) {
|
||||||
|
groupedData[groupKey] = { data: [] }
|
||||||
|
}
|
||||||
|
|
||||||
|
groupedData[groupKey].data.push({
|
||||||
|
key: key,
|
||||||
|
value: data[key]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key in groupedData) {
|
||||||
|
formattedData.push([{ content: key, colSpan: 14, styles: { fontStyle: 'bold' } }])
|
||||||
|
|
||||||
|
groupedData[key].data.forEach((item: any) => {
|
||||||
|
const summary = item.value.summary
|
||||||
|
|
||||||
formattedData.push([
|
formattedData.push([
|
||||||
'Semua Unit',
|
item.key,
|
||||||
formatNumber(total.total_petugas),
|
formatNumber(summary.total_petugas),
|
||||||
formatNumber(total.anomali_pln_mobile_marking),
|
formatNumber(summary.petugas_pln_mobile_marking),
|
||||||
formatNumber(total.anomali_pln_mobile_non_marking),
|
formatNumber(summary.petugas_pln_mobile_nonmarking),
|
||||||
formatNumber(total.anomali_cc123_marking),
|
formatNumber(summary.petugas_cc123_marking),
|
||||||
formatNumber(total.anomali_cc123_non_marking),
|
formatNumber(summary.petugas_cc123_nonmarking),
|
||||||
formatNumber(total_anomali_marking),
|
formatNumber(summary.petugas_anomali_marking),
|
||||||
formatNumber(total_anomali_non_marking),
|
formatNumber(summary.petugas_anomali_nonmarking),
|
||||||
formatPercentage(
|
formatPercentage(summary.persen_pln_mobile_marking),
|
||||||
!persen_anomali_pln_mobile_marking || !!isFinite(persen_anomali_pln_mobile_marking)
|
formatPercentage(summary.persen_pln_mobile_non_marking),
|
||||||
? 0
|
formatPercentage(summary.persen_cc123_marking),
|
||||||
: persen_anomali_pln_mobile_marking * 100
|
formatPercentage(summary.persen_cc123_nonmarking),
|
||||||
),
|
formatPercentage(summary.persen_anomali_marking),
|
||||||
formatPercentage(
|
formatPercentage(summary.persen_anomali_non_marking)
|
||||||
!persen_anomali_pln_mobile_non_marking || !!isFinite(persen_anomali_pln_mobile_non_marking)
|
|
||||||
? 0
|
|
||||||
: persen_anomali_pln_mobile_non_marking * 100
|
|
||||||
),
|
|
||||||
formatPercentage(
|
|
||||||
!persen_anomali_cc123_marking || !!isFinite(persen_anomali_cc123_marking)
|
|
||||||
? 0
|
|
||||||
: persen_anomali_cc123_marking * 100
|
|
||||||
),
|
|
||||||
formatPercentage(
|
|
||||||
!persen_anomali_cc123_non_marking || !!isFinite(persen_anomali_cc123_non_marking)
|
|
||||||
? 0
|
|
||||||
: persen_anomali_cc123_non_marking * 100
|
|
||||||
),
|
|
||||||
formatPercentage(
|
|
||||||
!persen_anomali_marking || !!isFinite(persen_anomali_marking) ? 0 : persen_anomali_marking
|
|
||||||
),
|
|
||||||
formatPercentage(
|
|
||||||
!persen_anomali_non_marking || !!isFinite(persen_anomali_non_marking)
|
|
||||||
? 0
|
|
||||||
: persen_anomali_non_marking * 100
|
|
||||||
)
|
|
||||||
])
|
])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return formattedData
|
return formattedData
|
||||||
}
|
}
|
||||||
@ -120,7 +192,7 @@ const exportToPDF = (reportMeta: any, rawData: any, preview: boolean = false) =>
|
|||||||
const date = new Date().getDate()
|
const date = new Date().getDate()
|
||||||
const month = new Date().toLocaleString('id-ID', { month: 'long' })
|
const month = new Date().toLocaleString('id-ID', { month: 'long' })
|
||||||
const year = new Date().getFullYear()
|
const year = new Date().getFullYear()
|
||||||
const data = formatData(rawData)
|
const data = formatData(rawData, reportMeta)
|
||||||
const meta = formatMetaData(reportMeta)
|
const meta = formatMetaData(reportMeta)
|
||||||
const doc = new jsPDF({
|
const doc = new jsPDF({
|
||||||
orientation: 'landscape'
|
orientation: 'landscape'
|
||||||
@ -410,7 +482,7 @@ const exportToXLSX = (reportMeta: any, e: any) => {
|
|||||||
|
|
||||||
const exportToDOCX = (reportMeta: any, rawData: any) => {
|
const exportToDOCX = (reportMeta: any, rawData: any) => {
|
||||||
const meta = formatMetaData(reportMeta)
|
const meta = formatMetaData(reportMeta)
|
||||||
exportToWord(reportMeta, meta, formatData(rawData), reportName)
|
exportToWord(reportMeta, meta, formatData(rawData, reportMeta), reportName)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { exportToPDF, exportToXLSX, exportToDOCX }
|
export { exportToPDF, exportToXLSX, exportToDOCX }
|
||||||
|
@ -12,80 +12,125 @@ const reportName = 'Rekapitulasi Keluhan All'
|
|||||||
const fontSize = 5
|
const fontSize = 5
|
||||||
const detailFontSize = 5
|
const detailFontSize = 5
|
||||||
|
|
||||||
const getGroupParent = (reportMeta: any) => {
|
|
||||||
if (reportMeta.ulp.id != 0) {
|
|
||||||
return {
|
|
||||||
parent: reportMeta.up3.name,
|
|
||||||
summaryName: reportMeta.ulp.name,
|
|
||||||
summaryKey: 'nama_ulp'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reportMeta.up3.id != 0) {
|
|
||||||
return {
|
|
||||||
parent: reportMeta.uid.name,
|
|
||||||
summaryName: reportMeta.up3.name,
|
|
||||||
summaryKey: 'nama_up3'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reportMeta.uid.id != 0) {
|
|
||||||
return {
|
|
||||||
parent: 'regional',
|
|
||||||
summaryName: reportMeta.uid.name,
|
|
||||||
summaryKey: 'nama_uid'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
const groupingData = (data: any, reportMeta: any) => {
|
const groupingData = (data: any, reportMeta: any) => {
|
||||||
const groupedData: any = {}
|
const groupedData: any = {}
|
||||||
const groupParent = getGroupParent(reportMeta)
|
|
||||||
|
|
||||||
if (groupParent === '') {
|
const reportMetaMapping: any = {
|
||||||
return {
|
ulp: 'nama_ulp',
|
||||||
data,
|
uid: 'nama_up3',
|
||||||
parent: '',
|
default: 'nama_uid'
|
||||||
summaryName: ''
|
}
|
||||||
|
|
||||||
|
let key = 'nama_uid'
|
||||||
|
for (const prop in reportMetaMapping) {
|
||||||
|
if (reportMeta[prop] && reportMeta[prop].id != 0) {
|
||||||
|
key = reportMetaMapping[prop]
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data.forEach((item: any) => {
|
data.forEach((item: any) => {
|
||||||
const group = item[groupParent.summaryKey]
|
const groupKey = item[key]
|
||||||
|
|
||||||
if (!groupedData[group]) {
|
if (!groupedData[groupKey]) {
|
||||||
groupedData[group] = []
|
groupedData[groupKey] = { data: [] }
|
||||||
}
|
}
|
||||||
|
|
||||||
groupedData[group].push(item)
|
groupedData[groupKey].data.push(item)
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
for (const key in groupedData) {
|
||||||
data: groupedData,
|
const data = groupedData[key].data
|
||||||
parent: groupParent.parent,
|
|
||||||
summaryName: groupParent.summaryName
|
data.forEach((item: any) => {
|
||||||
|
if (!groupedData[key].summary) {
|
||||||
|
groupedData[key].summary = {
|
||||||
|
total: 0,
|
||||||
|
total_selesai: 0,
|
||||||
|
total_inproses: 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
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
groupedData[key].summary.total += item.total
|
||||||
|
groupedData[key].summary.total_selesai += item.total_selesai
|
||||||
|
groupedData[key].summary.total_inproses += item.total_inproses
|
||||||
|
groupedData[key].summary.avg_durasi_response.push(item.avg_durasi_response)
|
||||||
|
groupedData[key].summary.max_durasi_response.push(item.max_durasi_response)
|
||||||
|
groupedData[key].summary.min_durasi_response.push(item.min_durasi_response)
|
||||||
|
groupedData[key].summary.total_diatas_sla_response += item.total_diatas_sla_response
|
||||||
|
groupedData[key].summary.total_dibawah_sla_response += item.total_dibawah_sla_response
|
||||||
|
groupedData[key].summary.avg_durasi_recovery.push(item.avg_durasi_recovery)
|
||||||
|
groupedData[key].summary.max_durasi_recovery.push(item.max_durasi_recovery)
|
||||||
|
groupedData[key].summary.min_durasi_recovery.push(item.min_durasi_recovery)
|
||||||
|
groupedData[key].summary.total_diatas_sla_recovery += item.total_diatas_sla_recovery
|
||||||
|
groupedData[key].summary.total_dibawah_sla_recovery += item.total_dibawah_sla_recovery
|
||||||
|
})
|
||||||
|
|
||||||
|
groupedData[key].summary.persen_selesai =
|
||||||
|
groupedData[key].summary.total_selesai != groupedData[key].summary.total
|
||||||
|
? (groupedData[key].summary.total_selesai / groupedData[key].summary.total) * 100
|
||||||
|
: 100
|
||||||
|
|
||||||
|
groupedData[key].summary.persen_inproses =
|
||||||
|
groupedData[key].summary.total_inproses != groupedData[key].summary.total
|
||||||
|
? (groupedData[key].summary.total_inproses / groupedData[key].summary.total) * 100
|
||||||
|
: 0
|
||||||
|
|
||||||
|
groupedData[key].summary.avg_durasi_response = groupedData[key].summary.avg_durasi_response
|
||||||
|
.length
|
||||||
|
? groupedData[key].summary.avg_durasi_response.reduce((a: any, b: any) => a + b) /
|
||||||
|
groupedData[key].summary.avg_durasi_response.length
|
||||||
|
: 0
|
||||||
|
|
||||||
|
groupedData[key].summary.max_durasi_response = Math.max(
|
||||||
|
...groupedData[key].summary.max_durasi_response
|
||||||
|
)
|
||||||
|
groupedData[key].summary.min_durasi_response = Math.min(
|
||||||
|
...groupedData[key].summary.min_durasi_response
|
||||||
|
)
|
||||||
|
|
||||||
|
groupedData[key].summary.avg_durasi_recovery = groupedData[key].summary.avg_durasi_recovery
|
||||||
|
.length
|
||||||
|
? groupedData[key].summary.avg_durasi_recovery.reduce((a: any, b: any) => a + b) /
|
||||||
|
groupedData[key].summary.avg_durasi_recovery.length
|
||||||
|
: 0
|
||||||
|
|
||||||
|
groupedData[key].summary.max_durasi_recovery = Math.max(
|
||||||
|
...groupedData[key].summary.max_durasi_recovery
|
||||||
|
)
|
||||||
|
groupedData[key].summary.min_durasi_recovery = Math.min(
|
||||||
|
...groupedData[key].summary.min_durasi_recovery
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return groupedData
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTitle = (reportMeta: any) => {
|
||||||
|
if (reportMeta.ulp.id != 0) {
|
||||||
|
return 'nama_ulp'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reportMeta.uid.id != 0) {
|
||||||
|
return 'nama_uid'
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'nama_regional'
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatData = (rawData: any, reportMeta: any) => {
|
const formatData = (rawData: any, reportMeta: any) => {
|
||||||
const tempData = groupingData(rawData, reportMeta)
|
|
||||||
// const data = tempData.data[tempData.summaryName] || tempData.data
|
|
||||||
const data = tempData.data[tempData.summaryName]
|
|
||||||
const formattedData: any = []
|
const formattedData: any = []
|
||||||
console.table('data', data)
|
const groupedData: any = {}
|
||||||
|
|
||||||
let parentName = ''
|
|
||||||
let summaryName = tempData.summaryName ? tempData.summaryName : 'Seluruh Unit'
|
|
||||||
|
|
||||||
if (tempData.parent === '') {
|
|
||||||
parentName = 'Seluruh Distribusi'
|
|
||||||
} else if (tempData.parent === 'regional') {
|
|
||||||
parentName = tempData.data[tempData.summaryName][0].nama_regional
|
|
||||||
} else {
|
|
||||||
parentName = tempData.summaryName
|
|
||||||
}
|
|
||||||
|
|
||||||
const total: any = {
|
const total: any = {
|
||||||
total: 0,
|
total: 0,
|
||||||
@ -103,20 +148,61 @@ const formatData = (rawData: any, reportMeta: any) => {
|
|||||||
total_dibawah_sla_recovery: 0
|
total_dibawah_sla_recovery: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
data.forEach((item: any) => {
|
const data = groupingData(rawData, reportMeta)
|
||||||
total.total += item.total
|
const title = getTitle(reportMeta)
|
||||||
total.total_selesai += item.total_selesai
|
|
||||||
total.total_inproses += item.total_inproses
|
for (const key in data) {
|
||||||
total.avg_durasi_response.push(item.avg_durasi_response)
|
const groupKey = data[key].data[0][title]
|
||||||
total.max_durasi_response.push(item.max_durasi_response)
|
|
||||||
total.min_durasi_response.push(item.min_durasi_response)
|
if (!groupedData[groupKey]) {
|
||||||
total.total_diatas_sla_response += item.total_diatas_sla_response
|
groupedData[groupKey] = { data: [] }
|
||||||
total.total_dibawah_sla_response += item.total_dibawah_sla_response
|
}
|
||||||
total.avg_durasi_recovery.push(item.avg_durasi_recovery)
|
|
||||||
total.max_durasi_recovery.push(item.max_durasi_recovery)
|
groupedData[groupKey].data.push({
|
||||||
total.min_durasi_recovery.push(item.min_durasi_recovery)
|
key: key,
|
||||||
total.total_diatas_sla_recovery += item.total_diatas_sla_recovery
|
value: data[key]
|
||||||
total.total_dibawah_sla_recovery += item.total_dibawah_sla_recovery
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key in groupedData) {
|
||||||
|
formattedData.push([{ content: key, colSpan: 17, styles: { fontStyle: 'bold' } }])
|
||||||
|
|
||||||
|
groupedData[key].data.forEach((item: any, index: any) => {
|
||||||
|
const summary = item.value.summary
|
||||||
|
|
||||||
|
formattedData.push([
|
||||||
|
{ content: index + 1, styles: { halign: 'right' } },
|
||||||
|
item.key,
|
||||||
|
formatNumber(summary.total),
|
||||||
|
formatNumber(summary.total_selesai),
|
||||||
|
formatPercentage(summary.persen_selesai),
|
||||||
|
formatNumber(summary.total_inproses),
|
||||||
|
formatPercentage(summary.persen_inproses),
|
||||||
|
formatNumber(summary.avg_durasi_response),
|
||||||
|
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),
|
||||||
|
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_response.push(summary.avg_durasi_response)
|
||||||
|
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(summary.avg_durasi_recovery)
|
||||||
|
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
|
||||||
})
|
})
|
||||||
|
|
||||||
const persenSelesai =
|
const persenSelesai =
|
||||||
@ -124,9 +210,8 @@ const formatData = (rawData: any, reportMeta: any) => {
|
|||||||
const persenInproses =
|
const persenInproses =
|
||||||
total.total_inproses != total.total ? (total.total_inproses / total.total) * 100 : 0
|
total.total_inproses != total.total ? (total.total_inproses / total.total) * 100 : 0
|
||||||
|
|
||||||
formattedData.push([{ content: parentName, colSpan: 17, styles: { fontStyle: 'bold' } }])
|
formattedData.push([
|
||||||
|
{ content: 'TOTAL', colSpan: 2, styles: { fontStyle: 'bold' } },
|
||||||
const result = [
|
|
||||||
formatNumber(total.total),
|
formatNumber(total.total),
|
||||||
formatNumber(total.total_selesai),
|
formatNumber(total.total_selesai),
|
||||||
formatPercentage(persenSelesai),
|
formatPercentage(persenSelesai),
|
||||||
@ -152,10 +237,8 @@ const formatData = (rawData: any, reportMeta: any) => {
|
|||||||
formatWaktu(Math.min(...total.min_durasi_recovery)),
|
formatWaktu(Math.min(...total.min_durasi_recovery)),
|
||||||
formatNumber(total.total_diatas_sla_recovery),
|
formatNumber(total.total_diatas_sla_recovery),
|
||||||
formatNumber(total.total_dibawah_sla_recovery)
|
formatNumber(total.total_dibawah_sla_recovery)
|
||||||
]
|
])
|
||||||
|
}
|
||||||
formattedData.push([{ content: '1', styles: { halign: 'right' } }, summaryName, ...result])
|
|
||||||
formattedData.push([{ content: 'TOTAL', colSpan: 2, styles: { fontStyle: 'bold' } }, ...result])
|
|
||||||
|
|
||||||
return formattedData
|
return formattedData
|
||||||
}
|
}
|
||||||
|
@ -4475,8 +4475,8 @@ export const queries = {
|
|||||||
nama_up3
|
nama_up3
|
||||||
id_ulp
|
id_ulp
|
||||||
nama_ulp
|
nama_ulp
|
||||||
|
nama_regional
|
||||||
total_petugas
|
total_petugas
|
||||||
|
|
||||||
petugas_pln_mobile_marking
|
petugas_pln_mobile_marking
|
||||||
petugas_pln_mobile_nonmarking
|
petugas_pln_mobile_nonmarking
|
||||||
petugas_cc123_marking
|
petugas_cc123_marking
|
||||||
@ -4487,7 +4487,6 @@ export const queries = {
|
|||||||
persen_pln_mobile_nonmarking
|
persen_pln_mobile_nonmarking
|
||||||
persen_cc123_marking
|
persen_cc123_marking
|
||||||
persen_cc123_nonmarking
|
persen_cc123_nonmarking
|
||||||
|
|
||||||
persen_anomali_marking
|
persen_anomali_marking
|
||||||
persen_anomali_non_marking
|
persen_anomali_non_marking
|
||||||
}
|
}
|
||||||
@ -4605,6 +4604,7 @@ export const queries = {
|
|||||||
nama_up3
|
nama_up3
|
||||||
id_ulp
|
id_ulp
|
||||||
nama_ulp
|
nama_ulp
|
||||||
|
nama_regional
|
||||||
total_petugas
|
total_petugas
|
||||||
petugas_pln_mobile_marking
|
petugas_pln_mobile_marking
|
||||||
petugas_pln_mobile_nonmarking
|
petugas_pln_mobile_nonmarking
|
||||||
@ -4730,6 +4730,7 @@ export const queries = {
|
|||||||
nama_up3
|
nama_up3
|
||||||
id_ulp
|
id_ulp
|
||||||
nama_ulp
|
nama_ulp
|
||||||
|
nama_regional
|
||||||
total_petugas
|
total_petugas
|
||||||
petugas_pln_mobile_marking
|
petugas_pln_mobile_marking
|
||||||
petugas_pln_mobile_nonmarking
|
petugas_pln_mobile_nonmarking
|
||||||
|
Loading…
x
Reference in New Issue
Block a user