From 424df231d5c121a50489f1c18fca2baea2f7d512 Mon Sep 17 00:00:00 2001 From: yueli Date: Tue, 8 Sep 2026 10:14:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(bom):=20=E5=89=8D=E7=AB=AF=20BOM=20API?= =?UTF-8?q?=E2=80=94=E2=80=94=E5=80=99=E9=80=89=E7=89=88=E6=9C=AC=E3=80=81?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E5=90=AF=E5=81=9C=E3=80=81=E7=89=A9=E6=96=99?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=94=AF=E6=8C=81=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - bom.ts 新增 getChildBomVersions(候选版本) 与 updateBomStatus(独立启停) - inbound/buy.ts searchMaterialBase 增加可选 company 参数(跨域按公司过滤) --- inventory-web/src/api/bom.ts | 18 ++++++++++++++++++ inventory-web/src/api/inbound/buy.ts | 8 +++++--- 2 files changed, 23 insertions(+), 3 deletions(-) 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 }) }