82 lines
1.8 KiB
TypeScript
82 lines
1.8 KiB
TypeScript
import request from '@/utils/request'
|
|
|
|
// 1. 获取列表
|
|
export function getBuyList(params: any) {
|
|
return request({
|
|
url: '/inbound/buy/list',
|
|
method: 'get',
|
|
params
|
|
})
|
|
}
|
|
|
|
// 2. 新增入库
|
|
export function createBuyInbound(data: any) {
|
|
return request({
|
|
url: '/inbound/buy/submit',
|
|
method: 'post',
|
|
data
|
|
})
|
|
}
|
|
|
|
// 3. 更新入库
|
|
export function updateBuyInbound(id: number, data: any) {
|
|
return request({
|
|
url: `/inbound/buy/${id}`,
|
|
method: 'put',
|
|
data
|
|
})
|
|
}
|
|
|
|
// 4. 删除入库
|
|
export function deleteBuyInbound(id: number) {
|
|
return request({
|
|
url: `/inbound/buy/${id}`,
|
|
method: 'delete'
|
|
})
|
|
}
|
|
|
|
// 5. 搜索基础物料
|
|
export function searchMaterialBase(keyword: string) {
|
|
return request({
|
|
url: '/inbound/buy/search-base',
|
|
method: 'get',
|
|
params: { keyword }
|
|
})
|
|
}
|
|
|
|
// 6. 文件上传 (用于图片/拍照)
|
|
export function uploadFile(data: FormData) {
|
|
return request({
|
|
url: '/common/upload', // 对应后端 /api/v1/common/upload
|
|
method: 'post',
|
|
data,
|
|
headers: { 'Content-Type': 'multipart/form-data' }
|
|
})
|
|
}
|
|
|
|
// 7. [新增] 文件删除
|
|
export function deleteFile(filename: string) {
|
|
return request({
|
|
url: `/common/files/${filename}`, // 对应后端 /api/v1/common/files/<filename>
|
|
method: 'delete'
|
|
})
|
|
}
|
|
|
|
// 8. 供应商建议
|
|
export function getSupplierSuggestions(params: any) {
|
|
return request({
|
|
url: '/inbound/buy/suggestions/suppliers',
|
|
method: 'get',
|
|
params
|
|
})
|
|
}
|
|
|
|
// 9. 用户建议
|
|
export function getUserSuggestions(params: any) {
|
|
return request({
|
|
url: '/inbound/buy/suggestions/users',
|
|
method: 'get',
|
|
params
|
|
})
|
|
}
|