Refactor form component and add new Monalisa pages
This commit is contained in:
@ -0,0 +1,204 @@
|
||||
<template>
|
||||
<Filters @reset-form="data = []" :report-button="true" @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Type2 @update:filters="(value) => (filters = value)" />
|
||||
</Filters>
|
||||
|
||||
<div id="data">
|
||||
<DxDataGrid class="max-h-[calc(100vh-140px)] mb-10" :data-source="data" :show-column-lines="true"
|
||||
:show-row-lines="false" :show-borders="true" :row-alternation-enabled="true" :hover-state-enabled="true"
|
||||
@selection-changed="onSelectionChanged" @exporting="onExporting" :allow-column-resizing="true"
|
||||
column-resizing-mode="widget" :word-wrap-enabled="true">
|
||||
<DxSelection mode="single" />
|
||||
<DxPaging :enabled="false" />
|
||||
<DxScrolling column-rendering-mode="virtual" mode="virtual" />
|
||||
<DxLoadPanel :position="position" :show-indicator="showIndicator" :show-pane="showPane" :shading="shading"
|
||||
v-if="loading" v-model:visible="loading" :enabled="true" />
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
<DxExport :enabled="true" :formats="['pdf', 'xlsx', 'document']" :allow-export-selected-data="false" />
|
||||
<DxColumnFixing :enabled="true" />
|
||||
|
||||
<DxColumn alignment="center" :min-width="170" data-type="text" data-field="nama_ulp" caption="Nama Unit"
|
||||
css-class="custom-table-column" :group-index="0" />
|
||||
<DxColumn alignment="center" :min-width="170" data-type="text" data-field="nama_ulp" caption="Nama Unit"
|
||||
css-class="custom-table-column" />
|
||||
<DxColumn alignment="center" caption="Jumlah Dispatching Time Gangguan" css-class="custom-table-column">
|
||||
<DxColumn alignment="center" caption="MoM" css-class="custom-table-column">
|
||||
<DxColumn :width="150" alignment="center" data-field="mom_bulan_kemarin" data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunLalu}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="mom_bulan_ini" data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunSekarang}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="persen_mom" data-type="number" caption="%"
|
||||
css-class="custom-table-column" />
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="YoY" css-class="custom-table-column">
|
||||
<DxColumn :width="150" alignment="center" data-field="yoy_tahun_kemarin" data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunLalu}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="yoy_tahun_ini" data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunSekarang}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="persen_yoy" data-type="number" caption="%"
|
||||
css-class="custom-table-column" />
|
||||
</DxColumn>
|
||||
</DxColumn>
|
||||
</DxDataGrid>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||
import { ref } from 'vue'
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
import {
|
||||
DxColumn,
|
||||
DxColumnFixing,
|
||||
DxExport,
|
||||
DxLoadPanel,
|
||||
DxPaging,
|
||||
DxScrolling,
|
||||
DxSearchPanel,
|
||||
DxSelection
|
||||
} from 'devextreme-vue/data-grid'
|
||||
import { jsPDF } from 'jspdf'
|
||||
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { Workbook } from 'exceljs'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import gql from 'graphql-tag'
|
||||
import { getMonthName } from '@/utils/texts'
|
||||
|
||||
const tahunSekarang = ref(new Date().getFullYear())
|
||||
const bulanSekarang = ref(new Date().getMonth())
|
||||
const tahunLalu = ref(tahunSekarang.value - 1)
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
const showPane = ref(true)
|
||||
const data = ref<any[]>([])
|
||||
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
const doc = new jsPDF()
|
||||
|
||||
exportToPdf({
|
||||
jsPDFDocument: doc,
|
||||
component: e.component,
|
||||
indent: 5
|
||||
}).then(() => {
|
||||
doc.save(`.pdf`)
|
||||
})
|
||||
} else {
|
||||
const workbook = new Workbook()
|
||||
const worksheet = workbook.addWorksheet('Employees')
|
||||
|
||||
exportToExcel({
|
||||
component: e.component,
|
||||
worksheet,
|
||||
autoFilterEnabled: true
|
||||
}).then(() => {
|
||||
workbook.xlsx.writeBuffer().then((buffer: any) => {
|
||||
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx')
|
||||
})
|
||||
})
|
||||
|
||||
e.cancel = true
|
||||
}
|
||||
}
|
||||
|
||||
// const monalisaDispatchingTimeGangguan = gql`
|
||||
// query DaftarmonalisaDispatchingTimeGangguan(
|
||||
// $regional: String
|
||||
// $posko: Int
|
||||
// $idUid: Int
|
||||
// $idUp3: Int
|
||||
// $bulan: Int
|
||||
// $tahun: Int
|
||||
// ) {
|
||||
// monalisaDispatchingTimeGangguan(
|
||||
// regional: $regional
|
||||
// posko: $posko
|
||||
// idUid: $idUid
|
||||
// idUp3: $idUp3
|
||||
// bulan: $bulan
|
||||
// tahun: $tahun
|
||||
// ) {
|
||||
// jumlah_bulan
|
||||
// jumlah_bulan_n_1
|
||||
// jumlah_tahun
|
||||
// jumlah_tahun_n_1
|
||||
// nama_posko
|
||||
// persen_bulan
|
||||
// persen_tahun
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const monalisaDispatchingTimeGangguan = gql`
|
||||
query DaftarmonalisaDispatchingTimeGangguan(
|
||||
$idUid: Int
|
||||
$idUp3: Int
|
||||
$idUlp: Int
|
||||
$bulan: Int
|
||||
$tahun: Int
|
||||
) {
|
||||
monalisaDispatchingTimeGangguan(
|
||||
idUid: $idUid
|
||||
idUp3: $idUp3
|
||||
idUlp: $idUlp
|
||||
bulan: $bulan
|
||||
tahun: $tahun
|
||||
) {
|
||||
nama_ulp
|
||||
mom_bulan_ini
|
||||
mom_bulan_kemarin
|
||||
persen_mom
|
||||
yoy_tahun_ini
|
||||
yoy_tahun_kemarin
|
||||
persen_yoy
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const { onResult, onError, loading, refetch } = useQuery(monalisaDispatchingTimeGangguan, {
|
||||
// regional: 0,
|
||||
idUp3: 0,
|
||||
idUid: 0,
|
||||
idUlp: 0,
|
||||
bulan: bulanSekarang.value,
|
||||
tahun: tahunSekarang.value
|
||||
})
|
||||
|
||||
const filterData = (params: any) => {
|
||||
const { regional, ulp, uid, up3, bulan, tahun } = params
|
||||
bulanSekarang.value = bulan.id
|
||||
tahunSekarang.value = tahun.id
|
||||
tahunLalu.value = tahun.id - 1
|
||||
refetch({
|
||||
// regional: regional,
|
||||
idUid: uid ? uid.id : 0,
|
||||
idUp3: up3 ? up3.id : 0,
|
||||
idUlp: ulp ? ulp.id : 0,
|
||||
bulan: bulan ? bulan.id : bulanSekarang.value,
|
||||
tahun: bulan ? tahun.id : tahunSekarang.value
|
||||
})
|
||||
onResult((queryResult) => {
|
||||
if (queryResult.data != undefined) {
|
||||
queryResult.data.monalisaDispatchingTimeGangguan.forEach((item: any) => {
|
||||
data.value = [...data.value, { ...item }]
|
||||
})
|
||||
}
|
||||
console.log(queryResult.data)
|
||||
console.log(queryResult.loading)
|
||||
console.log(queryResult.networkStatus)
|
||||
})
|
||||
onError((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
const data = selectedRowsData[0]
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
</script>
|
240
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_ENSGangguan.vue
Executable file
240
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_ENSGangguan.vue
Executable file
@ -0,0 +1,240 @@
|
||||
<template>
|
||||
<Filters @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Type2 @update:filters="(value) => (filters = value)" />
|
||||
</Filters>
|
||||
<div id="data">
|
||||
<DxDataGrid
|
||||
class="max-h-[calc(100vh-140px)] mb-10"
|
||||
:data-source="data"
|
||||
:show-column-lines="true"
|
||||
:show-row-lines="false"
|
||||
:show-borders="true"
|
||||
:row-alternation-enabled="true"
|
||||
:hover-state-enabled="true"
|
||||
@selection-changed="onSelectionChanged"
|
||||
@exporting="onExporting"
|
||||
:allow-column-resizing="true"
|
||||
column-resizing-mode="widget"
|
||||
:word-wrap-enabled="true"
|
||||
>
|
||||
<DxSelection mode="single" />
|
||||
<DxPaging :enabled="false" />
|
||||
<DxScrolling column-rendering-mode="virtual" mode="virtual" />
|
||||
<DxLoadPanel
|
||||
:position="position"
|
||||
:show-indicator="showIndicator"
|
||||
:show-pane="showPane"
|
||||
:shading="shading"
|
||||
v-if="loading"
|
||||
v-model:visible="loading"
|
||||
:enabled="true"
|
||||
/>
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
<DxExport
|
||||
:enabled="true"
|
||||
:formats="['pdf', 'xlsx', 'document']"
|
||||
:allow-export-selected-data="false"
|
||||
/>
|
||||
<DxColumnFixing :enabled="true" />
|
||||
|
||||
<DxColumn
|
||||
alignment="center"
|
||||
data-field="nama_posko"
|
||||
caption="Nama Unit"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn alignment="center" caption="ENS Gangguan" css-class="custom-table-column">
|
||||
<DxColumn alignment="center" caption="MoM" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="jumlah_bulan"
|
||||
data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunLalu}`"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="jumlah_bulan_n_1"
|
||||
data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunSekarang}`"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="persen_bulan"
|
||||
data-type="number"
|
||||
caption="%"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="YoY" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="jumlah_tahun"
|
||||
data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunLalu}`"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="jumlah_tahun_n_1"
|
||||
data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunSekarang}`"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="persen_tahun"
|
||||
data-type="number"
|
||||
caption="%"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
</DxColumn>
|
||||
</DxDataGrid>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||
import { ref } from 'vue'
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
import {
|
||||
DxColumn,
|
||||
DxColumnFixing,
|
||||
DxExport,
|
||||
DxLoadPanel,
|
||||
DxPaging,
|
||||
DxScrolling,
|
||||
DxSearchPanel,
|
||||
DxSelection
|
||||
} from 'devextreme-vue/data-grid'
|
||||
import { jsPDF } from 'jspdf'
|
||||
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { Workbook } from 'exceljs'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import gql from 'graphql-tag'
|
||||
import { getMonthName } from '@/utils/texts'
|
||||
|
||||
const tahunSekarang = ref(new Date().getFullYear())
|
||||
const bulanSekarang = ref(new Date().getMonth())
|
||||
const tahunLalu = ref(tahunSekarang.value - 1)
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
const showPane = ref(true)
|
||||
const data = ref<any[]>([])
|
||||
const dataDetail = ref<any>()
|
||||
const showDetail = ref(false)
|
||||
const monalisaRekapitulasiEnsGangguan = gql`
|
||||
query DaftarmonalisaRekapitulasiEnsGangguan(
|
||||
$regional: String
|
||||
$posko: Int
|
||||
$idUid: Int
|
||||
$idUp3: Int
|
||||
$bulan: Int
|
||||
$tahun: Int
|
||||
) {
|
||||
monalisaRekapitulasiEnsGangguan(
|
||||
regional: $regional
|
||||
posko: $posko
|
||||
idUid: $idUid
|
||||
idUp3: $idUp3
|
||||
bulan: $bulan
|
||||
tahun: $tahun
|
||||
) {
|
||||
jumlah_bulan
|
||||
jumlah_bulan_n_1
|
||||
jumlah_tahun
|
||||
jumlah_tahun_n_1
|
||||
nama_posko
|
||||
persen_bulan
|
||||
persen_tahun
|
||||
}
|
||||
}
|
||||
`
|
||||
const { onResult, onError, loading, refetch } = useQuery(monalisaRekapitulasiEnsGangguan, {
|
||||
bulan: 10,
|
||||
tahun: 2023,
|
||||
regional: '',
|
||||
posko: '',
|
||||
idUid: 0,
|
||||
idUp3: 0
|
||||
})
|
||||
const filterData = (params: any) => {
|
||||
const { regional, posko, idUid, idUp3, bulan, tahun } = params
|
||||
bulanSekarang.value = bulan.id
|
||||
tahunSekarang.value = tahun.id
|
||||
tahunLalu.value = tahun.id - 1
|
||||
refetch({
|
||||
regional: regional,
|
||||
posko: posko ? posko.id : 0,
|
||||
idUid: idUid ? idUid.id : 0,
|
||||
idUp3: idUp3 ? idUp3.id : 0,
|
||||
bulan: bulan ? bulan.id : 10,
|
||||
tahun: bulan ? tahun.id : 2023
|
||||
})
|
||||
onResult((queryResult) => {
|
||||
if (queryResult.data != undefined) {
|
||||
queryResult.data.monalisaRekapitulasiEnsGangguan.forEach((item: any) => {
|
||||
data.value = [
|
||||
...data.value,
|
||||
{
|
||||
...item
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
console.log(queryResult.data)
|
||||
console.log(queryResult.loading)
|
||||
console.log(queryResult.networkStatus)
|
||||
})
|
||||
onError((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
const doc = new jsPDF()
|
||||
|
||||
exportToPdf({
|
||||
jsPDFDocument: doc,
|
||||
component: e.component,
|
||||
indent: 5
|
||||
}).then(() => {
|
||||
doc.save(`.pdf`)
|
||||
})
|
||||
} else {
|
||||
const workbook = new Workbook()
|
||||
const worksheet = workbook.addWorksheet('Employees')
|
||||
|
||||
exportToExcel({
|
||||
component: e.component,
|
||||
worksheet,
|
||||
autoFilterEnabled: true
|
||||
}).then(() => {
|
||||
workbook.xlsx.writeBuffer().then((buffer: any) => {
|
||||
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx')
|
||||
})
|
||||
})
|
||||
|
||||
e.cancel = true
|
||||
}
|
||||
}
|
||||
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
const data = selectedRowsData[0]
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
</script>
|
208
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_GangguanBelumSelesai.vue
Executable file
208
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_GangguanBelumSelesai.vue
Executable file
@ -0,0 +1,208 @@
|
||||
<template>
|
||||
<Filters @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Type2 @update:filters="(value) => (filters = value)" />
|
||||
</Filters>
|
||||
<div id="data">
|
||||
<DxDataGrid
|
||||
class="max-h-[calc(100vh-140px)] mb-10"
|
||||
:data-source="data"
|
||||
:show-column-lines="true"
|
||||
:show-row-lines="false"
|
||||
:show-borders="true"
|
||||
:row-alternation-enabled="true"
|
||||
:hover-state-enabled="true"
|
||||
@selection-changed="onSelectionChanged"
|
||||
@exporting="onExporting"
|
||||
:allow-column-resizing="true"
|
||||
column-resizing-mode="widget"
|
||||
:word-wrap-enabled="true"
|
||||
>
|
||||
<DxSelection mode="single" />
|
||||
<DxPaging :enabled="false" />
|
||||
<DxScrolling column-rendering-mode="virtual" mode="virtual" />
|
||||
<DxLoadPanel
|
||||
:position="position"
|
||||
:show-indicator="showIndicator"
|
||||
:show-pane="showPane"
|
||||
:shading="shading"
|
||||
v-if="loading"
|
||||
v-model:visible="loading"
|
||||
:enabled="true"
|
||||
/>
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
<DxExport
|
||||
:enabled="true"
|
||||
:formats="['pdf', 'xlsx', 'document']"
|
||||
:allow-export-selected-data="false"
|
||||
/>
|
||||
<DxColumnFixing :enabled="true" />
|
||||
|
||||
<DxColumn
|
||||
alignment="center"
|
||||
data-field="nama_posko"
|
||||
caption="Nama Unit"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn alignment="center" caption="Tahun" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="gangguan"
|
||||
data-type="number"
|
||||
caption="Gangguan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="informasi"
|
||||
data-type="number"
|
||||
caption="Informasi"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="total"
|
||||
data-type="number"
|
||||
caption="Total"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
</DxDataGrid>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||
import { ref } from 'vue'
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
import {
|
||||
DxColumn,
|
||||
DxColumnFixing,
|
||||
DxExport,
|
||||
DxLoadPanel,
|
||||
DxPaging,
|
||||
DxScrolling,
|
||||
DxSearchPanel,
|
||||
DxSelection
|
||||
} from 'devextreme-vue/data-grid'
|
||||
import { jsPDF } from 'jspdf'
|
||||
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { Workbook } from 'exceljs'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
const tahunSekarang = ref(new Date().getFullYear())
|
||||
const bulanSekarang = ref(new Date().getMonth())
|
||||
const tahunLalu = ref(tahunSekarang.value - 1)
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
const showPane = ref(true)
|
||||
const data = ref<any[]>([])
|
||||
const dataDetail = ref<any>()
|
||||
const showDetail = ref(false)
|
||||
const monalisaGangguanBelumSelesai = gql`
|
||||
query DaftarmonalisaGangguanBelumSelesai(
|
||||
$regional: String
|
||||
$posko: Int
|
||||
$idUid: Int
|
||||
$idUp3: Int
|
||||
$bulan: Int
|
||||
$tahun: Int
|
||||
) {
|
||||
monalisaGangguanBelumSelesai(
|
||||
regional: $regional
|
||||
posko: $posko
|
||||
idUid: $idUid
|
||||
idUp3: $idUp3
|
||||
bulan: $bulan
|
||||
tahun: $tahun
|
||||
) {
|
||||
gangguan
|
||||
informasi
|
||||
nama_posko
|
||||
total
|
||||
}
|
||||
}
|
||||
`
|
||||
const { onResult, onError, loading, refetch } = useQuery(monalisaGangguanBelumSelesai, {
|
||||
regional: '',
|
||||
posko: '',
|
||||
idUid: 0,
|
||||
idUp3: 0,
|
||||
bulan: 10,
|
||||
tahun: 2023
|
||||
})
|
||||
const filterData = (params: any) => {
|
||||
const { regional, posko, idUid, idUp3, bulan, tahun } = params
|
||||
bulanSekarang.value = bulan.id
|
||||
tahunSekarang.value = tahun.id
|
||||
tahunLalu.value = tahun.id - 1
|
||||
refetch({
|
||||
regional: regional,
|
||||
posko: posko ? posko.id : 0,
|
||||
idUid: idUid ? idUid.id : 0,
|
||||
idUp3: idUp3 ? idUp3.id : 0,
|
||||
bulan: bulan ? bulan.id : 10,
|
||||
tahun: bulan ? tahun.id : 2023
|
||||
})
|
||||
onResult((queryResult) => {
|
||||
if (queryResult.data != undefined) {
|
||||
queryResult.data.monalisaGangguanBelumSelesai.forEach((item: any) => {
|
||||
data.value = [
|
||||
...data.value,
|
||||
{
|
||||
...item
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
console.log(queryResult.data)
|
||||
console.log(queryResult.loading)
|
||||
console.log(queryResult.networkStatus)
|
||||
})
|
||||
onError((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
const doc = new jsPDF()
|
||||
|
||||
exportToPdf({
|
||||
jsPDFDocument: doc,
|
||||
component: e.component,
|
||||
indent: 5
|
||||
}).then(() => {
|
||||
doc.save(`.pdf`)
|
||||
})
|
||||
} else {
|
||||
const workbook = new Workbook()
|
||||
const worksheet = workbook.addWorksheet('Employees')
|
||||
|
||||
exportToExcel({
|
||||
component: e.component,
|
||||
worksheet,
|
||||
autoFilterEnabled: true
|
||||
}).then(() => {
|
||||
workbook.xlsx.writeBuffer().then((buffer: any) => {
|
||||
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx')
|
||||
})
|
||||
})
|
||||
|
||||
e.cancel = true
|
||||
}
|
||||
}
|
||||
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
const data = selectedRowsData[0]
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
</script>
|
@ -0,0 +1,206 @@
|
||||
<template>
|
||||
<Filters @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Type2 @update:filters="(value) => (filters = value)" />
|
||||
</Filters>
|
||||
<div id="data">
|
||||
<DxDataGrid
|
||||
class="max-h-[calc(100vh-140px)] mb-10"
|
||||
:data-source="data"
|
||||
:show-column-lines="true"
|
||||
:show-row-lines="false"
|
||||
:show-borders="true"
|
||||
:row-alternation-enabled="true"
|
||||
:hover-state-enabled="true"
|
||||
@selection-changed="onSelectionChanged"
|
||||
@exporting="onExporting"
|
||||
:allow-column-resizing="true"
|
||||
column-resizing-mode="widget"
|
||||
:word-wrap-enabled="true"
|
||||
>
|
||||
<DxSelection mode="single" />
|
||||
<DxPaging :enabled="false" />
|
||||
<DxScrolling column-rendering-mode="virtual" mode="virtual" />
|
||||
<DxLoadPanel
|
||||
:position="position"
|
||||
:show-indicator="showIndicator"
|
||||
:show-pane="showPane"
|
||||
:shading="shading"
|
||||
v-if="loading"
|
||||
v-model:visible="loading"
|
||||
:enabled="true"
|
||||
/>
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
<DxExport
|
||||
:enabled="true"
|
||||
:formats="['pdf', 'xlsx', 'document']"
|
||||
:allow-export-selected-data="false"
|
||||
/>
|
||||
<DxColumnFixing :enabled="true" />
|
||||
|
||||
<DxColumn
|
||||
:width="50"
|
||||
alignment="center"
|
||||
:calculateCellValue="(item: any) => data.findIndex((i) => i == item) + 1"
|
||||
caption="NO"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
alignment="center"
|
||||
data-field="id_gangguan"
|
||||
caption="ID Gangguan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
alignment="center"
|
||||
data-field="tipe_permasalahan"
|
||||
caption="Jenis Gangguan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="170"
|
||||
alignment="center"
|
||||
data-field="jumlah"
|
||||
caption="Jumlah"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="120"
|
||||
alignment="center"
|
||||
data-field="persen_gangguan"
|
||||
caption="%"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxDataGrid>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||
import { ref } from 'vue'
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
import {
|
||||
DxColumn,
|
||||
DxColumnFixing,
|
||||
DxExport,
|
||||
DxLoadPanel,
|
||||
DxPaging,
|
||||
DxScrolling,
|
||||
DxSearchPanel,
|
||||
DxSelection
|
||||
} from 'devextreme-vue/data-grid'
|
||||
import { jsPDF } from 'jspdf'
|
||||
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { Workbook } from 'exceljs'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import gql from 'graphql-tag'
|
||||
const tahunSekarang = ref(new Date().getFullYear())
|
||||
const bulanSekarang = ref(new Date().getMonth())
|
||||
const tahunLalu = ref(tahunSekarang.value - 1)
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
const showPane = ref(true)
|
||||
const data = ref<any[]>([])
|
||||
const dataDetail = ref<any>()
|
||||
const showDetail = ref(false)
|
||||
const monalisaGangguanPerJenisGangguan = gql`
|
||||
query DaftarmonalisaGangguanPerJenisGangguan(
|
||||
$regional: String
|
||||
$posko: Int
|
||||
$idUid: Int
|
||||
$idUp3: Int
|
||||
$bulan: Int
|
||||
$tahun: Int
|
||||
) {
|
||||
monalisaGangguanPerJenisGangguan(
|
||||
regional: $regional
|
||||
posko: $posko
|
||||
idUid: $idUid
|
||||
idUp3: $idUp3
|
||||
bulan: $bulan
|
||||
tahun: $tahun
|
||||
) {
|
||||
id_gangguan
|
||||
jumlah
|
||||
persen_gangguan
|
||||
tipe_permasalahan
|
||||
}
|
||||
}
|
||||
`
|
||||
const { onResult, onError, loading, refetch } = useQuery(monalisaGangguanPerJenisGangguan, {
|
||||
bulan: 10,
|
||||
tahun: 2023,
|
||||
regional: '',
|
||||
posko: '',
|
||||
idUid: 0,
|
||||
idUp3: 0
|
||||
})
|
||||
const filterData = (params: any) => {
|
||||
const { regional, posko, idUid, idUp3, bulan, tahun } = params
|
||||
|
||||
refetch({
|
||||
regional: regional,
|
||||
posko: posko ? posko.id : 0,
|
||||
idUid: idUid ? idUid.id : 0,
|
||||
idUp3: idUp3 ? idUp3.id : 0,
|
||||
bulan: bulan ? bulan.id : 10,
|
||||
tahun: bulan ? tahun.id : 2023
|
||||
})
|
||||
onResult((queryResult) => {
|
||||
if (queryResult.data != undefined) {
|
||||
queryResult.data.monalisaGangguanPerJenisGangguan.forEach((item: any) => {
|
||||
data.value = [
|
||||
...data.value,
|
||||
{
|
||||
...item
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
console.log(queryResult.data)
|
||||
console.log(queryResult.loading)
|
||||
console.log(queryResult.networkStatus)
|
||||
})
|
||||
onError((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
const doc = new jsPDF()
|
||||
|
||||
exportToPdf({
|
||||
jsPDFDocument: doc,
|
||||
component: e.component,
|
||||
indent: 5
|
||||
}).then(() => {
|
||||
doc.save(`.pdf`)
|
||||
})
|
||||
} else {
|
||||
const workbook = new Workbook()
|
||||
const worksheet = workbook.addWorksheet('Employees')
|
||||
|
||||
exportToExcel({
|
||||
component: e.component,
|
||||
worksheet,
|
||||
autoFilterEnabled: true
|
||||
}).then(() => {
|
||||
workbook.xlsx.writeBuffer().then((buffer: any) => {
|
||||
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx')
|
||||
})
|
||||
})
|
||||
|
||||
e.cancel = true
|
||||
}
|
||||
}
|
||||
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
const data = selectedRowsData[0]
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
</script>
|
@ -0,0 +1,315 @@
|
||||
<template>
|
||||
<Filters @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Type2 @update:filters="(value) => (filters = value)" />
|
||||
</Filters>
|
||||
<div>
|
||||
<DxDataGrid
|
||||
class="max-h-[calc(100vh-140px)] mb-10"
|
||||
:data-source="data"
|
||||
:show-column-lines="true"
|
||||
:show-row-lines="false"
|
||||
:show-borders="true"
|
||||
:row-alternation-enabled="true"
|
||||
:hover-state-enabled="true"
|
||||
@selection-changed="onSelectionChanged"
|
||||
:column-width="100"
|
||||
@exporting="onExporting"
|
||||
:allow-column-resizing="true"
|
||||
column-resizing-mode="widget"
|
||||
:word-wrap-enabled="true"
|
||||
>
|
||||
<DxSelection mode="single" />
|
||||
<DxPaging :enabled="false" />
|
||||
<DxScrolling column-rendering-mode="virtual" mode="virtual" />
|
||||
<DxLoadPanel
|
||||
:position="position"
|
||||
:show-indicator="showIndicator"
|
||||
:show-pane="showPane"
|
||||
:shading="shading"
|
||||
v-if="loading"
|
||||
v-model:visible="loading"
|
||||
:enabled="true"
|
||||
/>
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
<DxExport
|
||||
:enabled="true"
|
||||
:formats="['pdf', 'xlsx', 'document']"
|
||||
:allow-export-selected-data="false"
|
||||
/>
|
||||
<DxColumnFixing :enabled="true" />
|
||||
|
||||
<DxColumn
|
||||
alignment="center"
|
||||
data-field="nama_posko"
|
||||
caption="Nama Unit"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
alignment="center"
|
||||
caption="Jumlah dan Durasi RPT & RCT Gangguan"
|
||||
css-class="custom-table-column"
|
||||
>
|
||||
<DxColumn alignment="center" caption="Januari 2021" css-class="custom-table-column">
|
||||
<DxColumn alignment="center" caption="Total RPT" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="a"
|
||||
data-type="number"
|
||||
data-field="total_rpt_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="Jumlah Gangguan" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="b"
|
||||
data-type="number"
|
||||
data-field="jumlah_gangguan_rpt_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="RPT Gangguan" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="c=a/b"
|
||||
data-type="number"
|
||||
data-field="rpt_gangguan_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="Total RCT" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="d"
|
||||
data-type="number"
|
||||
data-field="total_rct_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="Jumlah Gangguan" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="e"
|
||||
data-type="number"
|
||||
data-field="jumlah_gangguan_rct_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="RCT Gangguan" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="f=d/e"
|
||||
data-type="number"
|
||||
data-field="rct_gangguan_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="s.d Januari 2021" css-class="custom-table-column">
|
||||
<DxColumn alignment="center" caption="Total RPT" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="a"
|
||||
data-type="number"
|
||||
data-field="total_rpt_sampai_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="Jumlah Gangguan" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="b"
|
||||
data-type="number"
|
||||
data-field="jumlah_gangguan_rpt_sampai_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="RPT Gangguan" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="c=a/b"
|
||||
data-type="number"
|
||||
data-field="rpt_gangguan_sampai_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="Total RCT" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="d"
|
||||
data-type="number"
|
||||
data-field="total_rct_sampai_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="Jumlah Gangguan" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="e"
|
||||
data-type="number"
|
||||
data-field="jumlah_gangguan_rct_sampai_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="RCT Gangguan" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
caption="f=d/e"
|
||||
data-type="number"
|
||||
data-field="rch_gangguan_sampai_bulan"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
</DxColumn>
|
||||
</DxColumn>
|
||||
</DxDataGrid>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||
import { ref } from 'vue'
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
import {
|
||||
DxColumn,
|
||||
DxColumnFixing,
|
||||
DxExport,
|
||||
DxLoadPanel,
|
||||
DxPaging,
|
||||
DxScrolling,
|
||||
DxSearchPanel,
|
||||
DxSelection
|
||||
} from 'devextreme-vue/data-grid'
|
||||
import { jsPDF } from 'jspdf'
|
||||
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { Workbook } from 'exceljs'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
const tahunSekarang = ref(new Date().getFullYear())
|
||||
const bulanSekarang = ref(new Date().getMonth())
|
||||
const tahunLalu = ref(tahunSekarang.value - 1)
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
const showPane = ref(true)
|
||||
const data = ref<any[]>([])
|
||||
const dataDetail = ref<any>()
|
||||
const showDetail = ref(false)
|
||||
const monalisaJumlahDurasiRptRctGangguan = gql`
|
||||
query DaftarmonalisaJumlahDurasiRptRctGangguan(
|
||||
$regional: String
|
||||
$posko: Int
|
||||
$idUid: Int
|
||||
$idUp3: Int
|
||||
$bulan: Int
|
||||
$tahun: Int
|
||||
) {
|
||||
monalisaJumlahDurasiRptRctGangguan(
|
||||
regional: $regional
|
||||
posko: $posko
|
||||
idUid: $idUid
|
||||
idUp3: $idUp3
|
||||
bulan: $bulan
|
||||
tahun: $tahun
|
||||
) {
|
||||
jumlah_gangguan_rct_bulan
|
||||
jumlah_gangguan_rct_sampai_bulan
|
||||
jumlah_gangguan_rpt_bulan
|
||||
jumlah_gangguan_rpt_sampai_bulan
|
||||
nama_posko
|
||||
rct_gangguan_bulan
|
||||
rct_gangguan_sampai_bulan
|
||||
rpt_gangguan_bulan
|
||||
rpt_gangguan_sampai_bulan
|
||||
total_rct_bulan
|
||||
total_rct_sampai_bulan
|
||||
total_rpt_bulan
|
||||
total_rpt_sampai_bulan
|
||||
}
|
||||
}
|
||||
`
|
||||
const { onResult, onError, loading, refetch } = useQuery(monalisaJumlahDurasiRptRctGangguan, {
|
||||
bulan: 10,
|
||||
tahun: 2023,
|
||||
regional: '',
|
||||
posko: '',
|
||||
idUid: 0,
|
||||
idUp3: 0
|
||||
})
|
||||
const filterData = (params: any) => {
|
||||
const { regional, posko, idUid, idUp3, bulan, tahun } = params
|
||||
|
||||
refetch({
|
||||
regional: regional,
|
||||
posko: posko ? posko.id : 0,
|
||||
idUid: idUid ? idUid.id : 0,
|
||||
idUp3: idUp3 ? idUp3.id : 0,
|
||||
bulan: bulan ? bulan.id : 10,
|
||||
tahun: bulan ? tahun.id : 2023
|
||||
})
|
||||
onResult((queryResult) => {
|
||||
if (queryResult.data != undefined) {
|
||||
queryResult.data.monalisaJumlahDurasiRptRctGangguan.forEach((item: any) => {
|
||||
data.value = [...data.value, { ...item }]
|
||||
})
|
||||
}
|
||||
console.log(queryResult.data)
|
||||
console.log(queryResult.loading)
|
||||
console.log(queryResult.networkStatus)
|
||||
})
|
||||
onError((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
const doc = new jsPDF()
|
||||
|
||||
exportToPdf({
|
||||
jsPDFDocument: doc,
|
||||
component: e.component,
|
||||
indent: 5
|
||||
}).then(() => {
|
||||
doc.save(`.pdf`)
|
||||
})
|
||||
} else {
|
||||
const workbook = new Workbook()
|
||||
const worksheet = workbook.addWorksheet('Employees')
|
||||
|
||||
exportToExcel({
|
||||
component: e.component,
|
||||
worksheet,
|
||||
autoFilterEnabled: true
|
||||
}).then(() => {
|
||||
workbook.xlsx.writeBuffer().then((buffer: any) => {
|
||||
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx')
|
||||
})
|
||||
})
|
||||
|
||||
e.cancel = true
|
||||
}
|
||||
}
|
||||
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
const data = selectedRowsData[0]
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
</script>
|
230
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_JumlahKaliGangguan.vue
Executable file
230
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_JumlahKaliGangguan.vue
Executable file
@ -0,0 +1,230 @@
|
||||
<template>
|
||||
<Filters :report-button="true" @reset-form="data = []" @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Type2 @update:filters="(value) => (filters = value)" />
|
||||
</Filters>
|
||||
|
||||
<div id="data">
|
||||
<DxDataGrid class="max-h-[calc(100vh-140px)] mb-10" :data-source="data" :show-column-lines="true"
|
||||
:show-row-lines="false" :show-borders="true" :row-alternation-enabled="true" :hover-state-enabled="true"
|
||||
@selection-changed="onSelectionChanged" @exporting="onExporting" :allow-column-resizing="true"
|
||||
column-resizing-mode="widget" :word-wrap-enabled="true">
|
||||
<DxSelection mode="single" />
|
||||
<DxPaging :enabled="false" />
|
||||
<DxScrolling column-rendering-mode="virtual" mode="virtual" />
|
||||
<DxLoadPanel :position="position" :show-indicator="showIndicator" :show-pane="showPane" :shading="shading"
|
||||
v-if="loading" v-model:visible.sync="loading" :enabled="true" />
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
<DxExport :enabled="true" :formats="['pdf', 'xlsx', 'document']" :allow-export-selected-data="false" />
|
||||
<DxColumnFixing :enabled="true" />
|
||||
|
||||
<DxColumn alignment="center" :min-width="170" data-type="text" data-field="nama_ulp" caption="Nama Unit"
|
||||
css-class="custom-table-column" />
|
||||
<DxColumn alignment="center" :min-width="170" data-type="text" data-field="nama_uid" caption="Nama UID"
|
||||
css-class="custom-table-column" :group-index="0" />
|
||||
<DxColumn alignment="center" :min-width="170" data-type="text" data-field="nama_up3" caption="Nama UP3"
|
||||
css-class="custom-table-column" :group-index="1" />
|
||||
<DxColumn alignment="center" :min-width="170" data-type="text" data-field="nama_ulp" caption="Nama ULP"
|
||||
css-class="custom-table-column" :group-index="2" />
|
||||
<DxColumn alignment="center" caption="Jumlah Kali Gangguan" css-class="custom-table-column">
|
||||
<DxColumn alignment="center" caption="MoM" css-class="custom-table-column">
|
||||
<DxColumn :width="150" alignment="center" data-field="mom_bulan_kemarin" data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunLalu}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="mom_bulan_ini" data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunSekarang}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="persen_mom" data-type="number" caption="%"
|
||||
css-class="custom-table-column" />
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="YoY" css-class="custom-table-column">
|
||||
<DxColumn :width="150" alignment="center" data-field="yoy_tahun_kemarin" data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunLalu}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="yoy_tahun_ini" data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunSekarang}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="persen_yoy" data-type="number" caption="%"
|
||||
css-class="custom-table-column" />
|
||||
</DxColumn>
|
||||
</DxColumn>
|
||||
|
||||
<DxSummary>
|
||||
<DxGroupItem :align-by-column="true" column="mom_bulan_kemarin" summary-type="sum" display-format="{0}" />
|
||||
<DxGroupItem :align-by-column="true" column="mom_bulan_ini" summary-type="sum" display-format="{0}" />
|
||||
<DxGroupItem :align-by-column="true" column="persen_mom" summary-type="sum" display-format="{0}" />
|
||||
<DxGroupItem :align-by-column="true" column="yoy_tahun_kemarin" summary-type="sum" display-format="{0}" />
|
||||
<DxGroupItem :align-by-column="true" column="yoy_tahun_ini" summary-type="sum" display-format="{0}" />
|
||||
<DxGroupItem :align-by-column="true" column="persen_yoy" summary-type="sum" display-format="{0}" />
|
||||
|
||||
<DxTotalItem summary-type="sum" display-format="Total" show-in-column="nama_ulp" css-class="text-white" />
|
||||
<DxTotalItem column="mom_bulan_kemarin" summary-type="sum" display-format="{0}" css-class="text-white" />
|
||||
<DxTotalItem column="mom_bulan_ini" summary-type="sum" display-format="{0}" css-class="text-white" />
|
||||
<DxTotalItem column="persen_mom" summary-type="sum" display-format="{0}" css-class="text-white" />
|
||||
<DxTotalItem column="yoy_tahun_kemarin" summary-type="sum" display-format="{0}" css-class="text-white" />
|
||||
<DxTotalItem column="yoy_tahun_ini" summary-type="sum" display-format="{0}" css-class="text-white" />
|
||||
<DxTotalItem column="persen_yoy" summary-type="sum" display-format="{0}" css-class="text-white" />
|
||||
</DxSummary>
|
||||
</DxDataGrid>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||
import { ref } from 'vue'
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
import { getMonthName } from '@/utils/texts'
|
||||
import {
|
||||
DxColumn,
|
||||
DxColumnFixing,
|
||||
DxExport,
|
||||
DxGroupItem,
|
||||
DxLoadPanel,
|
||||
DxPaging,
|
||||
DxScrolling,
|
||||
DxSearchPanel,
|
||||
DxSelection,
|
||||
DxSummary,
|
||||
DxTotalItem
|
||||
} from 'devextreme-vue/data-grid'
|
||||
import { jsPDF } from 'jspdf'
|
||||
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { Workbook } from 'exceljs'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
const showPane = ref(true)
|
||||
const data = ref<any[]>([])
|
||||
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
const doc = new jsPDF()
|
||||
|
||||
exportToPdf({
|
||||
jsPDFDocument: doc,
|
||||
component: e.component,
|
||||
indent: 5
|
||||
}).then(() => {
|
||||
doc.save(`.pdf`)
|
||||
})
|
||||
} else {
|
||||
const workbook = new Workbook()
|
||||
const worksheet = workbook.addWorksheet('Employees')
|
||||
|
||||
exportToExcel({
|
||||
component: e.component,
|
||||
worksheet,
|
||||
autoFilterEnabled: true
|
||||
}).then(() => {
|
||||
workbook.xlsx.writeBuffer().then((buffer: any) => {
|
||||
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx')
|
||||
})
|
||||
})
|
||||
|
||||
e.cancel = true
|
||||
}
|
||||
}
|
||||
|
||||
const tahunSekarang = ref(new Date().getFullYear())
|
||||
const bulanSekarang = ref(new Date().getMonth())
|
||||
const tahunLalu = ref(tahunSekarang.value - 1)
|
||||
|
||||
// const MONALISAJUMLAHKALIGANGGUAN = gql`
|
||||
// query DaftarMonalisaJumlahKaliGangguan(
|
||||
// $regional: String
|
||||
// $idUid: Int
|
||||
// $idUp3: Int
|
||||
// $idUlp: Int
|
||||
// $bulan: Int
|
||||
// $tahun: Int
|
||||
// ) {
|
||||
// monalisaJumlahKaliGangguan(
|
||||
// regional: $regional
|
||||
// idUid: $idUid
|
||||
// idUp3: $idUp3
|
||||
// $idUlp: $idUlp
|
||||
// bulan: $bulan
|
||||
// tahun: $tahun
|
||||
// ) {
|
||||
// jumlah_bulan
|
||||
// jumlah_bulan_n_1
|
||||
// jumlah_tahun
|
||||
// jumlah_tahun_n_1
|
||||
// nama_posko
|
||||
// persen_bulan
|
||||
// persen_tahun
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const MONALISAJUMLAHKALIGANGGUAN = gql`
|
||||
query DaftarMonalisaJumlahKaliGangguan(
|
||||
$idUid: Int
|
||||
$idUp3: Int
|
||||
$idUlp: Int
|
||||
$bulan: Int
|
||||
$tahun: Int
|
||||
) {
|
||||
monalisaJumlahKaliGangguan(
|
||||
idUid: $idUid
|
||||
idUp3: $idUp3
|
||||
idUlp: $idUlp
|
||||
bulan: $bulan
|
||||
tahun: $tahun
|
||||
) {
|
||||
nama_uid
|
||||
nama_up3
|
||||
nama_ulp
|
||||
mom_bulan_ini
|
||||
mom_bulan_kemarin
|
||||
persen_mom
|
||||
yoy_tahun_ini
|
||||
yoy_tahun_kemarin
|
||||
persen_yoy
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const { onResult, onError, loading, refetch } = useQuery(MONALISAJUMLAHKALIGANGGUAN, {
|
||||
// regional: 0,
|
||||
idUp3: 0,
|
||||
idUid: 0,
|
||||
idUlp: 0,
|
||||
bulan: bulanSekarang.value,
|
||||
tahun: tahunSekarang.value
|
||||
})
|
||||
|
||||
const filterData = (params: any) => {
|
||||
const { regional, ulp, uid, up3, bulan, tahun } = params
|
||||
bulanSekarang.value = bulan.id
|
||||
tahunSekarang.value = tahun.id
|
||||
tahunLalu.value = tahun.id - 1
|
||||
refetch({
|
||||
// regional: regional,
|
||||
idUid: uid ? uid.id : 0,
|
||||
idUp3: up3 ? up3.id : 0,
|
||||
idUlp: ulp ? ulp.id : 0,
|
||||
bulan: bulan ? bulan.id : bulanSekarang.value,
|
||||
tahun: bulan ? tahun.id : tahunSekarang.value
|
||||
})
|
||||
onResult((queryResult) => {
|
||||
if (queryResult.data != undefined) {
|
||||
data.value = queryResult.data.monalisaJumlahKaliGangguan
|
||||
}
|
||||
console.log(queryResult.data)
|
||||
console.log(queryResult.loading)
|
||||
console.log(queryResult.networkStatus)
|
||||
})
|
||||
onError((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
const data = selectedRowsData[0]
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
</script>
|
240
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_LaporUlang.vue
Executable file
240
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_LaporUlang.vue
Executable file
@ -0,0 +1,240 @@
|
||||
<template>
|
||||
<Filters @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Type2 @update:filters="(value) => (filters = value)" />
|
||||
</Filters>
|
||||
<div id="data">
|
||||
<DxDataGrid
|
||||
class="max-h-[calc(100vh-140px)] mb-10"
|
||||
:data-source="data"
|
||||
:show-column-lines="true"
|
||||
:show-row-lines="false"
|
||||
:show-borders="true"
|
||||
:row-alternation-enabled="true"
|
||||
:hover-state-enabled="true"
|
||||
@selection-changed="onSelectionChanged"
|
||||
@exporting="onExporting"
|
||||
:allow-column-resizing="true"
|
||||
column-resizing-mode="widget"
|
||||
:word-wrap-enabled="true"
|
||||
>
|
||||
<DxSelection mode="single" />
|
||||
<DxPaging :enabled="false" />
|
||||
<DxScrolling column-rendering-mode="virtual" mode="virtual" />
|
||||
<DxLoadPanel
|
||||
:position="position"
|
||||
:show-indicator="showIndicator"
|
||||
:show-pane="showPane"
|
||||
:shading="shading"
|
||||
v-if="loading"
|
||||
v-model:visible="loading"
|
||||
:enabled="true"
|
||||
/>
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
<DxExport
|
||||
:enabled="true"
|
||||
:formats="['pdf', 'xlsx', 'document']"
|
||||
:allow-export-selected-data="false"
|
||||
/>
|
||||
<DxColumnFixing :enabled="true" />
|
||||
|
||||
<DxColumn
|
||||
alignment="center"
|
||||
data-field="nama_posko"
|
||||
caption="Nama Unit"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn alignment="center" caption="Lapor Ulang Gangguan" css-class="custom-table-column">
|
||||
<DxColumn alignment="center" caption="MoM" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="jumlah_bulan"
|
||||
data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunLalu}`"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="jumlah_bulan_n_1"
|
||||
data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunSekarang}`"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="persen_bulan"
|
||||
data-type="number"
|
||||
caption="%"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="YoY" css-class="custom-table-column">
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="jumlah_tahun"
|
||||
data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunLalu}`"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="jumlah_tahun_n_1"
|
||||
data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunSekarang}`"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="150"
|
||||
alignment="center"
|
||||
data-field="persen_tahun"
|
||||
data-type="number"
|
||||
caption="%"
|
||||
css-class="custom-table-column"
|
||||
/>
|
||||
</DxColumn>
|
||||
</DxColumn>
|
||||
</DxDataGrid>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||
import { ref } from 'vue'
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
import {
|
||||
DxColumn,
|
||||
DxColumnFixing,
|
||||
DxExport,
|
||||
DxLoadPanel,
|
||||
DxPaging,
|
||||
DxScrolling,
|
||||
DxSearchPanel,
|
||||
DxSelection
|
||||
} from 'devextreme-vue/data-grid'
|
||||
import { jsPDF } from 'jspdf'
|
||||
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { Workbook } from 'exceljs'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import gql from 'graphql-tag'
|
||||
import { getMonthName } from '@/utils/texts'
|
||||
|
||||
const tahunSekarang = ref(new Date().getFullYear())
|
||||
const bulanSekarang = ref(new Date().getMonth())
|
||||
const tahunLalu = ref(tahunSekarang.value - 1)
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
const showPane = ref(true)
|
||||
const data = ref<any[]>([])
|
||||
const dataDetail = ref<any>()
|
||||
const showDetail = ref(false)
|
||||
const monalisaRekapitulasiLaporUlangGangguan = gql`
|
||||
query DaftarmonalisaRekapitulasiLaporUlangGangguan(
|
||||
$regional: String
|
||||
$posko: Int
|
||||
$idUid: Int
|
||||
$idUp3: Int
|
||||
$bulan: Int
|
||||
$tahun: Int
|
||||
) {
|
||||
monalisaRekapitulasiLaporUlangGangguan(
|
||||
regional: $regional
|
||||
posko: $posko
|
||||
idUid: $idUid
|
||||
idUp3: $idUp3
|
||||
bulan: $bulan
|
||||
tahun: $tahun
|
||||
) {
|
||||
jumlah_bulan
|
||||
jumlah_bulan_n_1
|
||||
jumlah_tahun
|
||||
jumlah_tahun_n_1
|
||||
nama_posko
|
||||
persen_bulan
|
||||
persen_tahun
|
||||
}
|
||||
}
|
||||
`
|
||||
const { onResult, onError, loading, refetch } = useQuery(monalisaRekapitulasiLaporUlangGangguan, {
|
||||
bulan: 10,
|
||||
tahun: 2023,
|
||||
regional: '',
|
||||
posko: '',
|
||||
idUid: 0,
|
||||
idUp3: 0
|
||||
})
|
||||
const filterData = (params: any) => {
|
||||
const { regional, posko, idUid, idUp3, bulan, tahun } = params
|
||||
bulanSekarang.value = bulan.id
|
||||
tahunSekarang.value = tahun.id
|
||||
tahunLalu.value = tahun.id - 1
|
||||
refetch({
|
||||
regional: regional,
|
||||
posko: posko ? posko.id : 0,
|
||||
idUid: idUid ? idUid.id : 0,
|
||||
idUp3: idUp3 ? idUp3.id : 0,
|
||||
bulan: bulan ? bulan.id : 10,
|
||||
tahun: bulan ? tahun.id : 2023
|
||||
})
|
||||
onResult((queryResult) => {
|
||||
if (queryResult.data != undefined) {
|
||||
queryResult.data.monalisaRekapitulasiLaporUlangGangguan.forEach((item: any) => {
|
||||
data.value = [
|
||||
...data.value,
|
||||
{
|
||||
...item
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
console.log(queryResult.data)
|
||||
console.log(queryResult.loading)
|
||||
console.log(queryResult.networkStatus)
|
||||
})
|
||||
onError((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
const doc = new jsPDF()
|
||||
|
||||
exportToPdf({
|
||||
jsPDFDocument: doc,
|
||||
component: e.component,
|
||||
indent: 5
|
||||
}).then(() => {
|
||||
doc.save(`.pdf`)
|
||||
})
|
||||
} else {
|
||||
const workbook = new Workbook()
|
||||
const worksheet = workbook.addWorksheet('Employees')
|
||||
|
||||
exportToExcel({
|
||||
component: e.component,
|
||||
worksheet,
|
||||
autoFilterEnabled: true
|
||||
}).then(() => {
|
||||
workbook.xlsx.writeBuffer().then((buffer: any) => {
|
||||
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx')
|
||||
})
|
||||
})
|
||||
|
||||
e.cancel = true
|
||||
}
|
||||
}
|
||||
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
const data = selectedRowsData[0]
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
</script>
|
210
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_RecoveryTimeGangguan.vue
Executable file
210
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_RecoveryTimeGangguan.vue
Executable file
@ -0,0 +1,210 @@
|
||||
<template>
|
||||
<Filters :report-button="true" @reset-form="data = []" @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Type2 @update:filters="(value) => (filters = value)" />
|
||||
</Filters>
|
||||
|
||||
<div id="data">
|
||||
<DxDataGrid class="max-h-[calc(100vh-140px)] mb-10" :data-source="data" :show-column-lines="true"
|
||||
:show-row-lines="false" :show-borders="true" :row-alternation-enabled="true" :hover-state-enabled="true"
|
||||
@selection-changed="onSelectionChanged" @exporting="onExporting" :allow-column-resizing="true"
|
||||
column-resizing-mode="widget" :word-wrap-enabled="true">
|
||||
<DxSelection mode="single" />
|
||||
<DxPaging :enabled="false" />
|
||||
<DxScrolling column-rendering-mode="virtual" mode="virtual" />
|
||||
<DxLoadPanel :position="position" :show-indicator="showIndicator" :show-pane="showPane" :shading="shading"
|
||||
v-if="loading" v-model:visible="loading" :enabled="true" />
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
<DxExport :enabled="true" :formats="['pdf', 'xlsx', 'document']" :allow-export-selected-data="false" />
|
||||
<DxColumnFixing :enabled="true" />
|
||||
|
||||
<DxColumn alignment="center" :min-width="170" data-type="text" data-field="nama_ulp" caption="Nama Unit"
|
||||
css-class="custom-table-column" :group-index="0" />
|
||||
<DxColumn alignment="center" :min-width="170" data-type="text" data-field="nama_ulp" caption="Nama Unit"
|
||||
css-class="custom-table-column" />
|
||||
<DxColumn alignment="center" caption="Jumlah RCT Kali Gangguan" css-class="custom-table-column">
|
||||
<DxColumn alignment="center" caption="MoM" css-class="custom-table-column">
|
||||
<DxColumn :width="150" alignment="center" data-field="mom_bulan_kemarin" data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunLalu}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="mom_bulan_ini" data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunSekarang}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="persen_mom" data-type="number" caption="%"
|
||||
css-class="custom-table-column" />
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="YoY" css-class="custom-table-column">
|
||||
<DxColumn :width="150" alignment="center" data-field="yoy_tahun_kemarin" data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunLalu}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="yoy_tahun_ini" data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunSekarang}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="persen_yoy" data-type="number" caption="%"
|
||||
css-class="custom-table-column" />
|
||||
</DxColumn>
|
||||
</DxColumn>
|
||||
</DxDataGrid>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||
import { ref } from 'vue'
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
import {
|
||||
DxColumn,
|
||||
DxColumnFixing,
|
||||
DxExport,
|
||||
DxLoadPanel,
|
||||
DxPaging,
|
||||
DxScrolling,
|
||||
DxSearchPanel,
|
||||
DxSelection
|
||||
} from 'devextreme-vue/data-grid'
|
||||
import { jsPDF } from 'jspdf'
|
||||
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { Workbook } from 'exceljs'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import gql from 'graphql-tag'
|
||||
import { getMonthName } from '@/utils/texts'
|
||||
|
||||
const tahunSekarang = ref(new Date().getFullYear())
|
||||
const bulanSekarang = ref(new Date().getMonth())
|
||||
const tahunLalu = ref(tahunSekarang.value - 1)
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
const showPane = ref(true)
|
||||
const data = ref<any[]>([])
|
||||
|
||||
// const monalisaRecoveryTimeGangguan = gql`
|
||||
// query DaftarmonalisaRecoveryTimeGangguan(
|
||||
// $regional: regional
|
||||
// $posko: Int
|
||||
// $idUid: Int
|
||||
// $idUp3: Int
|
||||
// $bulan: Int
|
||||
// $tahun: Int
|
||||
// ) {
|
||||
// monalisaRecoveryTimeGangguan(
|
||||
// regional: $regional
|
||||
// posko: $posko
|
||||
// idUid: $idUid
|
||||
// idUp3: $idUp3
|
||||
// bulan: $bulan
|
||||
// tahun: $tahun
|
||||
// ) {
|
||||
// jumlah_bulan
|
||||
// jumlah_bulan_n_1
|
||||
// jumlah_tahun
|
||||
// jumlah_tahun_n_1
|
||||
// nama_posko
|
||||
// persen_bulan
|
||||
// persen_tahun
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const monalisaRecoveryTimeGangguan = gql`
|
||||
query DaftarmonalisaRecoveryTimeGangguan(
|
||||
$idUid: Int
|
||||
$idUp3: Int
|
||||
$idUlp: Int
|
||||
$bulan: Int
|
||||
$tahun: Int
|
||||
) {
|
||||
monalisaRecoveryTimeGangguan(
|
||||
idUid: $idUid
|
||||
idUp3: $idUp3
|
||||
idUlp: $idUlp
|
||||
bulan: $bulan
|
||||
tahun: $tahun
|
||||
) {
|
||||
nama_ulp
|
||||
mom_bulan_ini
|
||||
mom_bulan_kemarin
|
||||
persen_mom
|
||||
yoy_tahun_ini
|
||||
yoy_tahun_kemarin
|
||||
persen_yoy
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const { onResult, onError, loading, refetch } = useQuery(monalisaRecoveryTimeGangguan, {
|
||||
// regional: 0,
|
||||
idUp3: 0,
|
||||
idUid: 0,
|
||||
idUlp: 0,
|
||||
bulan: bulanSekarang.value,
|
||||
tahun: tahunSekarang.value
|
||||
})
|
||||
|
||||
const filterData = (params: any) => {
|
||||
const { regional, ulp, uid, up3, bulan, tahun } = params
|
||||
bulanSekarang.value = bulan.id
|
||||
tahunSekarang.value = tahun.id
|
||||
tahunLalu.value = tahun.id - 1
|
||||
refetch({
|
||||
// regional: regional,
|
||||
idUid: uid ? uid.id : 0,
|
||||
idUp3: up3 ? up3.id : 0,
|
||||
idUlp: ulp ? ulp.id : 0,
|
||||
bulan: bulan ? bulan.id : bulanSekarang.value,
|
||||
tahun: bulan ? tahun.id : tahunSekarang.value
|
||||
})
|
||||
onResult((queryResult) => {
|
||||
if (queryResult.data != undefined) {
|
||||
queryResult.data.monalisaRecoveryTimeGangguan.forEach((item: any) => {
|
||||
data.value = [
|
||||
...data.value,
|
||||
{
|
||||
...item
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
console.log(queryResult.data)
|
||||
console.log(queryResult.loading)
|
||||
console.log(queryResult.networkStatus)
|
||||
})
|
||||
onError((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
const doc = new jsPDF()
|
||||
|
||||
exportToPdf({
|
||||
jsPDFDocument: doc,
|
||||
component: e.component,
|
||||
indent: 5
|
||||
}).then(() => {
|
||||
doc.save(`.pdf`)
|
||||
})
|
||||
} else {
|
||||
const workbook = new Workbook()
|
||||
const worksheet = workbook.addWorksheet('Employees')
|
||||
|
||||
exportToExcel({
|
||||
component: e.component,
|
||||
worksheet,
|
||||
autoFilterEnabled: true
|
||||
}).then(() => {
|
||||
workbook.xlsx.writeBuffer().then((buffer: any) => {
|
||||
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx')
|
||||
})
|
||||
})
|
||||
|
||||
e.cancel = true
|
||||
}
|
||||
}
|
||||
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
const data = selectedRowsData[0]
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
</script>
|
210
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_ResponseTimeGangguan.vue
Executable file
210
src/components/Pages/Monalisa/Gangguan/Rekap/MonalisaGR_ResponseTimeGangguan.vue
Executable file
@ -0,0 +1,210 @@
|
||||
<template>
|
||||
<Filters @reset-form="data = []" :report-button="true" @run-search="() => filterData(filters)" class="mb-4">
|
||||
<Type2 @update:filters="(value) => (filters = value)" />
|
||||
</Filters>
|
||||
|
||||
<div id="data">
|
||||
<DxDataGrid class="max-h-[calc(100vh-140px)] mb-10" :data-source="data" :show-column-lines="true"
|
||||
:show-row-lines="false" :show-borders="true" :row-alternation-enabled="true" :hover-state-enabled="true"
|
||||
@selection-changed="onSelectionChanged" @exporting="onExporting" :allow-column-resizing="true"
|
||||
column-resizing-mode="widget" :word-wrap-enabled="true">
|
||||
<DxSelection mode="single" />
|
||||
<DxPaging :enabled="false" />
|
||||
<DxScrolling column-rendering-mode="virtual" mode="virtual" />
|
||||
<DxLoadPanel :position="position" :show-indicator="showIndicator" :show-pane="showPane" :shading="shading"
|
||||
v-if="loading" v-model:visible="loading" :enabled="true" />
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
<DxExport :enabled="true" :formats="['pdf', 'xlsx', 'document']" :allow-export-selected-data="false" />
|
||||
<DxColumnFixing :enabled="true" />
|
||||
|
||||
<DxColumn alignment="center" :min-width="170" data-type="text" data-field="nama_ulp" caption="Nama Unit"
|
||||
css-class="custom-table-column" :group-index="0" />
|
||||
<DxColumn alignment="center" :min-width="170" data-type="text" data-field="nama_ulp" caption="Nama Unit"
|
||||
css-class="custom-table-column" />
|
||||
<DxColumn alignment="center" caption="Jumlah RPT Kali Gangguan" css-class="custom-table-column">
|
||||
<DxColumn alignment="center" caption="MoM" css-class="custom-table-column">
|
||||
<DxColumn :width="150" alignment="center" data-field="mom_bulan_kemarin" data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunLalu}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="mom_bulan_ini" data-type="number"
|
||||
:caption="`${getMonthName(bulanSekarang)} ${tahunSekarang}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="persen_mom" data-type="number" caption="%"
|
||||
css-class="custom-table-column" />
|
||||
</DxColumn>
|
||||
<DxColumn alignment="center" caption="YoY" css-class="custom-table-column">
|
||||
<DxColumn :width="150" alignment="center" data-field="yoy_tahun_kemarin" data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunLalu}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="yoy_tahun_ini" data-type="number"
|
||||
:caption="`s.d ${getMonthName(bulanSekarang)} ${tahunSekarang}`" css-class="custom-table-column" />
|
||||
<DxColumn :width="150" alignment="center" data-field="persen_yoy" data-type="number" caption="%"
|
||||
css-class="custom-table-column" />
|
||||
</DxColumn>
|
||||
</DxColumn>
|
||||
</DxDataGrid>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||
import { ref } from 'vue'
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
import {
|
||||
DxColumn,
|
||||
DxColumnFixing,
|
||||
DxExport,
|
||||
DxLoadPanel,
|
||||
DxPaging,
|
||||
DxScrolling,
|
||||
DxSearchPanel,
|
||||
DxSelection
|
||||
} from 'devextreme-vue/data-grid'
|
||||
import { jsPDF } from 'jspdf'
|
||||
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { Workbook } from 'exceljs'
|
||||
import gql from 'graphql-tag'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import { getMonthName } from '@/utils/texts'
|
||||
|
||||
const tahunSekarang = ref(new Date().getFullYear())
|
||||
const bulanSekarang = ref(new Date().getMonth())
|
||||
const tahunLalu = ref(tahunSekarang.value - 1)
|
||||
const position = { of: '#data' }
|
||||
const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
const showPane = ref(true)
|
||||
const data = ref<any[]>([])
|
||||
|
||||
// const monalisaResponseTimeKeluhan = gql`
|
||||
// query DaftarmonalisaResponseTimeKeluhan(
|
||||
// $regional: String
|
||||
// $posko: Int
|
||||
// $idUid: Int
|
||||
// $idUp3: Int
|
||||
// $bulan: Int
|
||||
// $tahun: Int
|
||||
// ) {
|
||||
// monalisaResponseTimeKeluhan(
|
||||
// regional: $regional
|
||||
// posko: $posko
|
||||
// idUid: $idUid
|
||||
// idUp3: $idUp3
|
||||
// bulan: $bulan
|
||||
// tahun: $tahun
|
||||
// ) {
|
||||
// jumlah_bulan
|
||||
// jumlah_bulan_n_1
|
||||
// jumlah_tahun
|
||||
// jumlah_tahun_n_1
|
||||
// nama_posko
|
||||
// persen_bulan
|
||||
// persen_tahun
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const monalisaResponseTimeKeluhan = gql`
|
||||
query DaftarmonalisaResponseTimeKeluhan(
|
||||
$idUid: Int
|
||||
$idUp3: Int
|
||||
$idUlp: Int
|
||||
$bulan: Int
|
||||
$tahun: Int
|
||||
) {
|
||||
monalisaResponseTimeKeluhan(
|
||||
idUid: $idUid
|
||||
idUp3: $idUp3
|
||||
idUlp: $idUlp
|
||||
bulan: $bulan
|
||||
tahun: $tahun
|
||||
) {
|
||||
nama_ulp
|
||||
mom_bulan_ini
|
||||
mom_bulan_kemarin
|
||||
persen_mom
|
||||
yoy_tahun_ini
|
||||
yoy_tahun_kemarin
|
||||
persen_yoy
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const { onResult, onError, loading, refetch } = useQuery(monalisaResponseTimeKeluhan, {
|
||||
// regional: 0,
|
||||
idUp3: 0,
|
||||
idUid: 0,
|
||||
idUlp: 0,
|
||||
bulan: bulanSekarang.value,
|
||||
tahun: tahunSekarang.value
|
||||
})
|
||||
|
||||
const filterData = (params: any) => {
|
||||
const { regional, ulp, uid, up3, bulan, tahun } = params
|
||||
bulanSekarang.value = bulan.id
|
||||
tahunSekarang.value = tahun.id
|
||||
tahunLalu.value = tahun.id - 1
|
||||
refetch({
|
||||
// regional: regional,
|
||||
idUid: uid ? uid.id : 0,
|
||||
idUp3: up3 ? up3.id : 0,
|
||||
idUlp: ulp ? ulp.id : 0,
|
||||
bulan: bulan ? bulan.id : bulanSekarang.value,
|
||||
tahun: bulan ? tahun.id : tahunSekarang.value
|
||||
})
|
||||
onResult((queryResult) => {
|
||||
if (queryResult.data != undefined) {
|
||||
queryResult.data.monalisaResponseTimeKeluhan.forEach((item: any) => {
|
||||
data.value = [
|
||||
...data.value,
|
||||
{
|
||||
...item
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
console.log(queryResult.data)
|
||||
console.log(queryResult.loading)
|
||||
console.log(queryResult.networkStatus)
|
||||
})
|
||||
onError((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
const onExporting = (e: any) => {
|
||||
if (e.format === 'pdf') {
|
||||
const doc = new jsPDF()
|
||||
|
||||
exportToPdf({
|
||||
jsPDFDocument: doc,
|
||||
component: e.component,
|
||||
indent: 5
|
||||
}).then(() => {
|
||||
doc.save(`.pdf`)
|
||||
})
|
||||
} else {
|
||||
const workbook = new Workbook()
|
||||
const worksheet = workbook.addWorksheet('Employees')
|
||||
|
||||
exportToExcel({
|
||||
component: e.component,
|
||||
worksheet,
|
||||
autoFilterEnabled: true
|
||||
}).then(() => {
|
||||
workbook.xlsx.writeBuffer().then((buffer: any) => {
|
||||
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx')
|
||||
})
|
||||
})
|
||||
|
||||
e.cancel = true
|
||||
}
|
||||
}
|
||||
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
const data = selectedRowsData[0]
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
const filters = ref()
|
||||
</script>
|
Reference in New Issue
Block a user