fix: loading in daftar gangguan dialihkan ke posko lain

This commit is contained in:
kur0nek-o 2024-04-01 10:38:08 +07:00
parent 0b1df3f0e6
commit da2df8a6c0
4 changed files with 70 additions and 35 deletions

View File

@ -0,0 +1,27 @@
<template>
<div
class="bg-black text-white flex justify-center items-center absolute top-0 bottom-0 right-0 left-0 z-50 opacity-50"
>
<svg
class="animate-spin h-10 w-10 text-white"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
>
<circle
class="opacity-25"
cx="12"
cy="12"
r="10"
stroke="currentColor"
stroke-width="4"
></circle>
<path
class="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
</svg>
<span class="ml-3 font-bold text-xl">Loading...</span>
</div>
</template>

View File

@ -33,7 +33,7 @@
/>
<DxSelection mode="single" />
<!-- <DxScrolling column-rendering-mode="virtual" mode="virtual" row-rendering-mode="virtual" /> -->
<DxLoadPanel
<!-- <DxLoadPanel
shading-color="rgba(0,0,0,0.4)"
:position="position"
:show-indicator="showIndicator"
@ -42,7 +42,7 @@
v-if="loading"
v-model:visible="loading"
:enabled="true"
/>
/> -->
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
<DxExport
:enabled="true"
@ -340,6 +340,8 @@
</div>
</div>
</DetailDialog>
<BufferDialog v-if="loading" />
</template>
<script setup lang="ts">
@ -359,9 +361,9 @@ 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 { useQuery } from '@vue/apollo-composable'
import { queries, requestGraphQl } from '@/utils/api/api.graphql'
import { exportToPDF, exportToXLSX, exportToDOCX } from '@/report/Gangguan/Daftar/DGangguan_DKPL'
import BufferDialog from '@/components/Dialogs/BufferDialog.vue'
const position = { of: '#dataTable' }
const showIndicator = ref(true)
@ -373,6 +375,10 @@ const dialogDetail = ref(false)
const loading = ref(false)
const closeDialog = () => (dialogDetail.value = false)
const bufferTest = () => {
console.log('Buffer Test')
}
const resetData = () => {
data.value = []
}
@ -556,7 +562,7 @@ const onExporting = (e: any) => {
if (e.format === 'pdf') {
exportToPDF(reportMeta, data)
} else if (e.format === 'xlsx') {
exportToXLSX(reportMeta, data, e)
exportToXLSX(reportMeta, e)
} else {
exportToDOCX(reportMeta, data)
}

View File

@ -1,6 +1,6 @@
<template>
<main
class="flex flex-col justify-between flex-1 px-4 overflow-y-auto bg-white lg:mr-3 sm:px-3 lg:px-6 rounded-t-2xl lg:rounded-t-3xl no-scroll-bar"
class="flex flex-col justify-between flex-1 px-4 overflow-y-auto bg-white lg:mr-3 sm:px-3 lg:px-6 rounded-t-2xl lg:rounded-t-3xl no-scroll-bar relative"
>
<div v-if="route.path !== '/home'" class="mt-4 lg:mt-6 max-w-7xl">
<h1 class="text-lg font-semibold md:text-xl text-dark">{{ pageTitle }}</h1>
@ -12,8 +12,8 @@
</template>
<script setup lang="ts">
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { computed } from 'vue'
import { useRoute } from 'vue-router'
// Dapatkan objek route dari vue-router
const route = useRoute()

View File

@ -20,6 +20,8 @@ import { formatWaktu } from '@/components/Form/FiltersType/reference'
import { setHeaderStyle } from '@/report/utils/xlsx'
const reportName = 'Daftar Gangguan Dialihkan Ke Posko Lain'
const fontSize = 5
const docxFontSize = 6
const formatMetaData = (reportMeta: any) => {
const periode = reportMeta.value.periode ? reportMeta.value.periode.split(' s/d ') : ''
@ -78,7 +80,7 @@ const exportToPDF = (reportMeta: any, data: any) => {
]
],
styles: {
fontSize: 3,
fontSize,
cellPadding: 0.1,
textColor: [0, 0, 0],
fontStyle: 'bold'
@ -93,7 +95,7 @@ const exportToPDF = (reportMeta: any, data: any) => {
[`PERIODE TANGGAL : ${meta.dateFromFormat} SD TGL ${meta.dateToFormat}`]
],
styles: {
fontSize: 3,
fontSize,
cellPadding: 0.1,
textColor: [0, 0, 0],
fontStyle: 'bold',
@ -149,7 +151,7 @@ const exportToPDF = (reportMeta: any, data: any) => {
item.posko
]),
styles: {
fontSize: 3,
fontSize,
cellPadding: 1,
lineColor: [0, 0, 0],
lineWidth: 0.1,
@ -187,7 +189,7 @@ const exportToPDF = (reportMeta: any, data: any) => {
]
],
styles: {
fontSize: 3,
fontSize,
cellPadding: 0.1,
textColor: [0, 0, 0],
fontStyle: 'bold',
@ -203,7 +205,7 @@ const exportToPDF = (reportMeta: any, data: any) => {
})
}
const exportToXLSX = (reportMeta: any, data: any, e: any) => {
const exportToXLSX = (reportMeta: any, e: any) => {
const meta = formatMetaData(reportMeta)
const workbook = new Workbook()
const worksheet = workbook.addWorksheet(`${reportName}`)
@ -240,21 +242,21 @@ const exportToXLSX = (reportMeta: any, data: any, e: any) => {
}`
)
setHeaderStyle(worksheet, 7, 8, `${reportName}`.toUpperCase(), true)
setHeaderStyle(worksheet, 6, 1, `${reportName}`.toUpperCase(), true)
setHeaderStyle(
worksheet,
8,
8,
7,
1,
`PERIODE TANGGAL : ${meta.dateFromFormat} SD TGL ${meta.dateToFormat}`,
true
)
worksheet.mergeCells('A1:F1')
worksheet.mergeCells('A2:F2')
worksheet.mergeCells('A3:F3')
worksheet.mergeCells('A4:F4')
worksheet.mergeCells('H7:I7')
worksheet.mergeCells('H8:I8')
worksheet.mergeCells('A1:S1')
worksheet.mergeCells('A2:S2')
worksheet.mergeCells('A3:S3')
worksheet.mergeCells('A4:S4')
worksheet.mergeCells('A6:S6')
worksheet.mergeCells('A7:S7')
exportToExcel({
component: e.component,
@ -314,7 +316,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
children: [
new TextRun({
text: cell.text,
size: 5
size: docxFontSize
})
]
})
@ -343,7 +345,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
new TextRun({
text: 'PT. PLN(Persero)',
bold: true,
size: 5
size: docxFontSize
})
]
}),
@ -356,7 +358,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
: 'Semua Unit Induk Distribusi/Wilayah'.toUpperCase()
}`,
bold: true,
size: 5
size: docxFontSize
})
]
}),
@ -369,7 +371,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
: 'Semua Unit Pelaksanaan Pelayanan Pelanggan'.toUpperCase()
}`,
bold: true,
size: 5
size: docxFontSize
})
]
}),
@ -382,7 +384,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
: 'Semua Posko'.toUpperCase()
}`,
bold: true,
size: 5
size: docxFontSize
})
]
}),
@ -391,7 +393,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
new TextRun({
text: '',
bold: true,
size: 5
size: docxFontSize
})
]
}),
@ -401,7 +403,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
new TextRun({
text: `${reportName}`.toUpperCase(),
bold: true,
size: 5
size: docxFontSize
})
]
}),
@ -411,7 +413,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
new TextRun({
text: `PERIODE TANGGAL : ${meta.dateFromFormat} SD TGL ${meta.dateToFormat}`,
bold: true,
size: 5
size: docxFontSize
})
]
}),
@ -420,7 +422,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
new TextRun({
text: '',
bold: true,
size: 5
size: docxFontSize
})
]
}),
@ -461,7 +463,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
new TextRun({
text: header.text,
bold: true,
size: 5,
size: docxFontSize,
allCaps: true
})
]
@ -479,7 +481,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
new TextRun({
text: '',
bold: true,
size: 5
size: docxFontSize
})
]
}),
@ -489,7 +491,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
new TextRun({
text: `${meta.dayTo}, ${meta.dateToFormat}`,
bold: true,
size: 5
size: docxFontSize
})
]
}),
@ -498,7 +500,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
new TextRun({
text: '',
bold: true,
size: 5
size: docxFontSize
})
]
}),
@ -508,7 +510,7 @@ const exportToDOCX = (reportMeta: any, data: any) => {
new TextRun({
text: '(.........................................)',
bold: true,
size: 5
size: docxFontSize
})
]
})