feat: 新增 Odoo 风格物料管理视图及相关路由,优化成品入库逻辑

This commit is contained in:
DXC
2026-06-05 15:35:43 +08:00
parent afe0f25415
commit 907c083107
3 changed files with 1558 additions and 1 deletions

View File

@ -50,6 +50,12 @@ const routes: Array<RouteRecordRaw> = [
name: 'MaterialBase',
component: () => import('@/views/material/list.vue'),
meta: { title: '基础信息', icon: 'Box' }
},
{
path: 'buyOdoo',
name: 'BuyOdoo',
component: () => import('@/views/material/buyOdoo.vue'),
meta: { title: '物料管理(Odoo式)', icon: 'Grid' }
}
]
},

File diff suppressed because it is too large Load Diff

View File

@ -1036,7 +1036,9 @@ const fetchMaterialSuggestions = (query: string, cb: (results: any[]) => void) =
const safeQuery = rawQuery.replace(/[\x00-\x1F\x7F-\x9F\u200B-\u200D\uFEFF]/g, '').trim()
searchLoading.value = true
searchMaterialBase(safeQuery).then((res: any) => {
cb((res.data?.items || []).map((i: any) => ({ ...i, isHistory: false })))
const items = res.data?.items || res.data || []
const formatted = items.map((i: any) => ({ ...i, name: i.name || i.material_name, isHistory: false }))
cb(formatted)
}).catch(() => cb([])).finally(() => { searchLoading.value = false })
}
@ -1061,6 +1063,7 @@ const onMaterialSelected = (item: any) => {
form.material_type = item.type
form.category = item.category
form.unit = item.unit
materialNameInput.value = item.name
// 切换物料时清空已选 BOM防止脏数据
form.bom_code = ''
form.bom_version = ''