Refactor code to update date range in Anomali_LAPPGP_LPT.vue and api.graphql.ts

This commit is contained in:
Dede Fuji Abdul
2024-04-16 17:28:13 +07:00
parent 80f390e80a
commit 98eec9f138
6 changed files with 64 additions and 38 deletions

View File

@ -1092,16 +1092,12 @@ const calculateCustomSummary = (options: any) => {
}
}
if (options.name === 'persen_selesai') {
if (options.name == 'persen_selesai') {
if (options.summaryProcess === 'start') {
total = 0
total_selesai = 0
} else if (options.summaryProcess === 'finalize') {
options.totalValue = isFinite(total_selesai / total)
? 0
: total_selesai == 0
? 0
: (total_selesai / total) * 100
options.totalValue = total == 0 ? 0 : (total_selesai / total) * 100
}
}
@ -1110,11 +1106,7 @@ const calculateCustomSummary = (options: any) => {
total = 0
total_inproses = 0
} else if (options.summaryProcess === 'finalize') {
options.totalValue = isFinite(total_inproses / total)
? 0
: total_inproses == 0
? 0
: (total_inproses / total) * 100
options.totalValue = total == 0 ? 0 : (total_inproses / total) * 100
}
}
@ -1139,11 +1131,7 @@ const calculateCustomSummary = (options: any) => {
total_durasi_response = 0
count_durasi_response = 0
} else if (options.summaryProcess === 'finalize') {
options.totalValue = isFinite(count_durasi_response / total_durasi_response)
? 0
: count_durasi_response == 0
? 0
: count_durasi_response / total_durasi_response
options.totalValue = count_durasi_response / total_durasi_response
}
}
@ -1168,11 +1156,7 @@ const calculateCustomSummary = (options: any) => {
count_durasi_recovery = 0
total_durasi_recovery = 0
} else if (options.summaryProcess === 'finalize') {
options.totalValue = isFinite(count_durasi_recovery / total_durasi_recovery)
? 0
: count_durasi_recovery == 0
? 0
: count_durasi_recovery / total_durasi_recovery
options.totalValue = count_durasi_recovery / total_durasi_recovery
}
}
}
@ -1321,20 +1305,42 @@ const getDetail = async () => {
const dateValue = filters.value.periode.split(' s/d ')
const selected = dataSelected.value
const query = {
var query = {
dateFrom: dateValue[0]
? dateValue[0].split('-').reverse().join('-')
: new Date().toISOString().slice(0, 10),
dateTo: dateValue[1]
? dateValue[1].split('-').reverse().join('-')
: new Date().toISOString().slice(0, 10),
idUlp: selected?.id_ulp ? selected?.id_ulp : 0,
idUid: selected?.id_uid ? selected?.id_uid : 0,
idUp3: selected?.id_up3 ? selected?.id_up3 : 0,
idUlp: 0,
idUid: 0,
idUp3: 0,
isSelesai: progressSelected.value,
namaFungsiBidang: selected?.fungsi_bidang ? selected?.fungsi_bidang : ''
}
if (isGroupBy.value && grouping.value.length > 0) {
if (grouping.value[0].data == 'nama_uid') {
query = {
...query,
idUid: selected?.id_uid ? selected?.id_uid : 0
}
} else if (grouping.value[0].data == 'nama_up3') {
query = {
...query,
idUid: selected?.id_uid ? selected?.id_uid : 0,
idUp3: selected?.id_up3 ? selected?.id_up3 : 0
}
} else if (grouping.value[0].data == 'nama_ulp') {
query = {
...query,
idUid: selected?.id_uid ? selected?.id_uid : 0,
idUp3: selected?.id_up3 ? selected?.id_up3 : 0,
idUlp: selected?.id_ulp ? selected?.id_ulp : 0
}
}
}
loadingSubData.value = true
await requestGraphQl(queries.keluhan.rekap.keluhanPenyelesaianPerFungsiBidangDetail, query)
.then((result) => {