feat: create export pdf in rekapitulasi gangguan alih posko

This commit is contained in:
kur0nek-o
2024-03-25 15:08:26 +07:00
parent fe0343f0ed
commit 72a2217c5a
2 changed files with 261 additions and 9 deletions

View File

@ -3,6 +3,7 @@
@reset-form="data = []"
:report-button="true"
@run-search="() => filterData(filters)"
@run-report="() => exportToPDF(reportMeta, data, true)"
class="mb-4"
>
<Type1 @update:filters="(value) => (filters = value)" />
@ -515,6 +516,7 @@ import { formatWaktu } from '@/components/Form/FiltersType/reference'
import DetailDialog from '@/components/Dialogs/DetailDialog.vue'
import { apolloClient } from '@/utils/api/api.graphql'
import { provideApolloClient } from '@vue/apollo-composable'
import { exportToPDF } from '@/report/Gangguan/Rekap/RGangguan_AlihPosko'
const client = apolloClient()
provideApolloClient(client)
@ -529,6 +531,12 @@ const dataSubSelected = ref<any>()
const dialogDetail = ref(false)
const loadingData = ref(false)
const loadingSubData = ref(false)
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: ''
})
const getDetail = () => {
loadingSubData.value = true
@ -586,15 +594,7 @@ const closeDialog = () => {
const onExporting = (e: any) => {
if (e.format === 'pdf') {
const doc = new jsPDF()
exportToPdf({
jsPDFDocument: doc,
component: e.component,
indent: 5
}).then(() => {
doc.save(`.pdf`)
})
exportToPDF(reportMeta.value, data.value)
} else {
const workbook = new Workbook()
const worksheet = workbook.addWorksheet('Employees')
@ -658,6 +658,8 @@ const filterData = (params: any) => {
}
})
}
reportMeta.value = filters.value
})
onError((error) => {