fix: update list division + equipment

This commit is contained in:
riefive
2025-10-06 10:45:15 +07:00
parent d1bcd6e66c
commit 3003ec9d80
4 changed files with 37 additions and 34 deletions
+6 -8
View File
@@ -29,10 +29,9 @@ import {
handleActionRemove,
handleCancelForm,
} from '~/handlers/division.handler'
import { convertDivisionToTreeItems } from '~/handlers/_shared.handler'
// Services
import { getDivisions, getDivisionDetail } from '~/services/division.service'
import { getList, getDetail, getValueTreeItems } from '~/services/division.service'
const divisionsTrees = ref<TreeItem[]>([])
const title = ref('')
@@ -47,11 +46,10 @@ const {
fetchData: getDivisionList,
} = usePaginatedList({
fetchFn: async (params: any) => {
// TODO: use pagination params
const result = await getDivisions({
const result = await getList({
search: params.search,
'page-number': params['page-number'] || 0,
'page-size': params['page-size'] || 100,
'page-size': params['page-size'] || 10,
includes: 'parent,childrens',
})
return { success: result.success || false, body: result.body || {} }
@@ -91,7 +89,7 @@ provide('rec_item', recItem)
provide('table_data_loader', isLoading)
const getCurrentDivisionDetail = async (id: number | string) => {
const result = await getDivisionDetail(id)
const result = await getDetail(id)
if (result.success) {
const currentValue = result.body?.data || {}
recItem.value = currentValue
@@ -122,14 +120,14 @@ watch(
() => data.value,
async () => {
if (!data.value) return
const result = await getDivisions({
const result = await getList({
'page-size': 100,
'only-have-children': false,
includes: 'parent,childrens',
})
if (result.success) {
const currentData = result.body.data || []
divisionsTrees.value = convertDivisionToTreeItems(currentData || [])
divisionsTrees.value = getValueTreeItems(currentData || [])
}
},
)