Merge branch 'dev' into feat/consultation-82
This commit is contained in:
No files matched your search
@@ -30,8 +30,10 @@ import {
|
||||
} from '~/handlers/unit.handler'
|
||||
|
||||
// Services
|
||||
import { getUnits, getUnitDetail } from '~/services/unit.service'
|
||||
import { getList, getDetail } from '~/services/unit.service'
|
||||
import { getValueLabelList as getInstallationList } from '~/services/installation.service'
|
||||
|
||||
const installations = ref<{ value: string; label: string }[]>([])
|
||||
const title = ref('')
|
||||
|
||||
const {
|
||||
@@ -43,8 +45,13 @@ const {
|
||||
handleSearch,
|
||||
fetchData: getUnitList,
|
||||
} = usePaginatedList({
|
||||
fetchFn: async ({ page, search }) => {
|
||||
const result = await getUnits({ search, page })
|
||||
fetchFn: async (params: any) => {
|
||||
const result = await getList({
|
||||
search: params.search,
|
||||
'page-number': params['page-number'] || 0,
|
||||
'page-size': params['page-size'] || 10,
|
||||
includes: 'installation',
|
||||
})
|
||||
return { success: result.success || false, body: result.body || {} }
|
||||
},
|
||||
entityName: 'unit',
|
||||
@@ -82,7 +89,7 @@ provide('rec_item', recItem)
|
||||
provide('table_data_loader', isLoading)
|
||||
|
||||
const getCurrentUnitDetail = async (id: number | string) => {
|
||||
const result = await getUnitDetail(id)
|
||||
const result = await getDetail(id)
|
||||
if (result.success) {
|
||||
const currentValue = result.body?.data || {}
|
||||
recItem.value = currentValue
|
||||
@@ -110,6 +117,7 @@ watch([recId, recAction], () => {
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
installations.value = await getInstallationList()
|
||||
await getUnitList()
|
||||
})
|
||||
</script>
|
||||
@@ -127,6 +135,7 @@ onMounted(async () => {
|
||||
<Dialog v-model:open="isFormEntryDialogOpen" :title="!!recItem ? title : 'Tambah Unit'" size="lg" prevent-outside>
|
||||
<AppUnitEntryForm
|
||||
:schema="UnitSchema"
|
||||
:installations="installations"
|
||||
:values="recItem"
|
||||
:is-loading="isProcessing"
|
||||
:is-readonly="isReadonly"
|
||||
|
||||
Reference in New Issue
Block a user