From fcabbc25ff4d269b355e6c159e79900ea5271ad1 Mon Sep 17 00:00:00 2001 From: riefive Date: Wed, 24 Sep 2025 15:34:38 +0700 Subject: [PATCH] fix: adjustment list and entry for material --- app/components/app/equipment/entry-form.vue | 47 ++++++++------------- app/components/app/equipment/list-cfg.ts | 20 +++------ app/components/app/tools/entry-form.vue | 5 +++ app/components/app/tools/list-cfg.ts | 6 +-- app/components/content/equipment/list.vue | 5 ++- 5 files changed, 35 insertions(+), 48 deletions(-) diff --git a/app/components/app/equipment/entry-form.vue b/app/components/app/equipment/entry-form.vue index 2485022a..04fe56ea 100644 --- a/app/components/app/equipment/entry-form.vue +++ b/app/components/app/equipment/entry-form.vue @@ -5,6 +5,11 @@ import type { MaterialFormData } from '~/schemas/material' // helpers import { useForm } from 'vee-validate' import { toTypedSchema } from '@vee-validate/zod' +// components +import Block from '~/components/pub/custom-ui/doc-entry/block.vue' +import Cell from '~/components/pub/custom-ui/doc-entry/cell.vue' +import Field from '~/components/pub/custom-ui/doc-entry/field.vue' +import Label from '~/components/pub/custom-ui/doc-entry/label.vue' interface Props { schema: z.ZodSchema @@ -18,7 +23,7 @@ const emit = defineEmits<{ cancel: [resetForm: () => void] }>() -const { handleSubmit, defineField, errors } = useForm({ +const { handleSubmit, defineField, errors, meta } = useForm({ validationSchema: toTypedSchema(props.schema), initialValues: { code: '', @@ -40,12 +45,12 @@ const resetForm = () => { stock.value = 0 } -function onSubmitForm(values: any) { +function onSubmitForm() { const formData: MaterialFormData = { - name: values.name || '', - code: values.code || '', - uom_code: values.uom_code || '', - stock: values.stock || 0, + name: name.value || '', + code: code.value || '', + uom_code: uom.value || '', + stock: stock.value || 0, } emit('submit', formData, resetForm) } @@ -57,27 +62,17 @@ function onCancelForm() {