| | |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | import { isPdMockEnabled } from '../mock/enabled'; |
| | | import { pdMockStore } from '../mock/store'; |
| | | |
| | | export namespace MesPdBomApi { |
| | | /** 设计 BOM 行 */ |
| | | export interface BomLine { |
| | |
| | | } |
| | | |
| | | export function getPdBomPage(params: MesPdBomApi.PageParams) { |
| | | if (isPdMockEnabled()) { |
| | | return pdMockStore.getBomPage(params); |
| | | } |
| | | return requestClient.get<PageResult<MesPdBomApi.BomLine>>( |
| | | '/mes/pd/bom/page', |
| | | { params }, |
| | |
| | | } |
| | | |
| | | export function createPdBomLine(data: MesPdBomApi.BomLine) { |
| | | if (isPdMockEnabled()) { |
| | | return pdMockStore.createBomLine(data); |
| | | } |
| | | return requestClient.post<number>('/mes/pd/bom/create', data); |
| | | } |
| | | |
| | | export function updatePdBomLine(data: MesPdBomApi.BomLine) { |
| | | if (isPdMockEnabled()) { |
| | | return pdMockStore.updateBomLine(data); |
| | | } |
| | | return requestClient.put('/mes/pd/bom/update', data); |
| | | } |
| | | |
| | | export function deletePdBomLine(id: number) { |
| | | if (isPdMockEnabled()) { |
| | | return pdMockStore.deleteBomLine(id); |
| | | } |
| | | return requestClient.delete(`/mes/pd/bom/delete?id=${id}`); |
| | | } |