Files
Migu2.0/frontends/apps/simple-platform-vue/src/api/delivery.ts
T
zhaowei.huang ea036760cb feat(delivery): 新增插件搬运任务列表面板
- 新增 delivery 的 api/types 与 mock 数据,对接 SimpleLite /projection/deliveries(取消 / 重发 / 强制完成)
- 新增 workbench/MissionListPanel 展示搬运任务,支持按完成 / 中止状态过滤
- components.d.ts 自动注册 MissionListPanel
2026-05-29 23:52:13 +08:00

37 lines
1.1 KiB
TypeScript

import http from './http'
import type { DeliveryTask } from '@/types/delivery'
const MOCK = import.meta.env.VITE_USE_MOCK === 'true'
const BASE = '/sl/projection/deliveries'
export async function listDeliveries(opts?: {
includeFinished?: boolean
includeAborted?: boolean
}): Promise<DeliveryTask[]> {
if (MOCK) {
const { mockDeliveries } = await import('@/mock/data/deliveries')
return mockDeliveries()
}
const params: Record<string, string> = {}
if (opts?.includeFinished === false) params.includeFinished = 'false'
if (opts?.includeAborted === false) params.includeAborted = 'false'
const { data } = await http.get<DeliveryTask[]>(BASE, { params })
return Array.isArray(data) ? data : []
}
export async function cancelDelivery(id: number): Promise<void> {
if (MOCK) return
await http.post(`${BASE}/${id}/cancel`)
}
export async function resendDelivery(id: number): Promise<void> {
if (MOCK) return
await http.post(`${BASE}/${id}/resend`)
}
export async function forceCompleteDelivery(id: number): Promise<void> {
if (MOCK) return
await http.post(`${BASE}/${id}/force-complete`)
}