|
|
@@ -9,27 +9,33 @@
|
|
|
import { request } from '@/utils/api.js'
|
|
|
|
|
|
/**
|
|
|
- * 发起异步导出 ★返回 taskId(立即返回,不阻塞)
|
|
|
- * 入参:{type:"training"|"order", scope:{cohortId?|orderId?|dateRange?}}
|
|
|
- * 导出本人:scope 传 { cohortId }(培训批次)或 { orderId }(单笔工单)或 { dateRange }(时间窗);
|
|
|
- * 不传 scope 明细由后端默认 mine 全量?——按设计「scope=mine」,本页固定传空对象交由后端聚合。
|
|
|
- * 出参:{taskId:Long, taskNo:String}
|
|
|
+ * 发起异步导出 ★返回 {taskNo, id, status:"pending"}(立即返回,不阻塞)
|
|
|
+ * 入参(扁平,无 scope 嵌套):{type:"training"|"order", orgId?(admin必填), cohortId?, orderId?}
|
|
|
+ * 服务人员本人导出:固定传 { type },明细由后端按「仅本人记录」聚合;
|
|
|
+ * 后续如需按批次/单笔导出,追加 cohortId / orderId 即可(扁平)。
|
|
|
+ * 出参:{taskNo:String, id:Long, status:"pending"}
|
|
|
+ * ★轮询主键是 taskNo(status 接口按 taskNo 查、mustOwn),不是 id。
|
|
|
* 错误:401 需登录 / 500「导出范围不能为空」
|
|
|
* silent:业务错误由页面 toast,不弹全局
|
|
|
*/
|
|
|
-export function exportEvidence(type, scope) {
|
|
|
+export function exportEvidence(type, opts) {
|
|
|
var data = { type: type }
|
|
|
- if (scope) data.scope = scope
|
|
|
+ if (opts) {
|
|
|
+ if (opts.orgId) data.orgId = opts.orgId
|
|
|
+ if (opts.cohortId) data.cohortId = opts.cohortId
|
|
|
+ if (opts.orderId) data.orderId = opts.orderId
|
|
|
+ }
|
|
|
return request('/api/evidence/export', 'POST', data, { silent: true })
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 轮询任务状态
|
|
|
- * 入参:{taskId}
|
|
|
- * 出参:{status:"pending|processing|done|failed", progress:int, fileUrl?:String, error?:String}
|
|
|
- * mustOwn(任务属当前用户,他人任务 404)
|
|
|
+ * 轮询任务状态 ★入参主键 taskNo
|
|
|
+ * 入参:{taskNo}
|
|
|
+ * 出参:{taskNo,id,type,status,progress,fileUrl?,error?,expireAt?,createdAt?}
|
|
|
+ * status ∈ pending|processing|done|failed;fileUrl 出现即 done
|
|
|
+ * mustOwn(任务属当前用户,他人 taskNo → 404)
|
|
|
* silent:轮询是前台主动行为,失败由页面重试
|
|
|
*/
|
|
|
-export function getEvidenceStatus(taskId) {
|
|
|
- return request('/api/evidence/status', 'POST', { taskId: taskId }, { silent: true })
|
|
|
+export function getEvidenceStatus(taskNo) {
|
|
|
+ return request('/api/evidence/status', 'POST', { taskNo: taskNo }, { silent: true })
|
|
|
}
|