Refactor month selection logic and improve code readability
This commit is contained in:
parent
7d9f09c236
commit
76e3cd546c
@ -155,7 +155,7 @@
|
|||||||
</DxColumn>
|
</DxColumn>
|
||||||
|
|
||||||
<template #formatText="{ data }">
|
<template #formatText="{ data }">
|
||||||
<p class="text-left cursor-pointer">
|
<p class="text-left cursor-pointer" @click="setMonth('')">
|
||||||
{{ data.text }}
|
{{ data.text }}
|
||||||
</p>
|
</p>
|
||||||
</template>
|
</template>
|
||||||
@ -461,7 +461,8 @@ const dialogDetail = ref(false)
|
|||||||
const closedialogDetail = () => (dialogDetail.value = false)
|
const closedialogDetail = () => (dialogDetail.value = false)
|
||||||
const loadingData = ref(false)
|
const loadingData = ref(false)
|
||||||
const loadingSubData = ref(false)
|
const loadingSubData = ref(false)
|
||||||
const monthSelected = ref(1)
|
const monthSelected = ref<any>(null)
|
||||||
|
const agreeToShowDialog = ref(false)
|
||||||
const reportMeta = ref({
|
const reportMeta = ref({
|
||||||
uid: { id: 0, name: 'Semua Unit Induk Distribusi/Wilayah' },
|
uid: { id: 0, name: 'Semua Unit Induk Distribusi/Wilayah' },
|
||||||
up3: { id: 0, name: 'Semua Unit Pelaksanaan Pelayanan Pelanggan' },
|
up3: { id: 0, name: 'Semua Unit Pelaksanaan Pelayanan Pelanggan' },
|
||||||
@ -470,7 +471,11 @@ const reportMeta = ref({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const setMonth = (month: any) => {
|
const setMonth = (month: any) => {
|
||||||
|
if (month != '') {
|
||||||
monthSelected.value = getMonthNumber(month)
|
monthSelected.value = getMonthNumber(month)
|
||||||
|
} else {
|
||||||
|
monthSelected.value = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterData = async (params: any) => {
|
const filterData = async (params: any) => {
|
||||||
@ -545,19 +550,18 @@ const clearSelection = () => {
|
|||||||
const showDetail = () => {
|
const showDetail = () => {
|
||||||
clearSelection()
|
clearSelection()
|
||||||
dataSubSelected.value = null
|
dataSubSelected.value = null
|
||||||
|
if (monthSelected.value != null) {
|
||||||
dialogDetail.value = true
|
dialogDetail.value = true
|
||||||
getDetail()
|
getDetail()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const onDataSelectionChanged = ({ selectedRowsData }: any) => {
|
const onDataSelectionChanged = ({ selectedRowsData }: any) => {
|
||||||
// wait for 2 seconds
|
|
||||||
setTimeout(() => {
|
|
||||||
if (selectedRowsData[0] != undefined) {
|
if (selectedRowsData[0] != undefined) {
|
||||||
console.log('monthSelected', monthSelected.value)
|
console.log('monthSelected', monthSelected.value)
|
||||||
dataSelected.value = selectedRowsData[0]
|
dataSelected.value = selectedRowsData[0]
|
||||||
showDetail()
|
showDetail()
|
||||||
}
|
}
|
||||||
}, 2000)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const onDataSubSelectionChanged = ({ selectedRowsData }: any) => {
|
const onDataSubSelectionChanged = ({ selectedRowsData }: any) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user