Refactor code to fix variable names and improve readability
This commit is contained in:
@@ -41,36 +41,15 @@
|
||||
<DxColumnFixing :enabled="true" />
|
||||
|
||||
<DxColumn
|
||||
v-if="grouping.length > 0"
|
||||
v-for="(group, index) in grouping"
|
||||
:width="150"
|
||||
alignment="center"
|
||||
:min-width="170"
|
||||
data-type="text"
|
||||
data-field="nama_regional"
|
||||
caption="Regional"
|
||||
:data-field="group.data"
|
||||
:caption="group.caption"
|
||||
css-class="custom-table-column"
|
||||
:group-index="0"
|
||||
name="namaRegional"
|
||||
/>
|
||||
<DxColumn
|
||||
alignment="center"
|
||||
:min-width="170"
|
||||
data-type="text"
|
||||
data-field="id_uid"
|
||||
caption="UID"
|
||||
css-class="custom-table-column"
|
||||
:group-index="1"
|
||||
name="namaUID"
|
||||
:calculate-group-value="(rowData: any) => rowData.nama_uid"
|
||||
/>
|
||||
<DxColumn
|
||||
alignment="center"
|
||||
:min-width="170"
|
||||
data-type="text"
|
||||
data-field="id_up3"
|
||||
caption="UP3"
|
||||
css-class="custom-table-column"
|
||||
:group-index="1"
|
||||
name="namaUID"
|
||||
:calculate-group-value="(rowData: any) => rowData.nama_up3"
|
||||
cell-template="formatText"
|
||||
:group-index="index"
|
||||
/>
|
||||
<DxColumn
|
||||
alignment="center"
|
||||
@@ -1158,7 +1137,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||
import { DxDataGrid } from 'devextreme-vue'
|
||||
@@ -1166,7 +1145,6 @@ import {
|
||||
DxColumn,
|
||||
DxColumnFixing,
|
||||
DxExport,
|
||||
DxLoadPanel,
|
||||
DxPaging,
|
||||
DxScrolling,
|
||||
DxSearchPanel,
|
||||
@@ -1191,9 +1169,7 @@ import {
|
||||
exportToXLSX,
|
||||
exportDetailToPDF,
|
||||
exportDetailToXLSX,
|
||||
exportToDOCX,
|
||||
exportDetailToDOCX,
|
||||
|
||||
exportToDOCX
|
||||
} from '@/report/Monalisa/Laporan/Bulanan/MonalisaLB_PenurunanJumlahKomplain'
|
||||
import { formatWaktu } from '@/components/Form/FiltersType/reference'
|
||||
|
||||
@@ -1228,6 +1204,20 @@ const reportMeta = ref({
|
||||
currentYear: currentYear.value,
|
||||
lastYear: lastYear.value
|
||||
})
|
||||
const grouping = ref<any[]>([
|
||||
{
|
||||
data: 'nama_regional',
|
||||
caption: 'Regional'
|
||||
},
|
||||
{
|
||||
data: 'nama_uid',
|
||||
caption: 'UID'
|
||||
},
|
||||
{
|
||||
data: 'nama_up3',
|
||||
caption: 'UP3'
|
||||
}
|
||||
])
|
||||
const parameterRequest = ref<any>({
|
||||
type: null,
|
||||
tahun: new Date().getFullYear(),
|
||||
@@ -1337,6 +1327,46 @@ const filterData = async (params: any) => {
|
||||
resetData()
|
||||
const { regional, ulp, uid, up3, bulan, tahun } = params
|
||||
|
||||
var groupList: any[] = [
|
||||
{
|
||||
data: 'nama_regional',
|
||||
caption: 'Regional'
|
||||
},
|
||||
{
|
||||
data: 'nama_uid',
|
||||
caption: 'UID'
|
||||
},
|
||||
{
|
||||
data: 'nama_up3',
|
||||
caption: 'UP3'
|
||||
}
|
||||
]
|
||||
|
||||
if (uid?.id != 0) {
|
||||
groupList.forEach((item, index) => {
|
||||
if (item.caption == 'Regional') {
|
||||
groupList.splice(index, 1)
|
||||
}
|
||||
})
|
||||
|
||||
if (up3?.id != 0) {
|
||||
groupList.forEach((item, index) => {
|
||||
if (item.caption == 'UID') {
|
||||
groupList.splice(index, 1)
|
||||
}
|
||||
})
|
||||
|
||||
if (ulp?.id != 0) {
|
||||
groupList.forEach((item, index) => {
|
||||
if (item.caption == 'UP3') {
|
||||
groupList.splice(index, 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
grouping.value = groupList
|
||||
|
||||
currentMonth.value = bulan.id
|
||||
currentYear.value = tahun.id
|
||||
lastYear.value = tahun.id - 1
|
||||
|
||||
Reference in New Issue
Block a user