feat(division): restructure division parent
This commit is contained in:
@@ -50,8 +50,8 @@ const {
|
|||||||
// TODO: use pagination params
|
// TODO: use pagination params
|
||||||
const result = await getDivisions({
|
const result = await getDivisions({
|
||||||
search: params.search,
|
search: params.search,
|
||||||
// page: params['page-number'] || 0,
|
'page-number': params['page-number'] || 0,
|
||||||
page_size: params['page-size'] || 100,
|
'page-size': params['page-size'] || 100,
|
||||||
includes: 'parent,childrens',
|
includes: 'parent,childrens',
|
||||||
})
|
})
|
||||||
return { success: result.success || false, body: result.body || {} }
|
return { success: result.success || false, body: result.body || {} }
|
||||||
@@ -118,10 +118,22 @@ watch([recId, recAction], () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(() => data.value, async () => {
|
watch(
|
||||||
if (!data.value) return
|
() => data.value,
|
||||||
divisionsTrees.value = convertDivisionToTreeItems(data.value || [])
|
async () => {
|
||||||
})
|
if (!data.value) return
|
||||||
|
const result = await getDivisions({
|
||||||
|
'page-size': 100,
|
||||||
|
'only-have-children': false,
|
||||||
|
includes: 'parent,childrens',
|
||||||
|
})
|
||||||
|
if (result.success) {
|
||||||
|
const currentData = result.body.data || []
|
||||||
|
console.log(currentData)
|
||||||
|
divisionsTrees.value = convertDivisionToTreeItems(currentData || [])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getDivisionList()
|
await getDivisionList()
|
||||||
@@ -137,7 +149,7 @@ onMounted(async () => {
|
|||||||
class="mb-4 xl:mb-5"
|
class="mb-4 xl:mb-5"
|
||||||
/>
|
/>
|
||||||
<AppDivisionList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
<AppDivisionList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||||
|
|
||||||
<Dialog v-model:open="isFormEntryDialogOpen" :title="!!recItem ? title : 'Tambah Divisi'" size="lg" prevent-outside>
|
<Dialog v-model:open="isFormEntryDialogOpen" :title="!!recItem ? title : 'Tambah Divisi'" size="lg" prevent-outside>
|
||||||
<AppDivisionEntryForm
|
<AppDivisionEntryForm
|
||||||
:schema="DivisionSchema"
|
:schema="DivisionSchema"
|
||||||
|
|||||||
Reference in New Issue
Block a user