Add GraphQL queries for material-related data
This commit is contained in:
		| @@ -664,7 +664,7 @@ import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter' | ||||
| import { saveAs } from 'file-saver' | ||||
| import { Workbook } from 'exceljs' | ||||
| import { useQuery } from '@vue/apollo-composable' | ||||
| import { queries } from '@/utils/api/api.graphql' | ||||
| import { queries, requestGraphQl } from '@/utils/api/api.graphql' | ||||
| import { getMonthName, getMonthNameShort } from '@/utils/texts' | ||||
| import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers' | ||||
| import DetailDialog from '@/components/Dialogs/DetailDialog.vue' | ||||
| @@ -720,7 +720,7 @@ const onExporting = (e: any) => { | ||||
|   } | ||||
| } | ||||
|  | ||||
| const getDetail = () => { | ||||
| const getDetail = async () => { | ||||
|   const dateValue = filters.value.periode.split(' s/d ') | ||||
|   const selected = dataSelected.value | ||||
|  | ||||
| @@ -736,24 +736,21 @@ const getDetail = () => { | ||||
|     idUp3: selected?.id_up3 ? selected?.id_up3 : 0 | ||||
|   } | ||||
|  | ||||
|   const { onResult, onError, loading } = useQuery( | ||||
|     queries.keluhan.rekap.rekapKeluhanAllDetail, | ||||
|     query | ||||
|   ) | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       dataSub.value = queryResult.data.detailKeluhanAll | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingSubData.value = value | ||||
|   }) | ||||
|   loadingSubData.value = true | ||||
|   await requestGraphQl(queries.keluhan.rekap.rekapKeluhanAllDetail, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         dataSub.value = result.data.data.detailKeluhanAll | ||||
|       } else { | ||||
|         dataSub.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingSubData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| const dataGridRef = ref<DxDataGrid | null>(null) | ||||
| @@ -780,38 +777,37 @@ const onDataSubSelectionChanged = ({ selectedRowsData }: any) => { | ||||
|   dataSubSelected.value = data | ||||
| } | ||||
|  | ||||
| const filterData = (params: any) => { | ||||
| const filterData = async (params: any) => { | ||||
|   const { regional, ulp, uid, up3, bulan, tahun } = params | ||||
|  | ||||
|   currentMonth.value = bulan.id | ||||
|   currentYear.value = tahun.id | ||||
|   lastYear.value = tahun.id - 1 | ||||
|  | ||||
|   const { onResult, onError, loading, refetch } = useQuery( | ||||
|     queries.monalisa.laporan.bulanan.agingComplaintBulanan, | ||||
|     { | ||||
|       namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|       idUid: uid ? uid.id : 0, | ||||
|       idUp3: up3 ? up3.id : 0, | ||||
|       idUlp: ulp ? ulp.id : 0, | ||||
|       bulan: bulan ? bulan.id : currentMonth.value, | ||||
|       tahun: bulan ? tahun.id : currentYear.value | ||||
|     } | ||||
|   ) | ||||
|   const query = { | ||||
|     namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|     idUid: uid ? uid.id : 0, | ||||
|     idUp3: up3 ? up3.id : 0, | ||||
|     idUlp: ulp ? ulp.id : 0, | ||||
|     bulan: bulan ? bulan.id : currentMonth.value, | ||||
|     tahun: bulan ? tahun.id : currentYear.value | ||||
|   } | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       data.value = queryResult.data.agingComplaintBulanan | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingData.value = value | ||||
|   }) | ||||
|   loadingData.value = true | ||||
|   await requestGraphQl(queries.monalisa.laporan.bulanan.agingComplaintBulanan, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         data.value = result.data.data.agingComplaintBulanan | ||||
|       } else { | ||||
|         data.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| onMounted(() => { | ||||
|   | ||||
| @@ -278,7 +278,7 @@ import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter' | ||||
| import { saveAs } from 'file-saver' | ||||
| import { Workbook } from 'exceljs' | ||||
| import { useQuery } from '@vue/apollo-composable' | ||||
| import { queries } from '@/utils/api/api.graphql' | ||||
| import { queries, requestGraphQl } from '@/utils/api/api.graphql' | ||||
| import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers' | ||||
| import { getMonthName } from '@/utils/texts' | ||||
| import { apolloClient } from '@/utils/api/api.graphql' | ||||
| @@ -331,7 +331,7 @@ const onExporting = (e: any) => { | ||||
|     e.cancel = true | ||||
|   } | ||||
| } | ||||
| const getDetail = () => { | ||||
| const getDetail = async () => { | ||||
|   const dateValue = filters.value.periode.split(' s/d ') | ||||
|   const selected = dataSelected.value | ||||
|  | ||||
| @@ -347,24 +347,21 @@ const getDetail = () => { | ||||
|     idUp3: selected?.id_up3 ? selected?.id_up3 : 0 | ||||
|   } | ||||
|  | ||||
|   const { onResult, onError, loading } = useQuery( | ||||
|     queries.keluhan.rekap.rekapKeluhanAllDetail, | ||||
|     query | ||||
|   ) | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       dataSub.value = queryResult.data.detailKeluhanAll | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingSubData.value = value | ||||
|   }) | ||||
|   loadingSubData.value = true | ||||
|   await requestGraphQl(queries.keluhan.rekap.rekapKeluhanAllDetail, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         dataSub.value = result.data.data.detailKeluhanAll | ||||
|       } else { | ||||
|         dataSub.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingSubData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| const dataGridRef = ref<DxDataGrid | null>(null) | ||||
| @@ -391,37 +388,36 @@ const onDataSubSelectionChanged = ({ selectedRowsData }: any) => { | ||||
|   dataSubSelected.value = data | ||||
| } | ||||
|  | ||||
| const filterData = (params: any) => { | ||||
| const filterData = async (params: any) => { | ||||
|   const { regional, ulp, uid, up3, bulan, tahun } = params | ||||
|   currentMonth.value = bulan.id | ||||
|   currentYear.value = tahun.id | ||||
|   lastYear.value = tahun.id - 1 | ||||
|  | ||||
|   const { onResult, onError, loading, refetch } = useQuery( | ||||
|     queries.monalisa.laporan.bulanan.energyNotSalesBulanan, | ||||
|     { | ||||
|       namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|       idUid: uid ? uid.id : 0, | ||||
|       idUp3: up3 ? up3.id : 0, | ||||
|       idUlp: ulp ? ulp.id : 0, | ||||
|       bulan: bulan ? bulan.id : currentMonth.value, | ||||
|       tahun: bulan ? tahun.id : currentYear.value | ||||
|     } | ||||
|   ) | ||||
|   const query = { | ||||
|     namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|     idUid: uid ? uid.id : 0, | ||||
|     idUp3: up3 ? up3.id : 0, | ||||
|     idUlp: ulp ? ulp.id : 0, | ||||
|     bulan: bulan ? bulan.id : currentMonth.value, | ||||
|     tahun: bulan ? tahun.id : currentYear.value | ||||
|   } | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       data.value = queryResult.data.energyNotSalesBulanan | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingData.value = value | ||||
|   }) | ||||
|   loadingData.value = true | ||||
|   await requestGraphQl(queries.monalisa.laporan.bulanan.energyNotSalesBulanan, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         data.value = result.data.data.energyNotSalesBulanan | ||||
|       } else { | ||||
|         data.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| onMounted(() => { | ||||
|   | ||||
| @@ -290,7 +290,7 @@ import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter' | ||||
| import { saveAs } from 'file-saver' | ||||
| import { Workbook } from 'exceljs' | ||||
| import { useQuery } from '@vue/apollo-composable' | ||||
| import { queries } from '@/utils/api/api.graphql' | ||||
| import { queries, requestGraphQl } from '@/utils/api/api.graphql' | ||||
| import { getMonthNameShort } from '@/utils/texts' | ||||
| import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers' | ||||
| import { apolloClient } from '@/utils/api/api.graphql' | ||||
| @@ -353,37 +353,39 @@ const onSelectionChanged = ({ selectedRowsData }: any) => { | ||||
|   clearSelection() | ||||
| } | ||||
|  | ||||
| const filterData = (params: any) => { | ||||
| const filterData = async (params: any) => { | ||||
|   const { regional, ulp, uid, up3, bulan, tahun } = params | ||||
|   currentMonth.value = bulan.id | ||||
|   currentYear.value = tahun.id | ||||
|   lastYear.value = tahun.id - 1 | ||||
|  | ||||
|   const { onResult, onError, loading, refetch } = useQuery( | ||||
|   const query = { | ||||
|     namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|     idUid: uid ? uid.id : 0, | ||||
|     idUp3: up3 ? up3.id : 0, | ||||
|     idUlp: ulp ? ulp.id : 0, | ||||
|     bulan: bulan ? bulan.id : currentMonth.value, | ||||
|     tahun: bulan ? tahun.id : currentYear.value | ||||
|   } | ||||
|  | ||||
|   loadingData.value = true | ||||
|   await requestGraphQl( | ||||
|     queries.monalisa.laporan.bulanan.kepatuhandanAkurasiDalamPelaporanBulanan, | ||||
|     { | ||||
|       namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|       idUid: uid ? uid.id : 0, | ||||
|       idUp3: up3 ? up3.id : 0, | ||||
|       idUlp: ulp ? ulp.id : 0, | ||||
|       bulan: bulan ? bulan.id : currentMonth.value, | ||||
|       tahun: bulan ? tahun.id : currentYear.value | ||||
|     } | ||||
|     query | ||||
|   ) | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       data.value = queryResult.data.kepatuhandanAkurasiDalamPelaporanBulanan | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingData.value = value | ||||
|   }) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         data.value = result.data.data.kepatuhandanAkurasiDalamPelaporanBulanan | ||||
|       } else { | ||||
|         data.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| onMounted(() => { | ||||
|   | ||||
| @@ -989,7 +989,7 @@ import { saveAs } from 'file-saver' | ||||
| import { Workbook } from 'exceljs' | ||||
| import { useQuery } from '@vue/apollo-composable' | ||||
| import { getMonthNameShort } from '@/utils/texts' | ||||
| import { queries } from '@/utils/api/api.graphql' | ||||
| import { queries, requestGraphQl } from '@/utils/api/api.graphql' | ||||
| import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers' | ||||
| import DetailDialog from '@/components/Dialogs/DetailDialog.vue' | ||||
| import InputText from '@/components/InputText.vue' | ||||
| @@ -1044,7 +1044,7 @@ const onExporting = (e: any) => { | ||||
|   } | ||||
| } | ||||
|  | ||||
| const getDetail = () => { | ||||
| const getDetail = async () => { | ||||
|   const dateValue = filters.value.periode.split(' s/d ') | ||||
|   const selected = dataSelected.value | ||||
|  | ||||
| @@ -1060,24 +1060,21 @@ const getDetail = () => { | ||||
|     idUp3: selected?.id_up3 ? selected?.id_up3 : 0 | ||||
|   } | ||||
|  | ||||
|   const { onResult, onError, loading } = useQuery( | ||||
|     queries.keluhan.rekap.rekapKeluhanAllDetail, | ||||
|     query | ||||
|   ) | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       dataSub.value = queryResult.data.detailKeluhanAll | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingSubData.value = value | ||||
|   }) | ||||
|   loadingSubData.value = true | ||||
|   await requestGraphQl(queries.keluhan.rekap.rekapKeluhanAllDetail, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         dataSub.value = result.data.data.detailKeluhanAll | ||||
|       } else { | ||||
|         dataSub.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingSubData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| const dataGridRef = ref<DxDataGrid | null>(null) | ||||
| @@ -1104,38 +1101,37 @@ const onDataSubSelectionChanged = ({ selectedRowsData }: any) => { | ||||
|   dataSubSelected.value = data | ||||
| } | ||||
|  | ||||
| const filterData = (params: any) => { | ||||
| const filterData = async (params: any) => { | ||||
|   const { regional, ulp, uid, up3, bulan, tahun } = params | ||||
|  | ||||
|   currentMonth.value = bulan.id | ||||
|   currentYear.value = tahun.id | ||||
|   lastYear.value = tahun.id - 1 | ||||
|  | ||||
|   const { onResult, onError, loading, refetch } = useQuery( | ||||
|     queries.monalisa.laporan.bulanan.penurunanJumlahKomplainBulanan, | ||||
|     { | ||||
|       namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|       idUid: uid ? uid.id : 0, | ||||
|       idUp3: up3 ? up3.id : 0, | ||||
|       idUlp: ulp ? ulp.id : 0, | ||||
|       bulan: bulan ? bulan.id : currentMonth.value, | ||||
|       tahun: bulan ? tahun.id : currentYear.value | ||||
|     } | ||||
|   ) | ||||
|   const query = { | ||||
|     namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|     idUid: uid ? uid.id : 0, | ||||
|     idUp3: up3 ? up3.id : 0, | ||||
|     idUlp: ulp ? ulp.id : 0, | ||||
|     bulan: bulan ? bulan.id : currentMonth.value, | ||||
|     tahun: bulan ? tahun.id : currentYear.value | ||||
|   } | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       data.value = queryResult.data.penurunanJumlahKomplainBulanan | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingData.value = value | ||||
|   }) | ||||
|   loadingData.value = true | ||||
|   await requestGraphQl(queries.monalisa.laporan.bulanan.penurunanJumlahKomplainBulanan, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         data.value = result.data.data.penurunanJumlahKomplainBulanan | ||||
|       } else { | ||||
|         data.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| onMounted(() => { | ||||
|   | ||||
| @@ -362,7 +362,7 @@ import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter' | ||||
| import { saveAs } from 'file-saver' | ||||
| import { Workbook } from 'exceljs' | ||||
| import { useQuery } from '@vue/apollo-composable' | ||||
| import { queries } from '@/utils/api/api.graphql' | ||||
| import { queries, requestGraphQl } from '@/utils/api/api.graphql' | ||||
| import { getMonthName, getMonthNameShort } from '@/utils/texts' | ||||
| import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers' | ||||
|  | ||||
| @@ -409,7 +409,7 @@ const onExporting = (e: any) => { | ||||
|     e.cancel = true | ||||
|   } | ||||
| } | ||||
| const getDetail = () => { | ||||
| const getDetail = async () => { | ||||
|   const dateValue = filters.value.periode.split(' s/d ') | ||||
|   const selected = dataSelected.value | ||||
|  | ||||
| @@ -425,24 +425,21 @@ const getDetail = () => { | ||||
|     idUp3: selected?.id_up3 ? selected?.id_up3 : 0 | ||||
|   } | ||||
|  | ||||
|   const { onResult, onError, loading } = useQuery( | ||||
|     queries.keluhan.rekap.rekapKeluhanAllDetail, | ||||
|     query | ||||
|   ) | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       dataSub.value = queryResult.data.detailKeluhanAll | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingSubData.value = value | ||||
|   }) | ||||
|   loadingSubData.value = true | ||||
|   await requestGraphQl(queries.keluhan.rekap.rekapKeluhanAllDetail, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         dataSub.value = result.data.data.detailKeluhanAll | ||||
|       } else { | ||||
|         dataSub.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingSubData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| const dataGridRef = ref<DxDataGrid | null>(null) | ||||
| @@ -468,36 +465,35 @@ const onDataSubSelectionChanged = ({ selectedRowsData }: any) => { | ||||
|   const data = selectedRowsData[0] | ||||
|   dataSubSelected.value = data | ||||
| } | ||||
| const filterData = (params: any) => { | ||||
| const filterData = async (params: any) => { | ||||
|   const { regional, ulp, uid, up3, bulan, tahun } = params | ||||
|   currentYear.value = tahun.id | ||||
|   currentMonth.value = bulan.id | ||||
|  | ||||
|   const { onResult, onError, loading, refetch } = useQuery( | ||||
|     queries.monalisa.laporan.kumulatif.agingComplaintKumulatif, | ||||
|     { | ||||
|       namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|       idUlp: ulp ? ulp.id : 0, | ||||
|       idUid: uid ? uid.id : 0, | ||||
|       idUp3: up3 ? up3.id : 0, | ||||
|       bulan: bulan ? bulan.id : 10, | ||||
|       tahun: bulan ? tahun.id : 2023 | ||||
|     } | ||||
|   ) | ||||
|   const query = { | ||||
|     namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|     idUlp: ulp ? ulp.id : 0, | ||||
|     idUid: uid ? uid.id : 0, | ||||
|     idUp3: up3 ? up3.id : 0, | ||||
|     bulan: bulan ? bulan.id : 10, | ||||
|     tahun: bulan ? tahun.id : 2023 | ||||
|   } | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       data.value = queryResult.data.agingComplaintKumulatif | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingData.value = value | ||||
|   }) | ||||
|   loadingData.value = true | ||||
|   await requestGraphQl(queries.monalisa.laporan.kumulatif.agingComplaintKumulatif, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         data.value = result.data.data.agingComplaintKumulatif | ||||
|       } else { | ||||
|         data.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingData.value = false | ||||
|     }) | ||||
| } | ||||
| const filters = ref() | ||||
|  | ||||
|   | ||||
| @@ -278,7 +278,7 @@ import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter' | ||||
| import { saveAs } from 'file-saver' | ||||
| import { Workbook } from 'exceljs' | ||||
| import { useQuery } from '@vue/apollo-composable' | ||||
| import { queries } from '@/utils/api/api.graphql' | ||||
| import { queries, requestGraphQl } from '@/utils/api/api.graphql' | ||||
| import { getMonthName } from '@/utils/texts' | ||||
| import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers' | ||||
| import { apolloClient } from '@/utils/api/api.graphql' | ||||
| @@ -331,7 +331,7 @@ const onExporting = (e: any) => { | ||||
|     e.cancel = true | ||||
|   } | ||||
| } | ||||
| const getDetail = () => { | ||||
| const getDetail = async () => { | ||||
|   const dateValue = filters.value.periode.split(' s/d ') | ||||
|   const selected = dataSelected.value | ||||
|  | ||||
| @@ -347,24 +347,21 @@ const getDetail = () => { | ||||
|     idUp3: selected?.id_up3 ? selected?.id_up3 : 0 | ||||
|   } | ||||
|  | ||||
|   const { onResult, onError, loading } = useQuery( | ||||
|     queries.keluhan.rekap.rekapKeluhanAllDetail, | ||||
|     query | ||||
|   ) | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       dataSub.value = queryResult.data.detailKeluhanAll | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingSubData.value = value | ||||
|   }) | ||||
|   loadingSubData.value = true | ||||
|   await requestGraphQl(queries.keluhan.rekap.rekapKeluhanAllDetail, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         dataSub.value = result.data.data.detailKeluhanAll | ||||
|       } else { | ||||
|         dataSub.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingSubData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| const dataGridRef = ref<DxDataGrid | null>(null) | ||||
| @@ -391,38 +388,37 @@ const onDataSubSelectionChanged = ({ selectedRowsData }: any) => { | ||||
|   dataSubSelected.value = data | ||||
| } | ||||
|  | ||||
| const filterData = (params: any) => { | ||||
| const filterData = async (params: any) => { | ||||
|   const { regional, ulp, uid, up3, bulan, tahun } = params | ||||
|  | ||||
|   currentMonth.value = bulan.id | ||||
|   currentYear.value = tahun.id | ||||
|   lastYear.value = tahun.id - 1 | ||||
|  | ||||
|   const { onResult, onError, loading, refetch } = useQuery( | ||||
|     queries.monalisa.laporan.kumulatif.energyNotSalesKumulatif, | ||||
|     { | ||||
|       namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|       idUlp: ulp ? ulp.id : 0, | ||||
|       idUid: uid ? uid.id : 0, | ||||
|       idUp3: up3 ? up3.id : 0, | ||||
|       bulan: bulan ? bulan.id : currentMonth.value, | ||||
|       tahun: bulan ? tahun.id : currentYear.value | ||||
|     } | ||||
|   ) | ||||
|   const query = { | ||||
|     namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|     idUlp: ulp ? ulp.id : 0, | ||||
|     idUid: uid ? uid.id : 0, | ||||
|     idUp3: up3 ? up3.id : 0, | ||||
|     bulan: bulan ? bulan.id : currentMonth.value, | ||||
|     tahun: bulan ? tahun.id : currentYear.value | ||||
|   } | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       data.value = queryResult.data.energyNotSalesKumulatif | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingData.value = value | ||||
|   }) | ||||
|   loadingData.value = true | ||||
|   await requestGraphQl(queries.monalisa.laporan.kumulatif.energyNotSalesKumulatif, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         data.value = result.data.data.energyNotSalesKumulatif | ||||
|       } else { | ||||
|         data.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| onMounted(() => { | ||||
|   | ||||
| @@ -290,7 +290,7 @@ import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter' | ||||
| import { saveAs } from 'file-saver' | ||||
| import { Workbook } from 'exceljs' | ||||
| import { useQuery } from '@vue/apollo-composable' | ||||
| import { queries } from '@/utils/api/api.graphql' | ||||
| import { queries, requestGraphQl } from '@/utils/api/api.graphql' | ||||
| import { getMonthNameShort } from '@/utils/texts' | ||||
| import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers' | ||||
| import { apolloClient } from '@/utils/api/api.graphql' | ||||
| @@ -343,7 +343,7 @@ const onExporting = (e: any) => { | ||||
|     e.cancel = true | ||||
|   } | ||||
| } | ||||
| const getDetail = () => { | ||||
| const getDetail = async () => { | ||||
|   const dateValue = filters.value.periode.split(' s/d ') | ||||
|   const selected = dataSelected.value | ||||
|  | ||||
| @@ -359,24 +359,21 @@ const getDetail = () => { | ||||
|     idUp3: selected?.id_up3 ? selected?.id_up3 : 0 | ||||
|   } | ||||
|  | ||||
|   const { onResult, onError, loading } = useQuery( | ||||
|     queries.keluhan.rekap.rekapKeluhanAllDetail, | ||||
|     query | ||||
|   ) | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       dataSub.value = queryResult.data.detailKeluhanAll | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingSubData.value = value | ||||
|   }) | ||||
|   loadingSubData.value = true | ||||
|   await requestGraphQl(queries.keluhan.rekap.rekapKeluhanAllDetail, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         dataSub.value = result.data.data.detailKeluhanAll | ||||
|       } else { | ||||
|         dataSub.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingSubData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| const dataGridRef = ref<DxDataGrid | null>(null) | ||||
| @@ -403,38 +400,40 @@ const onDataSubSelectionChanged = ({ selectedRowsData }: any) => { | ||||
|   dataSubSelected.value = data | ||||
| } | ||||
|  | ||||
| const filterData = (params: any) => { | ||||
| const filterData = async (params: any) => { | ||||
|   const { regional, ulp, uid, up3, bulan, tahun } = params | ||||
|  | ||||
|   currentMonth.value = bulan.id | ||||
|   currentYear.value = tahun.id | ||||
|   lastYear.value = tahun.id - 1 | ||||
|  | ||||
|   const { onResult, onError, loading, refetch } = useQuery( | ||||
|   const query = { | ||||
|     namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|     idUlp: ulp ? ulp.id : 0, | ||||
|     idUid: uid ? uid.id : 0, | ||||
|     idUp3: up3 ? up3.id : 0, | ||||
|     bulan: bulan ? bulan.id : currentMonth.value, | ||||
|     tahun: bulan ? tahun.id : currentYear.value | ||||
|   } | ||||
|  | ||||
|   loadingData.value = true | ||||
|   await requestGraphQl( | ||||
|     queries.monalisa.laporan.kumulatif.kepatuhandanAkurasiDalamPelaporanKumulatif, | ||||
|     { | ||||
|       namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|       idUlp: ulp ? ulp.id : 0, | ||||
|       idUid: uid ? uid.id : 0, | ||||
|       idUp3: up3 ? up3.id : 0, | ||||
|       bulan: bulan ? bulan.id : currentMonth.value, | ||||
|       tahun: bulan ? tahun.id : currentYear.value | ||||
|     } | ||||
|     query | ||||
|   ) | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       data.value = queryResult.data.kepatuhandanAkurasiDalamPelaporanKumulatif | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingData.value = value | ||||
|   }) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         data.value = result.data.data.kepatuhandanAkurasiDalamPelaporanKumulatif | ||||
|       } else { | ||||
|         data.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| onMounted(() => { | ||||
|   | ||||
| @@ -738,7 +738,7 @@ import { saveAs } from 'file-saver' | ||||
| import { Workbook } from 'exceljs' | ||||
| import { useQuery } from '@vue/apollo-composable' | ||||
| import { getMonthName } from '@/utils/texts' | ||||
| import { queries } from '@/utils/api/api.graphql' | ||||
| import { queries, requestGraphQl } from '@/utils/api/api.graphql' | ||||
| import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers' | ||||
| import { apolloClient } from '@/utils/api/api.graphql' | ||||
| import { provideApolloClient } from '@vue/apollo-composable' | ||||
| @@ -790,7 +790,7 @@ const onExporting = (e: any) => { | ||||
|     e.cancel = true | ||||
|   } | ||||
| } | ||||
| const getDetail = () => { | ||||
| const getDetail = async () => { | ||||
|   const dateValue = filters.value.periode.split(' s/d ') | ||||
|   const selected = dataSelected.value | ||||
|  | ||||
| @@ -806,24 +806,21 @@ const getDetail = () => { | ||||
|     idUp3: selected?.id_up3 ? selected?.id_up3 : 0 | ||||
|   } | ||||
|  | ||||
|   const { onResult, onError, loading } = useQuery( | ||||
|     queries.keluhan.rekap.rekapKeluhanAllDetail, | ||||
|     query | ||||
|   ) | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       dataSub.value = queryResult.data.detailKeluhanAll | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingSubData.value = value | ||||
|   }) | ||||
|   loadingSubData.value = true | ||||
|   await requestGraphQl(queries.keluhan.rekap.rekapKeluhanAllDetail, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         dataSub.value = result.data.data.detailKeluhanAll | ||||
|       } else { | ||||
|         dataSub.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingSubData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| const dataGridRef = ref<DxDataGrid | null>(null) | ||||
| @@ -850,38 +847,37 @@ const onDataSubSelectionChanged = ({ selectedRowsData }: any) => { | ||||
|   dataSubSelected.value = data | ||||
| } | ||||
|  | ||||
| const filterData = (params: any) => { | ||||
| const filterData = async (params: any) => { | ||||
|   const { regional, ulp, uid, up3, bulan, tahun } = params | ||||
|  | ||||
|   currentYear.value = tahun.id | ||||
|   currentMonth.value = bulan.id | ||||
|   lastYear.value = tahun.id - 1 | ||||
|  | ||||
|   const { onResult, onError, loading, refetch } = useQuery( | ||||
|     queries.monalisa.laporan.kumulatif.penurunanJumlahKomplainKumulatif, | ||||
|     { | ||||
|       namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|       idUlp: ulp ? ulp.id : 0, | ||||
|       idUid: uid ? uid.id : 0, | ||||
|       idUp3: up3 ? up3.id : 0, | ||||
|       bulan: bulan ? bulan.id : currentMonth.value, | ||||
|       tahun: bulan ? tahun.id : currentYear.value | ||||
|     } | ||||
|   ) | ||||
|   const query = { | ||||
|     namaRegional: regional.name == 'Semua Regional' ? '' : regional.name, | ||||
|     idUlp: ulp ? ulp.id : 0, | ||||
|     idUid: uid ? uid.id : 0, | ||||
|     idUp3: up3 ? up3.id : 0, | ||||
|     bulan: bulan ? bulan.id : currentMonth.value, | ||||
|     tahun: bulan ? tahun.id : currentYear.value | ||||
|   } | ||||
|  | ||||
|   onResult((queryResult) => { | ||||
|     if (queryResult.data != undefined) { | ||||
|       data.value = queryResult.data.penurunanJumlahKomplainKumulatif | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   onError((error) => { | ||||
|     console.log(error) | ||||
|   }) | ||||
|  | ||||
|   watch(loading, (value) => { | ||||
|     loadingData.value = value | ||||
|   }) | ||||
|   loadingData.value = true | ||||
|   await requestGraphQl(queries.monalisa.laporan.kumulatif.penurunanJumlahKomplainKumulatif, query) | ||||
|     .then((result) => { | ||||
|       if (result.data.data != undefined) { | ||||
|         data.value = result.data.data.penurunanJumlahKomplainKumulatif | ||||
|       } else { | ||||
|         data.value = [] | ||||
|       } | ||||
|     }) | ||||
|     .catch((err) => { | ||||
|       console.error(err) | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loadingData.value = false | ||||
|     }) | ||||
| } | ||||
|  | ||||
| onMounted(() => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user