cangku/frontend/src/api/mkhBom.js

59 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import request from './request';
const LIST_TIMEOUT_MS = 3 * 60 * 1000;
const DETAIL_TIMEOUT_MS = 3 * 60 * 1000;
const EXPORT_TIMEOUT_MS = 5 * 60 * 1000;
// MKH-BOM 资料列表(模块化组合商品 + 配件汇总)
export const getMkhBomList = (params = {}) => request.get(
'/api/mkh-bom/list',
{
params,
timeout: LIST_TIMEOUT_MS,
headers: { 'Cache-Control': 'no-cache' },
}
);
// 单个 MKH 组合商品的 BOM 配件明细(列表展开 / 打印预览共用)
export const getMkhBomDetail = (skuId) => request.get(
'/api/mkh-bom/detail',
{ params: { skuId }, timeout: DETAIL_TIMEOUT_MS }
);
// 导出:当前筛选条件下的全部数据(不分页)
// mode=products → 商品清单;mode=components → 配件明细摊平
// ⚠️ 「全部」范围下官方 BOM 明细要分批拉取,耗时明显高于列表接口,故单独放大超时
export const getMkhBomExportRows = (params = {}) => request.get(
'/api/mkh-bom/export',
{ params, timeout: EXPORT_TIMEOUT_MS }
);
// 补货预警推送设置(接收人 / 开关 / 推送范围)
export const getMkhReplenishAlertConfig = () => request.get('/api/mkh-bom/alert-config');
// 保存补货预警推送设置
export const saveMkhReplenishAlertConfig = (payload = {}) => request.put(
'/api/mkh-bom/alert-config',
payload
);
// 立即检查并推送(dryRun 只预览 / force 忽略「只推新增」/ reset 先清空已推送记录)
export const checkMkhReplenishAlert = (payload = {}) => request.post(
'/api/mkh-bom/alert-check',
payload,
{ timeout: LIST_TIMEOUT_MS }
);
// 保存统一通知中心凭据(补货预警的推送通道)
export const saveMkhNotificationCenter = (payload = {}) => request.put(
'/api/mkh-bom/notification-center',
payload
);
// 手动同步:服务端清空全部 MKH 缓存,并在同一次请求中返回当前筛选条件的数据库新快照
export const syncMkhBom = (query = {}) => request.post(
'/api/mkh-bom/sync',
{ query },
{ timeout: LIST_TIMEOUT_MS }
);