提交
This commit is contained in:
1 parent
4daf990fab
commit
1ca2668112
219 files changed
+29817
-20945
No files matched your search
@@ -29,6 +29,41 @@ export function fetchProductionTaskList(params?: {
|
||||
}>({ url: '/web/admin/production-tasks', params })
|
||||
}
|
||||
|
||||
/** 批量拉取当前页工单下的生产任务(含步骤摘要),POST 避免 GET URL 过长 */
|
||||
export function fetchProductionTasksByWorkOrderIds(workOrderIds: string[]) {
|
||||
const ids = workOrderIds.map((id) => String(id || '').trim()).filter(Boolean)
|
||||
if (!ids.length) {
|
||||
return Promise.resolve({ list: [] as any[], total: 0, page: 1, pageSize: 0, totalPages: 0 })
|
||||
}
|
||||
return request.post<{
|
||||
list: any[]
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
totalPages: number
|
||||
}>({
|
||||
url: '/web/admin/production-tasks/list-by-work-orders',
|
||||
params: {
|
||||
workOrderIds: ids,
|
||||
includeStepSummary: true,
|
||||
pageSize: Math.min(500, ids.length * 100)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function groupProductionTasksByWorkOrderId(
|
||||
tasks: Record<string, any>[]
|
||||
): Record<string, Record<string, any>[]> {
|
||||
const map: Record<string, Record<string, any>[]> = {}
|
||||
for (const task of tasks || []) {
|
||||
const workOrderId = String(task.workOrderId || '').trim()
|
||||
if (!workOrderId) continue
|
||||
if (!map[workOrderId]) map[workOrderId] = []
|
||||
map[workOrderId].push(task)
|
||||
}
|
||||
return map
|
||||
}
|
||||
|
||||
export function fetchMyProductionTasks(params: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
@@ -98,6 +133,33 @@ export function fetchProductionTaskDetail(
|
||||
return request.get<any>({ url: `/web/admin/production-tasks/${id}`, params })
|
||||
}
|
||||
|
||||
export type ProductionTaskEditorInitPayload = {
|
||||
task: Record<string, any>
|
||||
processLibrary?: Record<string, any>[]
|
||||
options?: {
|
||||
processCategories: Record<string, any>[]
|
||||
sops: Record<string, any>[]
|
||||
outputTypes: Record<string, any>[]
|
||||
equipments: Record<string, any>[]
|
||||
reagents: Record<string, any>[]
|
||||
consumables: Record<string, any>[]
|
||||
itemUnits: Record<string, any>[]
|
||||
}
|
||||
}
|
||||
|
||||
/** 编辑生产任务弹窗初始化(任务详情 + 工艺库 + 步骤配置参考数据,聚合为单次请求) */
|
||||
export function fetchProductionTaskEditorInit(
|
||||
id: string,
|
||||
options?: { includeReference?: boolean }
|
||||
) {
|
||||
const params =
|
||||
options?.includeReference === false ? { includeReference: false } : undefined
|
||||
return request.get<ProductionTaskEditorInitPayload>({
|
||||
url: `/web/admin/production-tasks/${id}/editor-init`,
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchUpdateProductionTask(id: string, data: Record<string, any>) {
|
||||
return request.put({ url: `/web/admin/production-tasks/${id}`, params: data })
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user