feat: create pdf, xlsx in material
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
<Filters @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Type14 @update:filters="(value) => (filters = value)" />
|
||||
</Filters>
|
||||
|
||||
<div id="data">
|
||||
<DxDataGrid
|
||||
ref="dataGridRef"
|
||||
@ -232,13 +233,13 @@ import {
|
||||
} from 'devextreme-vue/data-grid'
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import { Type14 } from '@/components/Form/FiltersType'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import gql from 'graphql-tag'
|
||||
import { queries, requestGraphQl } from '@/utils/api/api.graphql'
|
||||
import BufferDialog from '@/components/Dialogs/BufferDialog.vue'
|
||||
import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers'
|
||||
import DetailDialog from '@/components/Dialogs/DetailDialog.vue'
|
||||
import InputText from '@/components/InputText.vue'
|
||||
import { exportToPDF, exportToXLSX } from '@/report/Material/Daftar/Material_DGMYG'
|
||||
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
@ -249,6 +250,21 @@ const dataSelected = ref<any>()
|
||||
const dataSubSelected = ref<any>()
|
||||
const dialogDetail = ref(false)
|
||||
const loadingData = ref(false)
|
||||
const reportMeta = ref({
|
||||
uid: {
|
||||
id: 0,
|
||||
name: 'Semua Distribusi/Wilayah'
|
||||
},
|
||||
up3: {
|
||||
id: 0,
|
||||
name: 'Semua Area'
|
||||
},
|
||||
posko: {
|
||||
id: 0,
|
||||
name: 'Semua Unit Layanan Pelanggan'
|
||||
},
|
||||
periode: ''
|
||||
})
|
||||
|
||||
const resetData = () => {
|
||||
data.value = []
|
||||
@ -279,6 +295,8 @@ const filterData = async (params: any) => {
|
||||
} else {
|
||||
data.value = []
|
||||
}
|
||||
|
||||
reportMeta.value = filters.value
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
@ -310,7 +328,14 @@ const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const onExporting = (e: any) => {}
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
exportToPDF(reportMeta, data)
|
||||
} else if (e.format === 'xlsx') {
|
||||
exportToXLSX(reportMeta, e)
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
</script>
|
||||
|
@ -180,6 +180,8 @@ import BufferDialog from '@/components/Dialogs/BufferDialog.vue'
|
||||
import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers'
|
||||
import DetailDialog from '@/components/Dialogs/DetailDialog.vue'
|
||||
import InputText from '@/components/InputText.vue'
|
||||
import { exportToPDF, exportToXLSX } from '@/report/Material/Rekapitulasi/Material_RPM'
|
||||
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
@ -190,6 +192,21 @@ const dataSelected = ref<any>()
|
||||
const dataSubSelected = ref<any>()
|
||||
const dialogDetail = ref(false)
|
||||
const loadingData = ref(false)
|
||||
const reportMeta = ref({
|
||||
uid: {
|
||||
id: 0,
|
||||
name: 'Semua Distribusi/Wilayah'
|
||||
},
|
||||
up3: {
|
||||
id: 0,
|
||||
name: 'Semua Area'
|
||||
},
|
||||
posko: {
|
||||
id: 0,
|
||||
name: 'Semua Unit Layanan Pelanggan'
|
||||
},
|
||||
periode: ''
|
||||
})
|
||||
|
||||
const resetData = () => {
|
||||
data.value = []
|
||||
@ -219,6 +236,8 @@ const filterData = async (params: any) => {
|
||||
} else {
|
||||
data.value = []
|
||||
}
|
||||
|
||||
reportMeta.value = filters.value
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
@ -250,7 +269,14 @@ const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const onExporting = (e: any) => {}
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
exportToPDF(reportMeta, data)
|
||||
} else if (e.format === 'xlsx') {
|
||||
exportToXLSX(reportMeta, e)
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user