chore: add shared handlers
This commit is contained in:
@@ -13,7 +13,6 @@ import { toast } from '~/components/pub/ui/toast'
|
||||
// Types
|
||||
import { ActionEvents, type HeaderPrep } from '~/components/pub/custom-ui/data/types'
|
||||
import { DeviceSchema, type DeviceFormData } from '~/schemas/device.schema'
|
||||
import type { Uom } from '~/models/uom'
|
||||
|
||||
// Handlers
|
||||
import {
|
||||
@@ -29,12 +28,11 @@ import {
|
||||
handleActionRemove,
|
||||
handleCancelForm,
|
||||
} from '~/handlers/device.handler'
|
||||
import { uoms, getUomList } from "~/handlers/_shared.handler"
|
||||
|
||||
// Services
|
||||
import { getDevices, getDeviceDetail } from '~/services/device.service'
|
||||
import { getUoms } from '~/services/uom.service'
|
||||
|
||||
const uoms = ref<{ value: string; label: string }[]>([])
|
||||
const title = ref('')
|
||||
|
||||
const {
|
||||
@@ -96,14 +94,6 @@ const getCurrentToolsDetail = async (id: number | string) => {
|
||||
}
|
||||
}
|
||||
|
||||
const getUomList = async () => {
|
||||
const result = await getUoms()
|
||||
if (result.success) {
|
||||
const currentUoms = result.body?.data || []
|
||||
uoms.value = currentUoms.map((uom: Uom) => ({ value: uom.code || uom.erp_id, label: uom.name }))
|
||||
}
|
||||
}
|
||||
|
||||
// Watch for row actions
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
|
||||
Reference in New Issue
Block a user