Merge branch 'dev-bagus' of https://github.com/defuj/eis into dev-defuj
This commit is contained in:
commit
498904e51f
@ -375,6 +375,27 @@ const showDetail = ref(false)
|
|||||||
const closeDetail = () => (showDetail.value = false)
|
const closeDetail = () => (showDetail.value = false)
|
||||||
|
|
||||||
const onExporting = (e: any) => {
|
const onExporting = (e: any) => {
|
||||||
|
const periode = reportMeta.value.periode ? reportMeta.value.periode.split(' s/d ') : ''
|
||||||
|
|
||||||
|
let dateFromFormat = ''
|
||||||
|
let dateToFormat = ''
|
||||||
|
let dayTo = ''
|
||||||
|
|
||||||
|
if (periode != '') {
|
||||||
|
const dateFrom = new Date(periode[0].split('-').reverse().join('-'))
|
||||||
|
const dateTo = new Date(periode[1].split('-').reverse().join('-'))
|
||||||
|
|
||||||
|
dateFromFormat = `${dateFrom.getDate()}-${dateFrom.toLocaleString('default', {
|
||||||
|
month: 'long'
|
||||||
|
})}-${dateFrom.getFullYear()}`
|
||||||
|
|
||||||
|
dateToFormat = `${dateTo.getDate()}-${dateTo.toLocaleString('default', {
|
||||||
|
month: 'long'
|
||||||
|
})}-${dateTo.getFullYear()}`
|
||||||
|
|
||||||
|
dayTo = dateTo.toLocaleString('default', { weekday: 'long' })
|
||||||
|
}
|
||||||
|
|
||||||
if (e.format === 'pdf') {
|
if (e.format === 'pdf') {
|
||||||
const doc = new jsPDF({
|
const doc = new jsPDF({
|
||||||
orientation: 'landscape'
|
orientation: 'landscape'
|
||||||
@ -382,7 +403,59 @@ const onExporting = (e: any) => {
|
|||||||
|
|
||||||
autoTable(doc, {
|
autoTable(doc, {
|
||||||
head: [
|
head: [
|
||||||
|
['PT. PLN(Persero)', '', ''],
|
||||||
[
|
[
|
||||||
|
{ content: 'UNIT INDUK', styles: { cellWidth: 25 } },
|
||||||
|
{ content: ':', styles: { cellWidth: 1 } },
|
||||||
|
reportMeta.value.uid
|
||||||
|
? reportMeta.value.uid.name.toUpperCase()
|
||||||
|
: 'Semua Unit Induk Distribusi/Wilayah'.toUpperCase()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'UNIT PELAKSANA PELAYANAN PELANGGAN',
|
||||||
|
':',
|
||||||
|
reportMeta.value.up3
|
||||||
|
? reportMeta.value.up3.name.toUpperCase()
|
||||||
|
: 'Semua Unit Pelaksanaan Pelayanan Pelanggan'.toUpperCase()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'POSKO',
|
||||||
|
':',
|
||||||
|
reportMeta.value.posko
|
||||||
|
? reportMeta.value.posko.name.toUpperCase()
|
||||||
|
: 'Semua Posko'.toUpperCase()
|
||||||
|
]
|
||||||
|
],
|
||||||
|
styles: {
|
||||||
|
fontSize: 3,
|
||||||
|
cellPadding: 0.1,
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold'
|
||||||
|
},
|
||||||
|
theme: 'plain',
|
||||||
|
startY: 10
|
||||||
|
})
|
||||||
|
|
||||||
|
autoTable(doc, {
|
||||||
|
head: [
|
||||||
|
['DAFTAR GANGGUAN DIALIHKAN KE POSKO LAIN'],
|
||||||
|
[`PERIODE TANGGAL : ${dateFromFormat} SD TGL ${dateToFormat}`]
|
||||||
|
],
|
||||||
|
styles: {
|
||||||
|
fontSize: 3,
|
||||||
|
cellPadding: 0.1,
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold',
|
||||||
|
halign: 'center'
|
||||||
|
},
|
||||||
|
theme: 'plain',
|
||||||
|
startY: 18
|
||||||
|
})
|
||||||
|
|
||||||
|
autoTable(doc, {
|
||||||
|
head: [
|
||||||
|
[
|
||||||
|
'No',
|
||||||
'No Laporan',
|
'No Laporan',
|
||||||
'Pembuat Laporan',
|
'Pembuat Laporan',
|
||||||
'Tgl Lapor',
|
'Tgl Lapor',
|
||||||
@ -403,7 +476,8 @@ const onExporting = (e: any) => {
|
|||||||
'Posko'
|
'Posko'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
body: data.value.map((item) => [
|
body: data.value.map((item, i) => [
|
||||||
|
{ content: ++i, styles: { halign: 'right' } },
|
||||||
item.no_laporan,
|
item.no_laporan,
|
||||||
item.pembuat_laporan,
|
item.pembuat_laporan,
|
||||||
item.waktu_lapor,
|
item.waktu_lapor,
|
||||||
@ -424,74 +498,60 @@ const onExporting = (e: any) => {
|
|||||||
item.posko
|
item.posko
|
||||||
]),
|
]),
|
||||||
styles: {
|
styles: {
|
||||||
fontSize: 3
|
fontSize: 3,
|
||||||
}
|
cellPadding: 1,
|
||||||
|
lineColor: [0, 0, 0],
|
||||||
|
lineWidth: 0.1,
|
||||||
|
cellWidth: 'auto'
|
||||||
|
},
|
||||||
|
rowPageBreak: 'auto',
|
||||||
|
headStyles: {
|
||||||
|
fillColor: [192, 192, 192],
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold',
|
||||||
|
cellWidth: 'wrap',
|
||||||
|
halign: 'center'
|
||||||
|
},
|
||||||
|
bodyStyles: {
|
||||||
|
textColor: [0, 0, 0]
|
||||||
|
},
|
||||||
|
didParseCell: function (data) {
|
||||||
|
if (data.row.section === 'head') {
|
||||||
|
data.cell.text = data.cell.text.map(function (word: any) {
|
||||||
|
return word.toUpperCase()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
startY: 23
|
||||||
})
|
})
|
||||||
|
|
||||||
doc.save('Daftar Gangguan Dialihkan Ke Posko Lain.pdf')
|
autoTable(doc, {
|
||||||
|
head: [
|
||||||
|
[`${dayTo}, ${dateToFormat}`],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
content: '(.........................................)',
|
||||||
|
styles: { minCellHeight: 8, valign: 'bottom' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
styles: {
|
||||||
|
fontSize: 3,
|
||||||
|
cellPadding: 0.1,
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold',
|
||||||
|
halign: 'center'
|
||||||
|
},
|
||||||
|
theme: 'plain',
|
||||||
|
tableWidth: 50,
|
||||||
|
margin: { left: 230 }
|
||||||
|
})
|
||||||
|
|
||||||
// const doc = new jsPDF({
|
doc
|
||||||
// orientation: 'landscape',
|
.save('Laporan Daftar Gangguan Dialihkan Ke Posko Lain.pdf', { returnPromise: true })
|
||||||
// unit: 'mm',
|
.then(() => {
|
||||||
// format: 'F4'
|
console.log('pdf berhasil disimpan')
|
||||||
// })
|
})
|
||||||
// // Initialize page number
|
|
||||||
// const pageNumber = ref(1)
|
|
||||||
// autoTable(doc, {
|
|
||||||
// head: [
|
|
||||||
// [
|
|
||||||
// 'No Laporan',
|
|
||||||
// 'Pembuat Laporan',
|
|
||||||
// 'Tgl Lapor',
|
|
||||||
// 'Tgl Dialihkan',
|
|
||||||
// 'Tgl Response',
|
|
||||||
// 'Tgl Recovery',
|
|
||||||
// 'Durasi Response Time',
|
|
||||||
// 'Durasi Recovery Time',
|
|
||||||
// 'Posko Awal',
|
|
||||||
// 'Posko Tujuan',
|
|
||||||
// 'Status',
|
|
||||||
// 'IDPEL/NO METER',
|
|
||||||
// 'Nama Pelapor',
|
|
||||||
// 'Alamat Pelapor',
|
|
||||||
// 'No Telp Pelapor',
|
|
||||||
// 'Keterangan Pelapor',
|
|
||||||
// 'Sumber Lapor',
|
|
||||||
// 'Posko'
|
|
||||||
// ]
|
|
||||||
// ],
|
|
||||||
// startY: 10,
|
|
||||||
// body: data.value.map((item) => [
|
|
||||||
// item.no_laporan,
|
|
||||||
// item.pembuat_laporan,
|
|
||||||
// item.waktu_lapor,
|
|
||||||
// item.waktu_dialihkan,
|
|
||||||
// item.waktu_response,
|
|
||||||
// item.waktu_recovery,
|
|
||||||
// item.durasi_response_time,
|
|
||||||
// item.durasi_recovery_time,
|
|
||||||
// item.nama_posko_lama,
|
|
||||||
// item.nama_posko_baru,
|
|
||||||
// item.status_akhir,
|
|
||||||
// item.idpel_nometer,
|
|
||||||
// item.nama_pelapor,
|
|
||||||
// item.alamat_pelapor,
|
|
||||||
// item.no_telp_pelapor,
|
|
||||||
// item.keterangan_pelapor,
|
|
||||||
// item.media,
|
|
||||||
// item.posko
|
|
||||||
// ]),
|
|
||||||
// styles: {
|
|
||||||
// fontSize: 6,
|
|
||||||
// cellWidth: 'wrap'
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// doc.setProperties({
|
|
||||||
// title: 'Daftar Gangguan Dialihkan Ke Posko Lain',
|
|
||||||
// subject: 'Daftar Gangguan Dialihkan Ke Posko Lain'
|
|
||||||
// })
|
|
||||||
// pageNumber.value++ // Increment the pageNumber
|
|
||||||
// doc.save(`Daftar Gangguan Dialihkan Ke Posko Lain.pdf`)
|
|
||||||
} else {
|
} else {
|
||||||
const workbook = new Workbook()
|
const workbook = new Workbook()
|
||||||
const worksheet = workbook.addWorksheet('Daftar Gangguan Dialihkan Ke Posko Lain')
|
const worksheet = workbook.addWorksheet('Daftar Gangguan Dialihkan Ke Posko Lain')
|
||||||
@ -516,6 +576,7 @@ const onExporting = (e: any) => {
|
|||||||
const filterData = (params: any) => {
|
const filterData = (params: any) => {
|
||||||
const { posko, uid, up3 } = params
|
const { posko, uid, up3 } = params
|
||||||
const dateValue = params.periode.split(' s/d ')
|
const dateValue = params.periode.split(' s/d ')
|
||||||
|
|
||||||
refetch({
|
refetch({
|
||||||
dateFrom: dateValue[0]
|
dateFrom: dateValue[0]
|
||||||
? dateValue[0].split('-').reverse().join('-')
|
? dateValue[0].split('-').reverse().join('-')
|
||||||
@ -531,6 +592,8 @@ const filterData = (params: any) => {
|
|||||||
if (queryResult.data != undefined) {
|
if (queryResult.data != undefined) {
|
||||||
data.value = queryResult.data.daftarGangguanDialihkanKePoskoLain
|
data.value = queryResult.data.daftarGangguanDialihkanKePoskoLain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reportMeta.value = filters.value
|
||||||
console.log(queryResult.data)
|
console.log(queryResult.data)
|
||||||
console.log(queryResult.loading)
|
console.log(queryResult.loading)
|
||||||
console.log(queryResult.networkStatus)
|
console.log(queryResult.networkStatus)
|
||||||
@ -554,7 +617,15 @@ const onSelectionChanged = ({ selectedRowsData }: any) => {
|
|||||||
dataDetail.value = data
|
dataDetail.value = data
|
||||||
}
|
}
|
||||||
const showData = () => (showDetail.value = true)
|
const showData = () => (showDetail.value = true)
|
||||||
|
|
||||||
const filters = ref()
|
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: ''
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (import.meta.env.DEV) {
|
if (import.meta.env.DEV) {
|
||||||
data.value = dummyData.gangguan.daftar.dialihkanKePoskoLain
|
data.value = dummyData.gangguan.daftar.dialihkanKePoskoLain
|
||||||
|
@ -337,6 +337,14 @@ const data = ref<any[]>([])
|
|||||||
const dataDetail = ref<any>({})
|
const dataDetail = ref<any>({})
|
||||||
const showDetail = ref(false)
|
const showDetail = ref(false)
|
||||||
const filters = ref()
|
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: '',
|
||||||
|
minJmlLapor: 1,
|
||||||
|
maxJmlLapor: 1
|
||||||
|
})
|
||||||
|
|
||||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||||
const data = selectedRowsData[0]
|
const data = selectedRowsData[0]
|
||||||
@ -380,6 +388,8 @@ const filterData = (params: any) => {
|
|||||||
if (queryResult.data != undefined) {
|
if (queryResult.data != undefined) {
|
||||||
data.value = queryResult.data.daftarGangguanMelaporLebihDariSatuKali
|
data.value = queryResult.data.daftarGangguanMelaporLebihDariSatuKali
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reportMeta.value = filters.value
|
||||||
console.log(queryResult.data)
|
console.log(queryResult.data)
|
||||||
console.log(queryResult.loading)
|
console.log(queryResult.loading)
|
||||||
console.log(queryResult.networkStatus)
|
console.log(queryResult.networkStatus)
|
||||||
@ -390,6 +400,27 @@ const filterData = (params: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onExporting = (e: any) => {
|
const onExporting = (e: any) => {
|
||||||
|
const periode = reportMeta.value.periode ? reportMeta.value.periode.split(' s/d ') : ''
|
||||||
|
|
||||||
|
let dateFromFormat = ''
|
||||||
|
let dateToFormat = ''
|
||||||
|
let dayTo = ''
|
||||||
|
|
||||||
|
if (periode != '') {
|
||||||
|
const dateFrom = new Date(periode[0].split('-').reverse().join('-'))
|
||||||
|
const dateTo = new Date(periode[1].split('-').reverse().join('-'))
|
||||||
|
|
||||||
|
dateFromFormat = `${dateFrom.getDate()}-${dateFrom.toLocaleString('default', {
|
||||||
|
month: 'long'
|
||||||
|
})}-${dateFrom.getFullYear()}`
|
||||||
|
|
||||||
|
dateToFormat = `${dateTo.getDate()}-${dateTo.toLocaleString('default', {
|
||||||
|
month: 'long'
|
||||||
|
})}-${dateTo.getFullYear()}`
|
||||||
|
|
||||||
|
dayTo = dateTo.toLocaleString('default', { weekday: 'long' })
|
||||||
|
}
|
||||||
|
|
||||||
if (e.format === 'pdf') {
|
if (e.format === 'pdf') {
|
||||||
const doc = new jsPDF({
|
const doc = new jsPDF({
|
||||||
orientation: 'landscape'
|
orientation: 'landscape'
|
||||||
@ -397,7 +428,60 @@ const onExporting = (e: any) => {
|
|||||||
|
|
||||||
autoTable(doc, {
|
autoTable(doc, {
|
||||||
head: [
|
head: [
|
||||||
|
['PT. PLN(Persero)', '', ''],
|
||||||
[
|
[
|
||||||
|
{ content: 'UNIT INDUK', styles: { cellWidth: 25 } },
|
||||||
|
{ content: ':', styles: { cellWidth: 1 } },
|
||||||
|
reportMeta.value.uid
|
||||||
|
? reportMeta.value.uid.name.toUpperCase()
|
||||||
|
: 'Semua Unit Induk Distribusi/Wilayah'.toUpperCase()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'UNIT PELAKSANA PELAYANAN PELANGGAN',
|
||||||
|
':',
|
||||||
|
reportMeta.value.up3
|
||||||
|
? reportMeta.value.up3.name.toUpperCase()
|
||||||
|
: 'Semua Unit Pelaksanaan Pelayanan Pelanggan'.toUpperCase()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'POSKO',
|
||||||
|
':',
|
||||||
|
reportMeta.value.posko
|
||||||
|
? reportMeta.value.posko.name.toUpperCase()
|
||||||
|
: 'Semua Posko'.toUpperCase()
|
||||||
|
],
|
||||||
|
['LAPOR ULANG', ':', `${reportMeta.value.minJmlLapor} s/d ${reportMeta.value.maxJmlLapor}`]
|
||||||
|
],
|
||||||
|
styles: {
|
||||||
|
fontSize: 3,
|
||||||
|
cellPadding: 0.1,
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold'
|
||||||
|
},
|
||||||
|
theme: 'plain',
|
||||||
|
startY: 10
|
||||||
|
})
|
||||||
|
|
||||||
|
autoTable(doc, {
|
||||||
|
head: [
|
||||||
|
['Daftar Gangguan Melapor Lebih Dari 1 Kali'.toUpperCase()],
|
||||||
|
[`PERIODE TANGGAL : ${dateFromFormat} SD TGL ${dateToFormat}`]
|
||||||
|
],
|
||||||
|
styles: {
|
||||||
|
fontSize: 3,
|
||||||
|
cellPadding: 0.1,
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold',
|
||||||
|
halign: 'center'
|
||||||
|
},
|
||||||
|
theme: 'plain',
|
||||||
|
startY: 18
|
||||||
|
})
|
||||||
|
|
||||||
|
autoTable(doc, {
|
||||||
|
head: [
|
||||||
|
[
|
||||||
|
'No',
|
||||||
'No Laporan',
|
'No Laporan',
|
||||||
'Tgl Lapor',
|
'Tgl Lapor',
|
||||||
'Tgl Response',
|
'Tgl Response',
|
||||||
@ -415,7 +499,8 @@ const onExporting = (e: any) => {
|
|||||||
'Posko'
|
'Posko'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
body: data.value.map((item) => [
|
body: data.value.map((item, i) => [
|
||||||
|
{ content: ++i, styles: { halign: 'right' } },
|
||||||
item.no_laporan,
|
item.no_laporan,
|
||||||
item.waktu_lapor,
|
item.waktu_lapor,
|
||||||
item.waktu_response,
|
item.waktu_response,
|
||||||
@ -433,11 +518,60 @@ const onExporting = (e: any) => {
|
|||||||
item.nama_posko
|
item.nama_posko
|
||||||
]),
|
]),
|
||||||
styles: {
|
styles: {
|
||||||
fontSize: 4
|
fontSize: 3,
|
||||||
}
|
cellPadding: 1,
|
||||||
|
lineColor: [0, 0, 0],
|
||||||
|
lineWidth: 0.1,
|
||||||
|
cellWidth: 'auto'
|
||||||
|
},
|
||||||
|
rowPageBreak: 'auto',
|
||||||
|
headStyles: {
|
||||||
|
fillColor: [192, 192, 192],
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold',
|
||||||
|
cellWidth: 'wrap',
|
||||||
|
halign: 'center'
|
||||||
|
},
|
||||||
|
bodyStyles: {
|
||||||
|
textColor: [0, 0, 0]
|
||||||
|
},
|
||||||
|
didParseCell: function (data) {
|
||||||
|
if (data.row.section === 'head') {
|
||||||
|
data.cell.text = data.cell.text.map(function (word: any) {
|
||||||
|
return word.toUpperCase()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
startY: 23
|
||||||
})
|
})
|
||||||
|
|
||||||
doc.save('Daftar Gangguan Melapor Lebih Dari 1 Kali.pdf')
|
autoTable(doc, {
|
||||||
|
head: [
|
||||||
|
[`${dayTo}, ${dateToFormat}`],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
content: '(.........................................)',
|
||||||
|
styles: { minCellHeight: 8, valign: 'bottom' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
styles: {
|
||||||
|
fontSize: 3,
|
||||||
|
cellPadding: 0.1,
|
||||||
|
textColor: [0, 0, 0],
|
||||||
|
fontStyle: 'bold',
|
||||||
|
halign: 'center'
|
||||||
|
},
|
||||||
|
theme: 'plain',
|
||||||
|
tableWidth: 50,
|
||||||
|
margin: { left: 230 }
|
||||||
|
})
|
||||||
|
|
||||||
|
doc
|
||||||
|
.save('Laporan Daftar Gangguan Melapor Lebih Dari 1 Kali.pdf', { returnPromise: true })
|
||||||
|
.then(() => {
|
||||||
|
console.log('pdf berhasil disimpan')
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
const workbook = new Workbook()
|
const workbook = new Workbook()
|
||||||
const worksheet = workbook.addWorksheet('Daftar Gangguan Melapor Lebih Dari 1 Kali')
|
const worksheet = workbook.addWorksheet('Daftar Gangguan Melapor Lebih Dari 1 Kali')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user