fix: update list division + equipment
This commit is contained in:
@@ -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 || [])
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user