From 38fa9c23ddde77e1f5c1a8ee8ce42fe52f8c3a8c Mon Sep 17 00:00:00 2001 From: Dede Fuji Abdul Date: Fri, 1 Mar 2024 20:30:31 +0700 Subject: [PATCH] Add laporanCheckInCheckOut query to graphql.ts --- src/components/Pages/Cico/LaporanCICO.vue | 156 ++++------------------ src/utils/graphql.ts | 28 ++++ 2 files changed, 56 insertions(+), 128 deletions(-) diff --git a/src/components/Pages/Cico/LaporanCICO.vue b/src/components/Pages/Cico/LaporanCICO.vue index 9909ad6..0badbc5 100755 --- a/src/components/Pages/Cico/LaporanCICO.vue +++ b/src/components/Pages/Cico/LaporanCICO.vue @@ -4,103 +4,35 @@
- + - + - + - - - - - - - - + + + + + + + +
@@ -127,6 +59,7 @@ import { Type1 } from '@/components/Form/FiltersType' import Filters from '@/components/Form/Filters.vue' import { useQuery } from '@vue/apollo-composable' import gql from 'graphql-tag' +import { queries } from '@/utils/graphql' const position = { of: '#data' } const showIndicator = ref(true) const shading = ref(true) @@ -171,32 +104,6 @@ const onSelectionChanged = ({ selectedRowsData }: any) => { console.log(data) } -const GET_laporanCheckInCheckOut = gql` - query laporanCheckInCheckOut( - $dateFrom: Date! - $dateTo: Date! - $posko: String - $idUid: Int - $idUp3: Int - ) { - laporanCheckInCheckOut( - dateFrom: $dateFrom - dateTo: $dateTo - posko: $posko - idUid: $idUid - idUp3: $idUp3 - ) { - avg_durasi_wo_gangguan_individual - avg_durasi_wo_penugasan_khusus - avg_rct_wo_gangguan_individual - avg_rpt_wo_gangguan_individual - jumlah_wo_gangguan_individual - jumlah_wo_penugasan_khusus - personil_yantek - user_regu - } - } -` const filterData = (params: any) => { const { posko, uid, up3 } = params const dateValue = params.periode.split(' s/d ') @@ -207,20 +114,13 @@ const filterData = (params: any) => { dateTo: dateValue[1] ? dateValue[1].split('-').reverse().join('-') : new Date().toISOString().slice(0, 10), - posko: posko ? posko.id : '', + idPosko: posko ? posko.id : 0, idUid: uid ? uid.id : 0, idUp3: up3 ? up3.id : 0 }) onResult((queryResult) => { if (queryResult.data != undefined) { - queryResult.data.daftarGangguanDialihkanKePoskoLain.forEach((item: any) => { - data.value = [ - ...data.value, - { - ...item - } - ] - }) + data.value = queryResult.data.laporanCheckInCheckOut } console.log(queryResult.data) console.log(queryResult.loading) @@ -230,10 +130,10 @@ const filterData = (params: any) => { console.log(error) }) } -const { onResult, onError, loading, refetch } = useQuery(GET_laporanCheckInCheckOut, { +const { onResult, onError, loading, refetch } = useQuery(queries.cico.laporanCheckInCheckOut, { dateFrom: new Date().toISOString().slice(0, 10), dateTo: new Date().toISOString().slice(0, 10), - posko: '', + idPosko: 0, idUid: 0, idUp3: 0 }) diff --git a/src/utils/graphql.ts b/src/utils/graphql.ts index df7329d..5a40a19 100755 --- a/src/utils/graphql.ts +++ b/src/utils/graphql.ts @@ -660,5 +660,33 @@ export const queries = { ` } } + }, + cico: { + laporanCheckInCheckOut: gql` + query laporanCheckInCheckOut( + $dateFrom: Date! + $dateTo: Date! + $idPosko: Int + $idUid: Int + $idUp3: Int + ) { + laporanCheckInCheckOut( + dateFrom: $dateFrom + dateTo: $dateTo + idPosko: $idPosko + idUid: $idUid + idUp3: $idUp3 + ) { + user_regu + personil_yantek + jumlah_wo_gangguan_individual + avg_durasi_wo_gangguan_individual + avg_rpt_wo_gangguan_individual + avg_rct_wo_gangguan_individual + jumlah_wo_penugasan_khusus + avg_wo_penugasan_khusus + } + } + ` } }