Files
autoAiWorkSys/admin/src/api/task/task_status_server.js
张成 dfd3119163 1
2026-02-28 10:38:28 +08:00

118 lines
2.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 任务状态 API 服务
*/
class TaskStatusServer {
/**
* 分页查询任务状态
* @param {Object} param - 查询参数
* @param {Object} param.seachOption - 搜索条件
* @param {Object} param.pageOption - 分页选项
* @returns {Promise}
*/
page(param) {
return window.framework.http.post('task/list', param)
}
/**
* 获取单条记录详情
* @param {String} taskId - 任务ID
* @returns {Promise}
*/
getById(taskId) {
return window.framework.http.post('task/detail', { taskId })
}
/**
* 获取任务统计
* @returns {Promise}
*/
statistics() {
return window.framework.http.get('task/statistics')
}
/**
* 获取任务的指令列表
* @param {Number|String} taskId - 任务ID
* @returns {Promise}
*/
getCommands(taskId) {
return window.framework.http.post('task/commands', { taskId })
}
/**
* 新增任务
* @param {Object} data - 记录数据
* @returns {Promise}
*/
add(data) {
return window.framework.http.post('task_status', data)
}
/**
* 更新任务状态
* @param {Object} row - 记录数据包含taskId
* @returns {Promise}
*/
update(row) {
return window.framework.http.post('task/update', {
taskId: row.taskId || row.id,
status: row.status,
progress: row.progress,
errorMessage: row.errorMessage
})
}
/**
* 删除任务
* @param {Object} row - 记录数据包含taskId
* @returns {Promise}
*/
del(row) {
return window.framework.http.post('task/delete', { taskId: row.taskId || row.id })
}
/**
* 批量删除
* @param {Array} ids - ID数组
* @returns {Promise}
*/
batchDelete(ids) {
return window.framework.http.post('task_status/batch_delete', { ids })
}
/**
* 取消任务
* @param {Object} row - 任务数据
* @returns {Promise}
*/
cancel(row) {
return window.framework.http.post('task/cancel', {
taskId: row.taskId || row.id
})
}
/**
* 重试任务
* @param {Object} row - 任务数据
* @returns {Promise}
*/
retry(row) {
return window.framework.http.post('task/retry', {
taskId: row.taskId || row.id
})
}
/**
* 导出CSV
* @param {Object} param - 查询参数
* @returns {Promise}
*/
exportCsv(param) {
return window.framework.http.post('task/export', param, { responseType: 'blob' })
}
}
export default new TaskStatusServer()