feat: implement server side in daftar gangguan response time
This commit is contained in:
parent
ed931d8eb3
commit
768abf7dbf
@ -32,15 +32,7 @@
|
||||
:show-info="true"
|
||||
:show-navigation-buttons="true"
|
||||
/>
|
||||
<!-- <DxLoadPanel
|
||||
shading-color="rgba(0,0,0,0.4)"
|
||||
:position="position"
|
||||
:show-indicator="showIndicator"
|
||||
:show-pane="showPane"
|
||||
:shading="shading"
|
||||
v-model:visible.sync="loadingData"
|
||||
:enabled="true"
|
||||
/> -->
|
||||
<DxLoadPanel :enabled="true" />
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
<DxExport
|
||||
:enabled="true"
|
||||
@ -429,6 +421,7 @@ import BufferDialog from '@/components/Dialogs/BufferDialog.vue'
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
import {
|
||||
DxColumn,
|
||||
DxLoadPanel,
|
||||
DxExport,
|
||||
DxPager,
|
||||
DxPaging,
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Filters @reset-form="data = []" @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Filters @reset-form="resetData" @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Type7 @update:filters="(value) => (filters = value)" />
|
||||
</Filters>
|
||||
|
||||
@ -9,7 +9,8 @@
|
||||
:allow-column-reordering="true"
|
||||
class="max-h-[calc(100vh-140px)] mb-10"
|
||||
:data-source="data"
|
||||
v-if="loading == false"
|
||||
@option-changed="handleRequestChange"
|
||||
:remote-operations="true"
|
||||
:show-column-lines="true"
|
||||
:show-row-lines="false"
|
||||
:show-borders="true"
|
||||
@ -21,6 +22,7 @@
|
||||
:allow-column-resizing="true"
|
||||
column-resizing-mode="widget"
|
||||
>
|
||||
<DxLoadPanel :enabled="true" />
|
||||
<DxSelection mode="single" />
|
||||
<DxPaging :page-size="20" :enabled="true" />
|
||||
<DxPager
|
||||
@ -31,16 +33,6 @@
|
||||
:show-info="true"
|
||||
:show-navigation-buttons="true"
|
||||
/>
|
||||
<!-- <DxLoadPanel
|
||||
shading-color="rgba(0,0,0,0.4)"
|
||||
:position="position"
|
||||
:show-indicator="showIndicator"
|
||||
:show-pane="showPane"
|
||||
:shading="shading"
|
||||
v-if="loading"
|
||||
v-model:visible="loading"
|
||||
:enabled="true"
|
||||
/> -->
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
<DxExport
|
||||
:enabled="true"
|
||||
@ -48,13 +40,13 @@
|
||||
:allow-export-selected-data="false"
|
||||
/>
|
||||
<DxColumn
|
||||
css-class="custom-table-column"
|
||||
:allow-sorting="false"
|
||||
css-class="custom-table-column !text-right"
|
||||
:width="50"
|
||||
alignment="center"
|
||||
:calculate-display-value="(item: any) => data.findIndex((i) => i == item) + 1"
|
||||
data-type="number"
|
||||
data-field="no"
|
||||
caption="No"
|
||||
cell-template="cellCenter"
|
||||
/>
|
||||
|
||||
<DxColumn
|
||||
@ -309,71 +301,191 @@
|
||||
</div>
|
||||
</div>
|
||||
</DetailDialog>
|
||||
|
||||
<BufferDialog v-if="loading" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type7 from '@/components/Form/FiltersType/Type7.vue'
|
||||
import { formatWaktu } from '@/components/Form/FiltersType/reference'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import DetailDialog from '@/components/Dialogs/DetailDialog.vue'
|
||||
import InputText from '@/components/InputText.vue'
|
||||
import CustomStore from 'devextreme/data/custom_store'
|
||||
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
import {
|
||||
DxColumn,
|
||||
DxExport,
|
||||
DxLoadPanel,
|
||||
DxExport,
|
||||
DxPager,
|
||||
DxPaging,
|
||||
DxSearchPanel,
|
||||
DxSelection
|
||||
} from 'devextreme-vue/data-grid'
|
||||
import DetailDialog from '@/components/Dialogs/DetailDialog.vue'
|
||||
import InputText from '@/components/InputText.vue'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import { formatWaktu } from '@/components/Form/FiltersType/reference'
|
||||
import { ref, reactive } from 'vue'
|
||||
import { queries, requestGraphQl } from '@/utils/api/api.graphql'
|
||||
import {
|
||||
exportToPDF,
|
||||
exportToXLSX,
|
||||
exportToDOCX
|
||||
} from '@/report/Gangguan/Daftar/DGangguan_ResponseTime'
|
||||
import BufferDialog from '@/components/Dialogs/BufferDialog.vue'
|
||||
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
const showPane = ref(true)
|
||||
const data = ref<any[]>([])
|
||||
import type { IRequestOptions } from '@/types/requestParams'
|
||||
|
||||
const requestOptions = reactive<IRequestOptions>({
|
||||
skip: 0,
|
||||
take: 20,
|
||||
requireTotalCount: true,
|
||||
sort: null,
|
||||
filter: null
|
||||
})
|
||||
const dataSelected = ref<any>({})
|
||||
const dialogDetail = ref(false)
|
||||
const reportData: any = ref(null)
|
||||
const dataGridRef = ref<DxDataGrid | null>(null)
|
||||
const loading = ref(false)
|
||||
const filters = ref()
|
||||
const reportMeta = ref({
|
||||
uid: { id: 0, name: 'Semua Unit Induk Distribusi/Wilayah' },
|
||||
up3: { id: 0, name: 'Semua Unit Pelaksanaan Pelayanan Pelanggan' },
|
||||
posko: { id: 0, name: 'Semua Posko' },
|
||||
periode: '',
|
||||
minTime: '',
|
||||
maxTime: ''
|
||||
})
|
||||
|
||||
const allowTableRequest = ref(false)
|
||||
const data = new CustomStore({
|
||||
load: async (loadOptions: any) => {
|
||||
if (allowTableRequest.value) {
|
||||
loadOptions.requireTotalCount = true
|
||||
|
||||
const query = {
|
||||
skip: loadOptions.skip,
|
||||
take: loadOptions.take,
|
||||
sort: loadOptions.sort ? loadOptions.sort : null,
|
||||
filter: loadOptions.filter ? mapSearchOptions(loadOptions.filter) : null,
|
||||
requireTotalCount: loadOptions.requireTotalCount,
|
||||
...createQuery(filters.value)
|
||||
}
|
||||
|
||||
return await requestGraphQl(queries.gangguan.daftar.ssdaftarGangguanResponseTime, query)
|
||||
.then((result) => {
|
||||
const response = result.data.data.ssdaftarGangguanResponseTime
|
||||
|
||||
let no = query.skip ?? 0
|
||||
|
||||
for (const data of response.data) {
|
||||
data.no = ++no
|
||||
}
|
||||
|
||||
return {
|
||||
data: response.data,
|
||||
totalCount: response.totalCount
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
throw Error(err)
|
||||
})
|
||||
.finally(() => {
|
||||
reportMeta.value = filters.value
|
||||
})
|
||||
} else {
|
||||
return new Promise(function (resolve) {
|
||||
resolve({
|
||||
data: [],
|
||||
totalCount: 0
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const clearSelection = () => {
|
||||
const dataGrid = dataGridRef.value!.instance!
|
||||
dataGrid.clearSelection()
|
||||
}
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
if (selectedRowsData[0] != undefined) {
|
||||
dataSelected.value = selectedRowsData[0]
|
||||
}
|
||||
clearSelection()
|
||||
showDetail()
|
||||
}
|
||||
|
||||
const showDetail = () => (dialogDetail.value = true)
|
||||
|
||||
const closeDialog = () => (dialogDetail.value = false)
|
||||
|
||||
const resetData = () => {
|
||||
data.value = []
|
||||
allowTableRequest.value = false
|
||||
|
||||
const dataGrid = dataGridRef.value!.instance!
|
||||
const dataGridDataSource = dataGrid.getDataSource()
|
||||
|
||||
dataGridDataSource.reload()
|
||||
}
|
||||
|
||||
const filterData = async (params: any) => {
|
||||
resetData()
|
||||
const handleRequestChange = (e: any) => {
|
||||
if (e.name === 'searchPanel') {
|
||||
if (e.value !== '') {
|
||||
requestOptions.filter = createSearchOptions(e.value)
|
||||
} else {
|
||||
requestOptions.filter = null
|
||||
}
|
||||
}
|
||||
|
||||
if (e.name === 'paging') {
|
||||
requestOptions.take = e.value
|
||||
}
|
||||
|
||||
if (e.name === 'columns') {
|
||||
const columnIndex = parseInt(e.fullName.match(/\[(\d+)\]/)[1])
|
||||
const columnDataField = e.component.columnOption(columnIndex).dataField
|
||||
|
||||
requestOptions.sort = [
|
||||
{
|
||||
selector: columnDataField,
|
||||
desc: e.value === 'desc'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
const createSearchOptions = (keyword: string) => {
|
||||
const dataGrid = dataGridRef.value!.instance!
|
||||
const columns = dataGrid.getVisibleColumns()
|
||||
|
||||
const searchOptions = []
|
||||
|
||||
for (const column of columns) {
|
||||
if (column.dataField === 'no' || !column.dataField) {
|
||||
continue
|
||||
}
|
||||
|
||||
searchOptions.push({
|
||||
field: column.dataField,
|
||||
value: keyword
|
||||
})
|
||||
}
|
||||
|
||||
return searchOptions
|
||||
}
|
||||
|
||||
const mapSearchOptions = (searchOptions: any) => {
|
||||
const result = searchOptions.map((option: any) => {
|
||||
if (Array.isArray(option) && option[0] !== 'no') {
|
||||
return {
|
||||
field: option[0],
|
||||
value: option[2]
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return result.filter((item: any) => item)
|
||||
}
|
||||
|
||||
const filterData = () => {
|
||||
allowTableRequest.value = true
|
||||
|
||||
const dataGrid = dataGridRef.value!.instance!
|
||||
const dataGridDataSource = dataGrid.getDataSource()
|
||||
|
||||
dataGridDataSource.reload()
|
||||
}
|
||||
|
||||
const createQuery = (params: any) => {
|
||||
const { minTime, maxTime, posko, uid, up3 } = params
|
||||
const dateValue = params.periode.split(' s/d ')
|
||||
|
||||
const query = {
|
||||
return {
|
||||
dateFrom: dateValue[0]
|
||||
? dateValue[0].split('-').reverse().join('-')
|
||||
: new Date().toISOString().slice(0, 10),
|
||||
@ -386,157 +498,44 @@ const filterData = async (params: any) => {
|
||||
idUid: uid ? uid.id : 0,
|
||||
idUp3: up3 ? up3.id : 0
|
||||
}
|
||||
loading.value = true
|
||||
await requestGraphQl(queries.gangguan.daftar.responseTime, query)
|
||||
.then((result) => {
|
||||
if (result.data.data != undefined) {
|
||||
data.value = result.data.data.daftarGangguanResponseTime
|
||||
} else {
|
||||
data.value = []
|
||||
}
|
||||
|
||||
reportMeta.value = filters.value
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
exportToPDF(reportMeta, data)
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
if (selectedRowsData[0] != undefined) {
|
||||
dataSelected.value = selectedRowsData[0]
|
||||
}
|
||||
|
||||
clearSelection()
|
||||
showDetail()
|
||||
}
|
||||
|
||||
const showDetail = () => (dialogDetail.value = true)
|
||||
|
||||
const closeDialog = () => (dialogDetail.value = false)
|
||||
|
||||
const onExporting = async (e: any) => {
|
||||
const dataGrid = dataGridRef.value!.instance!
|
||||
|
||||
if (e.format === 'pdf' || e.format === 'document') {
|
||||
reportData.value = await data.load()
|
||||
}
|
||||
|
||||
if (e.format === 'pdf' && reportData.value) {
|
||||
dataGrid.beginCustomLoading('')
|
||||
const pdf = await exportToPDF(reportMeta, reportData)
|
||||
|
||||
if (pdf) {
|
||||
dataGrid.endCustomLoading()
|
||||
}
|
||||
} else if (e.format === 'xlsx') {
|
||||
exportToXLSX(reportMeta, data, e)
|
||||
} else {
|
||||
exportToDOCX(reportMeta, data)
|
||||
exportToXLSX(reportMeta, e)
|
||||
} else if (e.format === 'document' && reportData.value) {
|
||||
dataGrid.beginCustomLoading('')
|
||||
const doc = await exportToDOCX(reportMeta, reportData)
|
||||
|
||||
if (doc) {
|
||||
dataGrid.endCustomLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
const reportMeta = ref({
|
||||
uid: { id: 0, name: 'Semua Unit Induk Distribusi/Wilayah' },
|
||||
up3: { id: 0, name: 'Semua Unit Pelaksanaan Pelayanan Pelanggan' },
|
||||
posko: { id: 0, name: 'Semua Posko' },
|
||||
periode: '',
|
||||
minTime: '',
|
||||
maxTime: ''
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (import.meta.env.DEV) {
|
||||
data.value = [
|
||||
{
|
||||
no_laporan: 'G5423020100150',
|
||||
pembuat_laporan: 'PLNMOBILE',
|
||||
waktu_lapor: '01-02-2023 00:16:17',
|
||||
waktu_response: '01-02-2023 00:56:28',
|
||||
waktu_recovery: '01-02-2023 01:00:37',
|
||||
durasi_response_time: 2411,
|
||||
durasi_recovery_time: 249,
|
||||
status_akhir: 'Selesai',
|
||||
is_marking: 0,
|
||||
referensi_marking: 'P3124142424',
|
||||
idpel_nometer: '',
|
||||
nama_pelapor: 'Raihana S. Rahmahadi',
|
||||
alamat_pelapor: 'JL BKT RAFLESIA N8-16',
|
||||
no_telp_pelapor: '6282138889101',
|
||||
keterangan_pelapor:
|
||||
'MCB LEMAH DAYA RI/2200VA. SESUAI INFO PELANGGAN SUDAH ADA PETUGAS YANG MENGHUBUNGI DIINFORMASIKAN AKAN ADA PETUGAS YANG DATANG KE LOKASI.',
|
||||
media: 'PLN Mobile',
|
||||
nama_posko: 'POSKO CIRACAS',
|
||||
penyebab: 'P3124142424',
|
||||
tindakan: 'P3124142424'
|
||||
},
|
||||
{
|
||||
no_laporan: 'G5423020100985',
|
||||
pembuat_laporan: 'PLNMOBILE',
|
||||
waktu_lapor: '01-02-2023 03:09:50',
|
||||
waktu_response: '01-02-2023 03:42:40',
|
||||
waktu_recovery: '01-02-2023 03:49:35',
|
||||
durasi_response_time: 1970,
|
||||
durasi_recovery_time: 415,
|
||||
status_akhir: 'Selesai',
|
||||
is_marking: 0,
|
||||
referensi_marking: 'P3124142424',
|
||||
idpel_nometer: '',
|
||||
nama_pelapor: 'Risky Ariyanto',
|
||||
alamat_pelapor: 'JL JANKES AD No. RT.7 RW.2',
|
||||
no_telp_pelapor: '6285240208016',
|
||||
keterangan_pelapor: 'gagal isi token dan di meteran ada tulisan Periksa',
|
||||
media: 'PLN Mobile',
|
||||
nama_posko: 'POSKO CIRACAS',
|
||||
penyebab: 'P3124142424',
|
||||
tindakan: 'P3124142424'
|
||||
},
|
||||
{
|
||||
no_laporan: 'G5423020101461',
|
||||
pembuat_laporan: 'PLNMOBILE',
|
||||
waktu_lapor: '01-02-2023 05:38:01',
|
||||
waktu_response: '01-02-2023 05:48:13',
|
||||
waktu_recovery: '01-02-2023 05:54:06',
|
||||
durasi_response_time: 612,
|
||||
durasi_recovery_time: 353,
|
||||
status_akhir: 'Selesai',
|
||||
is_marking: 0,
|
||||
referensi_marking: 'P3124142424',
|
||||
idpel_nometer: '',
|
||||
nama_pelapor: 'Junaedi Muntoro',
|
||||
alamat_pelapor: 'PR BKT GOLF ARCADIA BLK G.06 No.5 CBBR',
|
||||
no_telp_pelapor: '628111588806',
|
||||
keterangan_pelapor:
|
||||
'Mohon bantuan isi token PLN 3214732093\\n\\nPT. KARYA CANTIKA KUSUMA\\n\\nBukit Golf Riverside\\nKluster Arcadia Blok G6/5\\nBojong Nangka Gunung Putri Bogor\\n\\nGagal isi Tokel Tertera Meteran TERPERIKSA.\\n\\nMOHON BANTUAN PAK..',
|
||||
media: 'PLN Mobile',
|
||||
nama_posko: 'POSKO CIRACAS',
|
||||
penyebab: 'P3124142424',
|
||||
tindakan: 'P3124142424'
|
||||
},
|
||||
{
|
||||
no_laporan: 'G5523020100067',
|
||||
pembuat_laporan: 'CC.55.SUMIATI',
|
||||
waktu_lapor: '01-02-2023 05:57:02',
|
||||
waktu_response: '01-02-2023 06:18:55',
|
||||
waktu_recovery: '01-01-1970 00:00:00',
|
||||
durasi_response_time: 1313,
|
||||
durasi_recovery_time: 0,
|
||||
status_akhir: 'Dibatalkan',
|
||||
is_marking: 0,
|
||||
referensi_marking: 'P3124142424',
|
||||
idpel_nometer: '',
|
||||
nama_pelapor: 'BP ANAL ',
|
||||
alamat_pelapor: 'JL MANUNGGAL RT 05 RW 02 KEL KELAPA DUA WETAN KEC CIRACAS JAKARTA TIMUR ',
|
||||
no_telp_pelapor: '6285777592240',
|
||||
keterangan_pelapor: 'BANYAK RUMAH PADAM ',
|
||||
media: 'Call PLN 123',
|
||||
nama_posko: 'POSKO CIRACAS',
|
||||
penyebab: 'P3124142424',
|
||||
tindakan: 'P3124142424'
|
||||
},
|
||||
{
|
||||
no_laporan: 'G5423020103015',
|
||||
pembuat_laporan: 'CC.54.EKA.CSOI',
|
||||
waktu_lapor: '01-02-2023 07:39:03',
|
||||
waktu_response: '01-02-2023 08:14:56',
|
||||
waktu_recovery: '01-02-2023 08:19:32',
|
||||
durasi_response_time: 2153,
|
||||
durasi_recovery_time: 276,
|
||||
status_akhir: 'Selesai',
|
||||
is_marking: 0,
|
||||
referensi_marking: 'P3124142424',
|
||||
idpel_nometer: '',
|
||||
nama_pelapor: 'IBU DIN',
|
||||
alamat_pelapor:
|
||||
'JL. HAJI MIUN NO.97 RT. 1 RW 2 KEL KALISARI KEC. PASAR REBO JAKTIM, SEBERANG CAFE LAW COFFE ',
|
||||
no_telp_pelapor: '082112050265',
|
||||
keterangan_pelapor: 'MCB LEMAH DAYA 1.300 VA ',
|
||||
media: 'Call PLN 123',
|
||||
nama_posko: 'POSKO CIRACAS',
|
||||
penyebab: 'P3124142424',
|
||||
tindakan: 'P3124142424'
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
@ -64,12 +64,13 @@ const formatMetaData = (reportMeta: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const exportToPDF = (reportMeta: any, data: any) => {
|
||||
const exportToPDF = async (reportMeta: any, data: any) => {
|
||||
const meta = formatMetaData(reportMeta)
|
||||
const day = new Date().toLocaleString('id-ID', { weekday: 'long' })
|
||||
const date = new Date().getDate()
|
||||
const month = new Date().toLocaleString('id-ID', { month: 'long' })
|
||||
const year = new Date().getFullYear()
|
||||
const resultData = data.value.data
|
||||
const doc = new jsPDF({
|
||||
orientation: 'landscape'
|
||||
})
|
||||
@ -150,7 +151,7 @@ const exportToPDF = (reportMeta: any, data: any) => {
|
||||
'Posko'
|
||||
]
|
||||
],
|
||||
body: data.value.map((item: any, i: any) => [
|
||||
body: resultData.map((item: any, i: any) => [
|
||||
{ content: ++i, styles: { halign: 'right' } },
|
||||
item.no_laporan,
|
||||
item.waktu_lapor,
|
||||
@ -217,12 +218,19 @@ const exportToPDF = (reportMeta: any, data: any) => {
|
||||
margin: { left: 230 }
|
||||
})
|
||||
|
||||
doc.save(`Laporan ${reportName}.pdf`, { returnPromise: true }).then(() => {
|
||||
console.log('pdf berhasil disimpan')
|
||||
})
|
||||
await doc
|
||||
.save(`Laporan ${reportName}.pdf`, { returnPromise: true })
|
||||
.then(() => {
|
||||
console.log('PDF Exported')
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error while exporting PDF', error)
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
const exportToXLSX = (reportMeta: any, data: any, e: any) => {
|
||||
const exportToXLSX = async (reportMeta: any, e: any) => {
|
||||
const meta = formatMetaData(reportMeta)
|
||||
|
||||
const workbook = new Workbook()
|
||||
@ -282,14 +290,11 @@ const exportToXLSX = (reportMeta: any, data: any, e: any) => {
|
||||
worksheet.mergeCells('H7:J7')
|
||||
worksheet.mergeCells('H8:J8')
|
||||
|
||||
exportToExcel({
|
||||
await exportToExcel({
|
||||
component: e.component,
|
||||
worksheet,
|
||||
autoFilterEnabled: true,
|
||||
topLeftCell: { row: 11, column: 1 },
|
||||
loadPanel: {
|
||||
enabled: false
|
||||
}
|
||||
topLeftCell: { row: 11, column: 1 }
|
||||
}).then(() => {
|
||||
workbook.xlsx.writeBuffer().then((buffer: any) => {
|
||||
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), `Laporan ${reportName}.xlsx`)
|
||||
@ -299,15 +304,16 @@ const exportToXLSX = (reportMeta: any, data: any, e: any) => {
|
||||
e.cancel = true
|
||||
}
|
||||
|
||||
const exportToDOCX = (reportMeta: any, data: any) => {
|
||||
const exportToDOCX = async (reportMeta: any, data: any) => {
|
||||
const day = new Date().toLocaleString('id-ID', { weekday: 'long' })
|
||||
const date = new Date().getDate()
|
||||
const month = new Date().toLocaleString('id-ID', { month: 'long' })
|
||||
const year = new Date().getFullYear()
|
||||
const meta = formatMetaData(reportMeta)
|
||||
const resultData = data.value.data
|
||||
|
||||
const generateRows = () => {
|
||||
return data.value.map((item: any, i: any) => {
|
||||
return resultData.map((item: any, i: any) => {
|
||||
return new TableRow({
|
||||
children: [
|
||||
{ text: `${++i}`, field: 'no' },
|
||||
@ -553,10 +559,17 @@ const exportToDOCX = (reportMeta: any, data: any) => {
|
||||
]
|
||||
})
|
||||
|
||||
Packer.toBlob(doc).then((blob) => {
|
||||
saveAs(blob, `Laporan ${reportName}.docx`)
|
||||
console.log('Document created successfully')
|
||||
})
|
||||
await Packer.toBlob(doc)
|
||||
.then((blob) => {
|
||||
saveAs(blob, `Laporan ${reportName}.docx`)
|
||||
|
||||
console.log('DOCX Exported')
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error while exporting DOCX', error)
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
export { exportToPDF, exportToXLSX, exportToDOCX }
|
||||
|
@ -2416,6 +2416,60 @@ export const queries = {
|
||||
}
|
||||
}
|
||||
`,
|
||||
ssdaftarGangguanResponseTime: gql`
|
||||
query ssdaftarGangguanResponseTime(
|
||||
$dateFrom: Date!
|
||||
$dateTo: Date!
|
||||
$posko: Int!
|
||||
$idUid: Int!
|
||||
$idUp3: Int!
|
||||
$minDurasiResponseTime: Int!
|
||||
$maxDurasiResponseTime: Int!
|
||||
$skip: Int
|
||||
$take: Int
|
||||
$requireTotalCount: Boolean
|
||||
$sort: [SortInput]
|
||||
$filter: [FilterInput]
|
||||
) {
|
||||
ssdaftarGangguanResponseTime(
|
||||
dateFrom: $dateFrom
|
||||
dateTo: $dateTo
|
||||
minDurasiResponseTime: $minDurasiResponseTime
|
||||
maxDurasiResponseTime: $maxDurasiResponseTime
|
||||
posko: $posko
|
||||
idUid: $idUid
|
||||
idUp3: $idUp3
|
||||
skip: $skip
|
||||
take: $take
|
||||
requireTotalCount: $requireTotalCount
|
||||
sort: $sort
|
||||
filter: $filter
|
||||
) {
|
||||
totalCount
|
||||
data {
|
||||
no_laporan
|
||||
pembuat_laporan
|
||||
waktu_lapor
|
||||
waktu_response
|
||||
waktu_recovery
|
||||
durasi_response_time
|
||||
durasi_recovery_time
|
||||
status_akhir
|
||||
is_marking
|
||||
referensi_marking
|
||||
idpel_nometer
|
||||
nama_pelapor
|
||||
alamat_pelapor
|
||||
no_telp_pelapor
|
||||
keterangan_pelapor
|
||||
media
|
||||
nama_posko
|
||||
penyebab
|
||||
tindakan
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
recoveryTime: gql`
|
||||
query daftarGangguanRecoveryTime(
|
||||
$dateFrom: Date!
|
||||
|
Loading…
x
Reference in New Issue
Block a user