| | |
| | | import type { PageParam, PageResult } from '@vben/request'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace SrmStatisticsApi { |
| | |
| | | supplierCount?: number; |
| | | period?: string; |
| | | } |
| | | |
| | | /** 报价明细项 */ |
| | | export interface CostQuoteItem { |
| | | supplierId?: number; |
| | | supplierName?: string; |
| | | quotePrice?: number; |
| | | taxRate?: number; |
| | | deliveryCycle?: number; |
| | | quoteTime?: string; |
| | | } |
| | | |
| | | /** 物料成本分析行 */ |
| | | export interface CostAnalysis { |
| | | productId?: number; |
| | | productCode?: string; |
| | | productName?: string; |
| | | productSpec?: string; |
| | | unit?: string; |
| | | totalQuantity?: number; |
| | | quoteCount?: number; |
| | | supplierCount?: number; |
| | | weightedAvgPrice?: number; |
| | | minPrice?: number; |
| | | maxPrice?: number; |
| | | estimatedPrice?: number; |
| | | deviationRate?: number; |
| | | lastQuoteTime?: string; |
| | | priceChange?: number; |
| | | quotes?: CostQuoteItem[]; |
| | | } |
| | | |
| | | /** 价格趋势点 */ |
| | | export interface CostTrendPoint { |
| | | month?: string; |
| | | avgPrice?: number; |
| | | count?: number; |
| | | } |
| | | } |
| | | |
| | | /** 获取招标统计 */ |
| | | export function getTenderStatistics(year: string) { |
| | | return requestClient.get<SrmStatisticsApi.TenderStatisticsVO>(`/srm/statistics/tender?year=${year}`); |
| | | return requestClient.get<SrmStatisticsApi.TenderStatisticsVO>( |
| | | '/srm/statistics/tender', |
| | | { params: { year } }, |
| | | ); |
| | | } |
| | | |
| | | /** 采购成本分析(基于招标需求量与供应商报价,不依赖 ERP) */ |
| | | export function getCostAnalysis( |
| | | params: PageParam & { productName?: string }, |
| | | ) { |
| | | return requestClient.get<PageResult<SrmStatisticsApi.CostAnalysis>>( |
| | | '/srm/statistics/cost-analysis', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** 物料价格趋势 */ |
| | | export function getCostTrend(productId: number) { |
| | | return requestClient.get<SrmStatisticsApi.CostTrendPoint[]>( |
| | | '/srm/statistics/cost-trend', |
| | | { params: { productId } }, |
| | | ); |
| | | } |