fix: export pdf in daftar gangguan dialihkan ke posko lain

This commit is contained in:
kur0nek-o
2024-04-01 12:26:52 +07:00
parent 0d5e1451a0
commit fd08049392
2 changed files with 8 additions and 10 deletions

View File

@ -8,7 +8,6 @@
ref="dataGridRef" ref="dataGridRef"
:allow-column-reordering="true" :allow-column-reordering="true"
class="max-h-[calc(100vh-140px)] mb-10" class="max-h-[calc(100vh-140px)] mb-10"
:remote-operations="true"
:data-source="data" :data-source="data"
key-expr="no_laporan" key-expr="no_laporan"
:show-column-lines="true" :show-column-lines="true"
@ -375,10 +374,6 @@ const dialogDetail = ref(false)
const loading = ref(false) const loading = ref(false)
const closeDialog = () => (dialogDetail.value = false) const closeDialog = () => (dialogDetail.value = false)
const bufferTest = () => {
console.log('Buffer Test')
}
const resetData = () => { const resetData = () => {
data.value = [] data.value = []
} }

View File

@ -20,7 +20,7 @@ import { formatWaktu } from '@/components/Form/FiltersType/reference'
import { setHeaderStyle } from '@/report/utils/xlsx' import { setHeaderStyle } from '@/report/utils/xlsx'
const reportName = 'Daftar Gangguan Dialihkan Ke Posko Lain' const reportName = 'Daftar Gangguan Dialihkan Ke Posko Lain'
const fontSize = 5 const fontSize = 4
const docxFontSize = 6 const docxFontSize = 6
const formatMetaData = (reportMeta: any) => { const formatMetaData = (reportMeta: any) => {
@ -58,7 +58,7 @@ const exportToPDF = (reportMeta: any, data: any) => {
head: [ head: [
['PT. PLN(Persero)', '', ''], ['PT. PLN(Persero)', '', ''],
[ [
{ content: 'UNIT INDUK', styles: { cellWidth: 25 } }, { content: 'UNIT INDUK', styles: { cellWidth: 35 } },
{ content: ':', styles: { cellWidth: 1 } }, { content: ':', styles: { cellWidth: 1 } },
reportMeta.value.uid reportMeta.value.uid
? reportMeta.value.uid.name.toUpperCase() ? reportMeta.value.uid.name.toUpperCase()
@ -102,7 +102,7 @@ const exportToPDF = (reportMeta: any, data: any) => {
halign: 'center' halign: 'center'
}, },
theme: 'plain', theme: 'plain',
startY: 18 startY: 25
}) })
autoTable(doc, { autoTable(doc, {
@ -175,7 +175,7 @@ const exportToPDF = (reportMeta: any, data: any) => {
}) })
} }
}, },
startY: 23 startY: 35
}) })
autoTable(doc, { autoTable(doc, {
@ -262,7 +262,10 @@ const exportToXLSX = (reportMeta: any, e: any) => {
component: e.component, component: e.component,
worksheet, worksheet,
autoFilterEnabled: true, autoFilterEnabled: true,
topLeftCell: { row: 10, column: 1 } topLeftCell: { row: 10, column: 1 },
loadPanel: {
enabled: false
}
}).then(() => { }).then(() => {
workbook.xlsx.writeBuffer().then((buffer: any) => { workbook.xlsx.writeBuffer().then((buffer: any) => {
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), `Laporan ${reportName}.xlsx`) saveAs(new Blob([buffer], { type: 'application/octet-stream' }), `Laporan ${reportName}.xlsx`)