This commit is contained in:
zlwu committed 2026-05-20 09:28:36 +08:00
1 parent e6072457fd
commit be4fab78e1
578 files changed
+174415 -214

No files matched your search

+115
View File
@@ -0,0 +1,115 @@
import request from '@/utils/http'
type PageList<T> = {
list: T[]
total: number
page: number
pageSize: number
totalPages: number
}
export type Material = {
id: string
materialCode: string
materialName: string
category: string
specModel: string
unit: string
stockQty: number
status: string
imageUrls: string
tenantNo: string
orderNum: number
remark: string
createBy: string
createTime: string
updateTime: string
}
export type MaterialStockLog = {
id: string
materialId: string
materialCode: string
materialName: string
changeType: string
changeQty: number
stockBefore: number
stockAfter: number
receiver: string
purpose: string
remark: string
createBy: string
createTime: string
updateTime: string
}
export function fetchMaterialList(params?: {
page?: number
pageSize?: number
keyword?: string
category?: string
status?: string
}) {
return request.get<PageList<Material>>({
url: '/web/admin/materials',
params
})
}
export function fetchMaterialOptions() {
return request.get<{ id: string; label: string; materialCode: string }[]>({
url: '/web/admin/materials/options'
})
}
export function fetchCreateMaterial(data: Record<string, any>) {
return request.post<Material>({
url: '/web/admin/materials',
data
})
}
export function fetchUpdateMaterial(id: string, data: Record<string, any>) {
return request.put<Material>({
url: `/web/admin/materials/${id}`,
data
})
}
export function fetchDeleteMaterial(id: string) {
return request.delete<void>({
url: `/web/admin/materials/${id}`
})
}
export function fetchStockInMaterial(id: string, data: { qty: number; remark?: string }) {
return request.post<Material>({
url: `/web/admin/materials/${id}/stock-in`,
data
})
}
export function fetchStockOutMaterial(
id: string,
data: { qty: number; receiver?: string; purpose?: string; remark?: string }
) {
return request.post<Material>({
url: `/web/admin/materials/${id}/stock-out`,
data
})
}
export function fetchMaterialStockLogList(params?: {
page?: number
pageSize?: number
materialId?: string
changeType?: string
startTime?: string
endTime?: string
keyword?: string
}) {
return request.get<PageList<MaterialStockLog>>({
url: '/web/admin/material-stock-logs',
params
})
}