diff --git a/inventory-web/src/api/bom.ts b/inventory-web/src/api/bom.ts index 82c06af..eba398e 100644 --- a/inventory-web/src/api/bom.ts +++ b/inventory-web/src/api/bom.ts @@ -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({ diff --git a/inventory-web/src/api/inbound/buy.ts b/inventory-web/src/api/inbound/buy.ts index e7e99d2..e0108b4 100644 --- a/inventory-web/src/api/inbound/buy.ts +++ b/inventory-web/src/api/inbound/buy.ts @@ -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 }) }