feat(purchase): 新增采购管理前端页面与路由(列表+新建+审批)
This commit is contained in:
91
inventory-web/src/api/purchase.ts
Normal file
91
inventory-web/src/api/purchase.ts
Normal file
@ -0,0 +1,91 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export interface PurchaseItem {
|
||||
id?: number
|
||||
request_no?: string
|
||||
name: string
|
||||
spec_model?: string
|
||||
quantity: number
|
||||
purchase_date: string
|
||||
supplier_link?: string
|
||||
remark?: string
|
||||
images?: string[]
|
||||
unit_price?: number
|
||||
total_price?: number
|
||||
status: number
|
||||
status_text?: string
|
||||
requester_id?: number
|
||||
requester_name?: string
|
||||
approver_id?: number
|
||||
approver_name?: string
|
||||
approved_at?: string
|
||||
reject_reason?: string
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
export interface Approver {
|
||||
id: number
|
||||
username: string
|
||||
email: string
|
||||
role: string
|
||||
}
|
||||
|
||||
// 获取采购申请列表
|
||||
export function getPurchaseList(params: {
|
||||
page?: number
|
||||
limit?: number
|
||||
status?: number
|
||||
}) {
|
||||
return request({
|
||||
url: '/purchase',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 创建采购申请
|
||||
export function createPurchase(data: PurchaseItem) {
|
||||
return request({
|
||||
url: '/purchase',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取采购申请详情
|
||||
export function getPurchaseDetail(id: number) {
|
||||
return request({
|
||||
url: `/purchase/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 审批采购申请
|
||||
export function approvePurchase(id: number, data: {
|
||||
action: 'approve' | 'reject'
|
||||
reject_reason?: string
|
||||
}) {
|
||||
return request({
|
||||
url: `/purchase/${id}/approve`,
|
||||
method: 'patch',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取可选审批人列表
|
||||
export function getPurchaseApprovers() {
|
||||
return request({
|
||||
url: '/purchase/approvers',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据名称/规格自动补全
|
||||
export function autoFillPurchase(keyword: string) {
|
||||
return request({
|
||||
url: '/purchase/auto-fill',
|
||||
method: 'get',
|
||||
params: { keyword }
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user