feat(bom): 前端 BOM API——候选版本、独立启停、物料搜索支持公司

- bom.ts 新增 getChildBomVersions(候选版本) 与 updateBomStatus(独立启停)
- inbound/buy.ts searchMaterialBase 增加可选 company 参数(跨域按公司过滤)
This commit is contained in:
yueli
2026-09-08 10:14:47 +08:00
parent 91fb6c1a03
commit 424df231d5
2 changed files with 23 additions and 3 deletions

View File

@ -29,6 +29,15 @@ export function getBomWithStock(bomNo: string, version?: string) {
})
}
// 获取某物料作为父件时的启用 BOM 版本清单(自制件子件版本下拉数据源)
export function getChildBomVersions(childId: number) {
return request({
url: '/v1/bom/self-bom-versions',
method: 'get',
params: { child_id: childId }
})
}
// 获取BOM详情
export function getBomDetail(bomNo: string, version?: string) {
// 去除首尾斜杠,保留中间斜杠并进行 URL 编码
@ -43,6 +52,15 @@ export function getBomDetail(bomNo: string, version?: string) {
})
}
// 仅更新 BOM 启用/停用状态(查看/只读视图的开关专用,不触发整表保存)
export function updateBomStatus(data: { bom_no: string; version: string; is_enabled: boolean }) {
return request({
url: '/v1/bom/status',
method: 'post',
data
})
}
// 保存BOM
export function saveBom(data: any) {
return request({

View File

@ -43,12 +43,14 @@ export function getFilterOptions() {
})
}
// 6. 搜索基础物料
export function searchMaterialBase(keyword: string, page: number = 1) {
// 6. 搜索基础物料company 可选:跨域下按公司过滤;不传则由后端按当前用户公司隔离)
export function searchMaterialBase(keyword: string, page: number = 1, company?: string) {
const params: any = { keyword, page }
if (company) params.company_name = company
return request({
url: '/inbound/buy/search-base',
method: 'get',
params: { keyword, page }
params
})
}