fix: alignment, grouping and summary in monalisa rekapitulasi keluhan belum selesai
This commit is contained in:
@ -1,36 +1,152 @@
|
|||||||
<template>
|
<template>
|
||||||
<Filters @run-search="() => filterData(filters)" :report-button="true" class="mb-4">
|
<Filters
|
||||||
<Type2 @update:filters="(value) => filters = value" />
|
@reset-form="data = []"
|
||||||
|
@run-search="() => filterData(filters)"
|
||||||
|
:report-button="true"
|
||||||
|
class="mb-4"
|
||||||
|
>
|
||||||
|
<Type2 @update:filters="(value) => (filters = value)" />
|
||||||
</Filters>
|
</Filters>
|
||||||
|
|
||||||
<div id="data">
|
<div id="data">
|
||||||
<DxDataGrid class="max-h-[calc(100vh-140px)] mb-10" :data-source="data" :show-column-lines="true"
|
<DxDataGrid
|
||||||
:show-row-lines="false" :show-borders="true" :row-alternation-enabled="true" :hover-state-enabled="true"
|
class="max-h-[calc(100vh-140px)] mb-10"
|
||||||
@selection-changed="onSelectionChanged" @exporting="onExporting" :allow-column-resizing="true"
|
:data-source="data"
|
||||||
column-resizing-mode="widget" :word-wrap-enabled="true">
|
: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" />
|
<DxSelection mode="single" />
|
||||||
<DxPaging :enabled="false" />
|
<DxPaging :enabled="false" />
|
||||||
<DxScrolling column-rendering-mode="virtual" mode="virtual" />
|
<DxScrolling column-rendering-mode="virtual" mode="virtual" />
|
||||||
<DxLoadPanel :position="position" :show-indicator="showIndicator" :show-pane="showPane" :shading="shading"
|
<DxLoadPanel
|
||||||
v-if="loading" v-model:visible="loading" :enabled="true" />
|
: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" />
|
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||||
<DxExport :enabled="true" :formats="['pdf', 'xlsx', 'document']" :allow-export-selected-data="false" />
|
<DxExport
|
||||||
|
:enabled="true"
|
||||||
|
:formats="['pdf', 'xlsx', 'document']"
|
||||||
|
:allow-export-selected-data="false"
|
||||||
|
/>
|
||||||
<DxColumnFixing :enabled="true" />
|
<DxColumnFixing :enabled="true" />
|
||||||
|
|
||||||
<DxColumn alignment="center" data-field="nama_ulp" caption="Nama Unit" css-class="custom-table-column" />
|
<DxColumn
|
||||||
|
alignment="center"
|
||||||
|
data-field="nama_ulp"
|
||||||
|
caption="Nama Unit"
|
||||||
|
css-class="custom-table-column"
|
||||||
|
cell-template="formatText"
|
||||||
|
/>
|
||||||
|
<DxColumn
|
||||||
|
alignment="center"
|
||||||
|
data-field="nama_uid"
|
||||||
|
caption="UID"
|
||||||
|
css-class="custom-table-column"
|
||||||
|
cell-template="formatText"
|
||||||
|
:group-index="0"
|
||||||
|
/>
|
||||||
<DxColumn alignment="center" caption="Tahun" css-class="custom-table-column">
|
<DxColumn alignment="center" caption="Tahun" css-class="custom-table-column">
|
||||||
<DxColumn :width="150" alignment="center" data-field="jumlah_keluhan" data-type="number" caption="Keluhan"
|
<DxColumn
|
||||||
css-class="custom-table-column" />
|
:width="150"
|
||||||
<DxColumn :width="150" alignment="center" data-field="jumlah_informasi" data-type="number" caption="Informasi"
|
alignment="center"
|
||||||
css-class="custom-table-column" />
|
data-field="jumlah_keluhan"
|
||||||
<DxColumn :width="150" alignment="center" data-field="total" data-type="number" caption="Total"
|
data-type="number"
|
||||||
css-class="custom-table-column" />
|
caption="Keluhan"
|
||||||
|
css-class="custom-table-column"
|
||||||
|
cell-template="formatNumber"
|
||||||
|
/>
|
||||||
|
<DxColumn
|
||||||
|
:width="150"
|
||||||
|
alignment="center"
|
||||||
|
data-field="jumlah_informasi"
|
||||||
|
data-type="number"
|
||||||
|
caption="Informasi"
|
||||||
|
css-class="custom-table-column"
|
||||||
|
cell-template="formatNumber"
|
||||||
|
/>
|
||||||
|
<DxColumn
|
||||||
|
:width="150"
|
||||||
|
alignment="center"
|
||||||
|
data-field="total"
|
||||||
|
data-type="number"
|
||||||
|
caption="Total"
|
||||||
|
css-class="custom-table-column"
|
||||||
|
cell-template="formatPercentage"
|
||||||
|
/>
|
||||||
</DxColumn>
|
</DxColumn>
|
||||||
|
|
||||||
|
<DxSummary>
|
||||||
|
<DxTotalItem
|
||||||
|
summary-type="sum"
|
||||||
|
display-format="Total"
|
||||||
|
show-in-column="nama_ulp"
|
||||||
|
css-class="text-white !text-left"
|
||||||
|
/>
|
||||||
|
<DxTotalItem
|
||||||
|
column="jumlah_keluhan"
|
||||||
|
summary-type="sum"
|
||||||
|
display-format="{0}"
|
||||||
|
css-class="text-white !text-right"
|
||||||
|
:customize-text="(e: any) => formatNumber(parseFloat(e.value.toString()))"
|
||||||
|
/>
|
||||||
|
<DxTotalItem
|
||||||
|
column="jumlah_informasi"
|
||||||
|
summary-type="sum"
|
||||||
|
display-format="{0}"
|
||||||
|
css-class="text-white !text-right"
|
||||||
|
:customize-text="(e: any) => formatNumber(parseFloat(e.value.toString()))"
|
||||||
|
/>
|
||||||
|
<DxTotalItem
|
||||||
|
column="total"
|
||||||
|
summary-type="sum"
|
||||||
|
display-format="{0}"
|
||||||
|
css-class="text-white !text-right"
|
||||||
|
:customize-text="(e: any) => formatPercentage(parseFloat(e.value.toString()))"
|
||||||
|
/>
|
||||||
|
</DxSummary>
|
||||||
|
|
||||||
|
<template #formatNumber="{ data }">
|
||||||
|
<p class="text-right cursor-pointer">
|
||||||
|
{{
|
||||||
|
isNumber(data.text)
|
||||||
|
? data.column.caption == '%'
|
||||||
|
? formatPercentage(data.text)
|
||||||
|
: formatNumber(data.text)
|
||||||
|
: data.text
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #formatText="{ data }">
|
||||||
|
<p class="!text-left cursor-pointer">
|
||||||
|
{{ data.text }}
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #formatPercentage="{ data }">
|
||||||
|
<p class="text-right cursor-pointer">
|
||||||
|
{{ parseFloat(data.text) ? formatPercentage(data.text) : '0%' }}
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
</DxDataGrid>
|
</DxDataGrid>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import Filters from '@/components/Form/Filters.vue'
|
import Filters from '@/components/Form/Filters.vue'
|
||||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||||
import { DxDataGrid } from 'devextreme-vue'
|
import { DxDataGrid } from 'devextreme-vue'
|
||||||
@ -42,22 +158,29 @@ import {
|
|||||||
DxPaging,
|
DxPaging,
|
||||||
DxScrolling,
|
DxScrolling,
|
||||||
DxSearchPanel,
|
DxSearchPanel,
|
||||||
DxSelection
|
DxSelection,
|
||||||
|
DxSummary,
|
||||||
|
DxTotalItem
|
||||||
} from 'devextreme-vue/data-grid'
|
} from 'devextreme-vue/data-grid'
|
||||||
import { jsPDF } from 'jspdf'
|
import { jsPDF } from 'jspdf'
|
||||||
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
import { exportDataGrid as exportToPdf } from 'devextreme/pdf_exporter'
|
||||||
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
import { exportDataGrid as exportToExcel } from 'devextreme/excel_exporter'
|
||||||
|
import { formatNumber, formatPercentage, isNumber } from '@/utils/numbers'
|
||||||
import { saveAs } from 'file-saver'
|
import { saveAs } from 'file-saver'
|
||||||
import { Workbook } from 'exceljs'
|
import { Workbook } from 'exceljs'
|
||||||
import { useQuery } from '@vue/apollo-composable'
|
import { useQuery } from '@vue/apollo-composable'
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
const position = { of: '#data' }
|
const position = { of: '#data' }
|
||||||
const showIndicator = ref(true)
|
const showIndicator = ref(true)
|
||||||
const shading = ref(true)
|
const shading = ref(true)
|
||||||
const showPane = ref(true)
|
const showPane = ref(true)
|
||||||
const data = ref<any[]>([])
|
const data = ref<any[]>([])
|
||||||
const dataDetail = ref<any>()
|
const currentYear = ref(new Date().getFullYear())
|
||||||
const showDetail = ref(false)
|
const currentMonth = ref(new Date().getMonth())
|
||||||
|
const lastYear = ref(currentYear.value - 1)
|
||||||
|
const filters = ref()
|
||||||
|
|
||||||
const onExporting = (e: any) => {
|
const onExporting = (e: any) => {
|
||||||
if (e.format === 'pdf') {
|
if (e.format === 'pdf') {
|
||||||
const doc = new jsPDF()
|
const doc = new jsPDF()
|
||||||
@ -91,6 +214,7 @@ const onSelectionChanged = ({ selectedRowsData }: any) => {
|
|||||||
const data = selectedRowsData[0]
|
const data = selectedRowsData[0]
|
||||||
console.log(data)
|
console.log(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
const monalisaRekapitulasiKeluhanBelumSelesai = gql`
|
const monalisaRekapitulasiKeluhanBelumSelesai = gql`
|
||||||
query DaftarmonalisaRekapitulasiKeluhanBelumSelesai(
|
query DaftarmonalisaRekapitulasiKeluhanBelumSelesai(
|
||||||
#$regional: String
|
#$regional: String
|
||||||
@ -121,36 +245,111 @@ const monalisaRekapitulasiKeluhanBelumSelesai = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const { onResult, onError, loading, refetch } = useQuery(monalisaRekapitulasiKeluhanBelumSelesai, {
|
const { onResult, onError, loading, refetch } = useQuery(monalisaRekapitulasiKeluhanBelumSelesai, {
|
||||||
regional: '',
|
bulan: currentMonth.value,
|
||||||
|
tahun: currentYear.value,
|
||||||
|
// regional: '',
|
||||||
idUlp: 0,
|
idUlp: 0,
|
||||||
idUid: 0,
|
idUid: 0,
|
||||||
idUp3: 0,
|
idUp3: 0
|
||||||
bulan: 10,
|
|
||||||
tahun: 2023
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const filterData = (params: any) => {
|
const filterData = (params: any) => {
|
||||||
const { regional, ulp, uid, up3, bulan, tahun } = params
|
const { regional, ulp, uid, up3, bulan, tahun } = params
|
||||||
|
|
||||||
|
currentMonth.value = bulan.id
|
||||||
|
currentYear.value = tahun.id
|
||||||
|
lastYear.value = tahun.id - 1
|
||||||
|
|
||||||
refetch({
|
refetch({
|
||||||
regional: regional,
|
// regional: regional,
|
||||||
idUlp: ulp ? ulp.id : 0,
|
idUlp: ulp ? ulp.id : 0,
|
||||||
idUid: uid ? uid.id : 0,
|
idUid: uid ? uid.id : 0,
|
||||||
idUp3: up3 ? up3.id : 0,
|
idUp3: up3 ? up3.id : 0,
|
||||||
bulan: bulan ? bulan.id : 10,
|
bulan: bulan ? bulan.id : currentMonth.value,
|
||||||
tahun: bulan ? tahun.id : 2023
|
tahun: bulan ? tahun.id : currentYear.value
|
||||||
})
|
})
|
||||||
|
|
||||||
onResult((queryResult) => {
|
onResult((queryResult) => {
|
||||||
if (queryResult.data != undefined) {
|
if (queryResult.data != undefined) {
|
||||||
data.value = queryResult.data.monalisaRekapitulasiKeluhanBelumSelesai
|
data.value = queryResult.data.monalisaRekapitulasiKeluhanBelumSelesai
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(queryResult.data)
|
console.log(queryResult.data)
|
||||||
console.log(queryResult.loading)
|
console.log(queryResult.loading)
|
||||||
console.log(queryResult.networkStatus)
|
console.log(queryResult.networkStatus)
|
||||||
})
|
})
|
||||||
|
|
||||||
onError((error) => {
|
onError((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const filters = ref()
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (import.meta.env.DEV) {
|
||||||
|
data.value = [
|
||||||
|
{
|
||||||
|
nama_regional: 'REGIONAL SUMKAL',
|
||||||
|
id_uid: 120,
|
||||||
|
nama_uid: 'WILAYAH SUMATERA UTARA',
|
||||||
|
id_up3: 12100,
|
||||||
|
nama_up3: 'UP3 PEMATANG SIANTAR',
|
||||||
|
id_ulp: 12102,
|
||||||
|
nama_ulp: 'ULP LIMA PULUH',
|
||||||
|
jumlah_keluhan: 12,
|
||||||
|
jumlah_informasi: 0,
|
||||||
|
total: 12
|
||||||
|
},
|
||||||
|
{
|
||||||
|
nama_regional: 'REGIONAL SULMAPANA',
|
||||||
|
id_uid: 41,
|
||||||
|
nama_uid: 'WILAYAH MALUKU DAN MALUKU UTARA',
|
||||||
|
id_up3: 412,
|
||||||
|
nama_up3: 'UP3 TERNATE',
|
||||||
|
id_ulp: 41230,
|
||||||
|
nama_ulp: 'ULP BACAN',
|
||||||
|
jumlah_keluhan: 4,
|
||||||
|
jumlah_informasi: 0,
|
||||||
|
total: 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
nama_regional: 'REGIONAL JMB',
|
||||||
|
id_uid: 101,
|
||||||
|
nama_uid: 'DISTRIBUSI JAWA TENGAH & DIY',
|
||||||
|
id_up3: 52150,
|
||||||
|
nama_up3: 'UP3 MAGELANG',
|
||||||
|
id_ulp: 52156,
|
||||||
|
nama_ulp: 'ULP PARAKAN',
|
||||||
|
jumlah_keluhan: 37,
|
||||||
|
jumlah_informasi: 0,
|
||||||
|
total: 37
|
||||||
|
},
|
||||||
|
{
|
||||||
|
nama_regional: 'REGIONAL SULMAPANA',
|
||||||
|
id_uid: 41,
|
||||||
|
nama_uid: 'WILAYAH MALUKU DAN MALUKU UTARA',
|
||||||
|
id_up3: 412,
|
||||||
|
nama_up3: 'UP3 TERNATE',
|
||||||
|
id_ulp: 41230,
|
||||||
|
nama_ulp: 'ULP BACAN',
|
||||||
|
jumlah_keluhan: 4,
|
||||||
|
jumlah_informasi: 0,
|
||||||
|
total: 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
nama_regional: 'REGIONAL JMB',
|
||||||
|
id_uid: 101,
|
||||||
|
nama_uid: 'DISTRIBUSI JAWA TENGAH & DIY',
|
||||||
|
id_up3: 52150,
|
||||||
|
nama_up3: 'UP3 MAGELANG',
|
||||||
|
id_ulp: 52156,
|
||||||
|
nama_ulp: 'ULP PARAKAN',
|
||||||
|
jumlah_keluhan: 37,
|
||||||
|
jumlah_informasi: 0,
|
||||||
|
total: 37
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user