Refactor RKeluhan_PerFungsiBidang.vue to update getDetail function and remove unused variables
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
|
||||
<div>
|
||||
<DxDataGrid
|
||||
@cell-click=""
|
||||
@cell-click="onCellClicked"
|
||||
ref="dataGridRef"
|
||||
:allow-column-reordering="true"
|
||||
class="max-h-[calc(100vh-140px)] mb-10"
|
||||
@ -27,7 +27,7 @@
|
||||
column-resizing-mode="widget"
|
||||
>
|
||||
<DxPaging :enabled="false" />
|
||||
<DxGrouping :auto-expand-all="false" :context-menu-enabled="true" expand-mode="rowClick" />
|
||||
<DxGrouping :auto-expand-all="false" :context-menu-enabled="true" expand-mode="" />
|
||||
<DxSelection mode="single" />
|
||||
|
||||
<DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
|
||||
@ -66,7 +66,7 @@
|
||||
data-type="number"
|
||||
caption="Total"
|
||||
css-class="custom-table-column"
|
||||
cell-template="formatNumber"
|
||||
cell-template="formatNumberTotal"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="150"
|
||||
@ -75,7 +75,7 @@
|
||||
data-type="number"
|
||||
caption="Selesai"
|
||||
css-class="custom-table-column"
|
||||
cell-template="formatNumber"
|
||||
cell-template="formatNumberSelesai"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="70"
|
||||
@ -93,7 +93,7 @@
|
||||
data-type="number"
|
||||
caption="InProgress"
|
||||
css-class="custom-table-column"
|
||||
cell-template="formatNumber"
|
||||
cell-template="formatNumberProgress"
|
||||
/>
|
||||
<DxColumn
|
||||
:width="70"
|
||||
@ -412,13 +412,49 @@
|
||||
</DxSummary>
|
||||
|
||||
<template #formatTime="{ data }">
|
||||
<p class="cursor-pointer !text-right">
|
||||
<p class="!text-right">
|
||||
{{ parseInt(data.text) ? formatWaktu(data.text) : '-' }}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<template #formatNumber="{ data }">
|
||||
<p class="text-right cursor-pointer">
|
||||
<p class="text-right">
|
||||
{{
|
||||
isNumber(data.text)
|
||||
? data.column.caption == '%'
|
||||
? formatPercentage(data.text)
|
||||
: formatNumber(data.text)
|
||||
: data.text
|
||||
}}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<template #formatNumberTotal="{ data }">
|
||||
<p class="text-right cursor-pointer" @click="setAgreementDialog(data.column.caption)">
|
||||
{{
|
||||
isNumber(data.text)
|
||||
? data.column.caption == '%'
|
||||
? formatPercentage(data.text)
|
||||
: formatNumber(data.text)
|
||||
: data.text
|
||||
}}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<template #formatNumberSelesai="{ data }">
|
||||
<p class="text-right cursor-pointer" @click="setAgreementDialog(data.column.caption)">
|
||||
{{
|
||||
isNumber(data.text)
|
||||
? data.column.caption == '%'
|
||||
? formatPercentage(data.text)
|
||||
: formatNumber(data.text)
|
||||
: data.text
|
||||
}}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<template #formatNumberProgress="{ data }">
|
||||
<p class="text-right cursor-pointer" @click="setAgreementDialog(data.column.caption)">
|
||||
{{
|
||||
isNumber(data.text)
|
||||
? data.column.caption == '%'
|
||||
@ -430,7 +466,7 @@
|
||||
</template>
|
||||
|
||||
<template #formatText="{ data }">
|
||||
<p class="cursor-pointer !text-left">
|
||||
<p class="!text-left">
|
||||
{{ data.text }}
|
||||
</p>
|
||||
</template>
|
||||
@ -804,6 +840,7 @@ import {
|
||||
exportDetailToDOCX
|
||||
} from '@/report/Keluhan/Rekap/RKeluhan_ALL'
|
||||
import BufferDialog from '@/components/Dialogs/BufferDialog.vue'
|
||||
import { getDataRowGroup } from '@/utils/helper'
|
||||
|
||||
const client = apolloClient()
|
||||
provideApolloClient(client)
|
||||
@ -968,47 +1005,50 @@ const calculateCustomSummary = (options: any) => {
|
||||
|
||||
const onCellClicked = (e: any) => {
|
||||
console.log('cell clicked', e)
|
||||
// console.log('group cell clicked', e.column.caption)
|
||||
// console.log('value', e.values[e.row.groupIndex])
|
||||
if (e.rowType == 'group') {
|
||||
groupDialog.value = true
|
||||
groupIndex.value = e.row.groupIndex
|
||||
|
||||
setAgreementDialog(e.column.caption)
|
||||
if (e.row.groupIndex == 0) {
|
||||
//
|
||||
} else if (e.row.groupIndex == 1) {
|
||||
if (e.row.isExpanded) {
|
||||
const data = e.data.items[0].collapsedItems[0].items[0]
|
||||
groupData.value = data
|
||||
} else {
|
||||
const data = e.data.collapsedItems[0].items[0].items[0]
|
||||
groupData.value = data
|
||||
}
|
||||
} else if (e.row.groupIndex == 2) {
|
||||
if (e.row.isExpanded) {
|
||||
const data = e.data.items[0].collapsedItems[0]
|
||||
groupData.value = data
|
||||
} else {
|
||||
const data = e.data.collapsedItems[0].items[0]
|
||||
groupData.value = data
|
||||
}
|
||||
} else if (e.row.groupIndex == 3) {
|
||||
if (e.row.isExpanded) {
|
||||
const data = e.data.items[0]
|
||||
groupData.value = data
|
||||
} else {
|
||||
const data = e.data.collapsedItems[0]
|
||||
groupData.value = data
|
||||
}
|
||||
}
|
||||
const data = getDataRowGroup(e.data)
|
||||
console.table(data)
|
||||
groupData.value = data
|
||||
showDetail()
|
||||
// if (e.row.groupIndex == 0) {
|
||||
// //
|
||||
// } else if (e.row.groupIndex == 1) {
|
||||
// if (e.row.isExpanded) {
|
||||
// const data = e.data.items[0].collapsedItems[0].items[0]
|
||||
// groupData.value = data
|
||||
// } else {
|
||||
// const data = e.data.collapsedItems[0].items[0].items[0]
|
||||
// groupData.value = data
|
||||
// }
|
||||
// } else if (e.row.groupIndex == 2) {
|
||||
// if (e.row.isExpanded) {
|
||||
// const data = e.data.items[0].collapsedItems[0]
|
||||
// groupData.value = data
|
||||
// } else {
|
||||
// const data = e.data.collapsedItems[0].items[0]
|
||||
// groupData.value = data
|
||||
// }
|
||||
// } else if (e.row.groupIndex == 3) {
|
||||
// if (e.row.isExpanded) {
|
||||
// const data = e.data.items[0]
|
||||
// groupData.value = data
|
||||
// } else {
|
||||
// const data = e.data.collapsedItems[0]
|
||||
// groupData.value = data
|
||||
// }
|
||||
// }
|
||||
// showDetail()
|
||||
} else {
|
||||
groupDialog.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const setAgreementDialog = (column: string) => {
|
||||
if (column == 'Total' || column == 'Selesai' || column == 'In Progress') {
|
||||
if (column == 'Total' || column == 'Selesai' || column == 'InProgress') {
|
||||
agreeToShowDialog.value = true
|
||||
if (column == 'Total') {
|
||||
progressSelected.value = 0
|
||||
|
@ -1331,19 +1331,15 @@ const getDetail = async () => {
|
||||
idUlp: selected?.id_ulp ? selected?.id_ulp : 0,
|
||||
idUid: selected?.id_uid ? selected?.id_uid : 0,
|
||||
idUp3: selected?.id_up3 ? selected?.id_up3 : 0,
|
||||
namaRegional: selected?.nama_regional ? selected?.nama_regional : '',
|
||||
isSelesai: progressSelected.value,
|
||||
media: '',
|
||||
tanggal: '',
|
||||
namaIssuetype: '',
|
||||
namaSubissuetype: ''
|
||||
namaFungsiBidang: selected?.fungsi_bidang ? selected?.fungsi_bidang : ''
|
||||
}
|
||||
|
||||
loadingSubData.value = true
|
||||
await requestGraphQl(queries.keluhan.rekap.rekapKeluhanAllDetail, query)
|
||||
await requestGraphQl(queries.keluhan.rekap.keluhanPenyelesaianPerFungsiBidangDetail, query)
|
||||
.then((result) => {
|
||||
if (result.data.data != undefined) {
|
||||
dataSub.value = result.data.data.detailKeluhanAll
|
||||
dataSub.value = result.data.data.detailRekapitulasiKeluhanPerBidang
|
||||
} else {
|
||||
dataSub.value = []
|
||||
}
|
||||
|
@ -1131,7 +1131,7 @@ const getDetail = async () => {
|
||||
const dateValue = filters.value.periode.split(' s/d ')
|
||||
const selected = dataSelected.value
|
||||
|
||||
const query = {
|
||||
var query = {
|
||||
dateFrom: dateValue[0]
|
||||
? dateValue[0].split('-').reverse().join('-')
|
||||
: new Date().toISOString().slice(0, 10),
|
||||
@ -1139,7 +1139,7 @@ const getDetail = async () => {
|
||||
? dateValue[1].split('-').reverse().join('-')
|
||||
: new Date().toISOString().slice(0, 10),
|
||||
idUlp: 0,
|
||||
idUid: isGroupBy.value ? (selected?.id_uid ? selected?.id_uid : 0) : 0,
|
||||
idUid: 0,
|
||||
idUp3: 0,
|
||||
namaRegional: '',
|
||||
isSelesai: progressSelected.value,
|
||||
@ -1149,6 +1149,31 @@ const getDetail = async () => {
|
||||
namaSubissuetype: ''
|
||||
}
|
||||
|
||||
if (isGroupBy.value) {
|
||||
if (grouping.value[0].data == 'nama_uid') {
|
||||
query = {
|
||||
...query,
|
||||
idUid: selected?.id_uid ? selected?.id_uid : 0,
|
||||
idUp3: 0,
|
||||
idUlp: 0
|
||||
}
|
||||
} else if (grouping.value[0].data == 'nama_up3') {
|
||||
query = {
|
||||
...query,
|
||||
idUid: selected?.id_uid ? selected?.id_uid : 0,
|
||||
idUp3: selected?.id_up3 ? selected?.id_up3 : 0,
|
||||
idUlp: 0
|
||||
}
|
||||
} else {
|
||||
query = {
|
||||
...query,
|
||||
idUid: selected?.id_uid ? selected?.id_uid : 0,
|
||||
idUp3: selected?.id_up3 ? selected?.id_up3 : 0,
|
||||
idUlp: selected?.id_ulp ? selected?.id_ulp : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadingSubData.value = true
|
||||
await requestGraphQl(queries.keluhan.rekap.rekapKeluhanAllDetail, query)
|
||||
.then((result) => {
|
||||
|
Reference in New Issue
Block a user