Update import statement for getDataRowGroup in RGangguan_ALL and RGangguan_KTI

This commit is contained in:
Dede Fuji Abdul 2024-04-01 10:41:35 +07:00
parent e97805be5a
commit 948895dfb5
3 changed files with 43 additions and 2 deletions

View File

@ -1081,7 +1081,7 @@ import {
exportDetailToPDF,
exportDetailToXLSX
} from '@/report/Gangguan/Rekap/RGangguan_ALL'
import { getDataRowGroup } from '@/utils/data'
import { getDataRowGroup } from '@/utils/helper'
const client = apolloClient()
provideApolloClient(client)
@ -1561,3 +1561,4 @@ onMounted(() => {
}
})
</script>
@/utils/helper

View File

@ -1134,7 +1134,7 @@ import {
exportDetailToXLSX
} from '@/report/Gangguan/Rekap/RGangguan_KTI'
import { getMonthNumber } from '@/utils/texts'
import { getDataRowGroup } from '@/utils/data'
import { getDataRowGroup } from '@/utils/helper'
const client = apolloClient()
provideApolloClient(client)
const position = { of: '#data' }
@ -1659,3 +1659,4 @@ onMounted(() => {
}
})
</script>
@/utils/helper

39
src/utils/helper.ts Normal file
View File

@ -0,0 +1,39 @@
export const getDataRowGroup = (data: any): any => {
if (Array.isArray(data)) {
if (data[0].items) {
if (Array.isArray(data[0].items)) {
return getDataRowGroup(data[0].items[0])
} else {
return getDataRowGroup(data[0].items)
}
} else if (data[0].collapsedItems) {
if (Array.isArray(data[0].collapsedItems)) {
return getDataRowGroup(data[0].collapsedItems[0])
} else {
return getDataRowGroup(data[0].collapsedItems)
}
} else {
if (Array.isArray(data[0])) {
return getDataRowGroup(data[0])
} else {
return getDataRowGroup(data)
}
}
} else {
if (data.items) {
if (Array.isArray(data.items)) {
return getDataRowGroup(data.items[0])
} else {
return getDataRowGroup(data.items)
}
} else if (data.collapsedItems) {
if (Array.isArray(data.collapsedItems)) {
return getDataRowGroup(data.collapsedItems[0])
} else {
return getDataRowGroup(data.collapsedItems)
}
} else {
return data
}
}
}