This commit is contained in:
zc
2026-03-17 10:47:57 +08:00
parent 5554cf1548
commit 722fbd988c
16 changed files with 700 additions and 27 deletions

View File

@@ -19,6 +19,8 @@ import { useWindowSize } from '@vueuse/core'
import { addMaterialInfo, getMaterialInfo, updateMaterialInfo } from '@/apis/material/materialInfo'
import { type ColumnItem, GiForm } from '@/components/GiForm'
import { useResetReactive } from '@/hooks'
import { materialType } from "@/hooks/app/materialType";
import {materialProcess} from "@/hooks/app/materialProcess";
const emit = defineEmits<{
(e: 'save-success'): void
@@ -32,6 +34,11 @@ const isUpdate = computed(() => !!dataId.value)
const title = computed(() => (isUpdate.value ? '修改物料管理' : '新增物料管理'))
const formRef = ref<InstanceType<typeof GiForm>>()
const { materialTypeList, getMaterialTypeSelect } = materialType()
const { materialProcessList, getMaterialProcessSelect } = materialProcess()
const [form, resetForm] = useResetReactive({
// todo 待补充
})
@@ -56,6 +63,31 @@ const columns: ColumnItem[] = reactive([
field: 'unitWeight',
type: 'input-number',
span: 24,
required: true,
},
{
label: '物料品类',
field: 'materialTypeId',
type: 'select',
span: 24,
required: true,
props: {
options: materialTypeList,
allowClear: true,
allowSearch: true,
},
},
{
label: '物料流程编码',
field: 'materialProcessId',
type: 'select',
span: 24,
required: true,
props: {
options: materialProcessList,
allowClear: true,
allowSearch: true,
},
},
{
label: '物料规格',
@@ -69,6 +101,7 @@ const columns: ColumnItem[] = reactive([
type: 'image',
savePath: 'material/',
span: 24,
required: true,
},
])
@@ -101,6 +134,12 @@ const save = async () => {
const onAdd = async () => {
reset()
dataId.value = ''
if (!materialTypeList.value.length) {
await getMaterialTypeSelect()
}
if (!materialProcessList.value.length) {
await getMaterialProcessSelect();
}
visible.value = true
}
@@ -109,6 +148,12 @@ const onUpdate = async (id: string) => {
reset()
dataId.value = id
const { data } = await getMaterialInfo(id)
if (!materialTypeList.value.length) {
await getMaterialTypeSelect()
}
if (!materialProcessList.value.length) {
await getMaterialProcessSelect();
}
Object.assign(form, data)
visible.value = true
}