feat(material): retest material

This commit is contained in:
riefive
2025-09-19 16:08:42 +07:00
parent 70378a69e9
commit 8aa6d3b6f8
4 changed files with 30 additions and 23 deletions

No files matched your search

+16 -13
View File
@@ -7,6 +7,9 @@ import Header from '~/components/pub/custom-ui/nav-header/prep.vue'
import AppEquipmentEntryForm from '~/components/app/equipment/entry-form.vue'
import RecordConfirmation from '~/components/pub/custom-ui/confirmation/record-confirmation.vue'
// Types
import type { Uom } from '~/models/uom'
// Handlers
import {
recId,
@@ -23,16 +26,7 @@ import {
import { getSourceMaterials, getSourceMaterialDetail } from '~/services/material.service'
import { getSourceUoms } from '~/services/uom.service'
const uoms = [
{ value: 'uom-1', label: 'Satuan 1' },
{ value: 'uom-2', label: 'Satuan 2' },
{ value: 'uom-3', label: 'Satuan 3' },
]
const items = [
{ value: 'item-1', label: 'Item 1' },
{ value: 'item-2', label: 'Item 2' },
{ value: 'item-3', label: 'Item 3' },
]
const uoms = ref<{ value: string; label: string }[]>([])
const getEquipmentDetail = async (id: number | string) => {
const result = await getSourceMaterialDetail(id)
@@ -42,6 +36,13 @@ const getEquipmentDetail = async (id: number | string) => {
}
}
const getUomList = async () => {
const result = await getSourceUoms()
if (result.success) {
uoms.value = result.data.map((uom: Uom) => ({ value: uom.code || uom.erp_id, label: uom.name }))
}
}
const {
data,
isLoading,
@@ -51,7 +52,10 @@ const {
handleSearch,
fetchData: getEquipmentList,
} = usePaginatedList({
fetchFn: getSourceMaterials as any,
fetchFn: async ({ page }) => {
const result = await getSourceMaterials({ page })
return result.data || []
},
entityName: 'equipment',
})
@@ -100,7 +104,7 @@ watch(recId, () => {
})
onMounted(async () => {
await getSourceUoms()
await getUomList();
})
</script>
@@ -115,7 +119,6 @@ onMounted(async () => {
<AppEquipmentEntryForm
:schema="MaterialSchema"
:uoms="uoms"
:items="items"
@submit="(values: MaterialFormData, resetForm: any) => handleActionSave(values, getEquipmentList, resetForm)"
@cancel="handleCancelForm"
/>