更新接口和调用方

This commit is contained in:
2025-10-29 19:42:48 +08:00
parent fff309f56b
commit 0ff82657ab
5 changed files with 180 additions and 38 deletions

View File

@@ -1,7 +1,7 @@
import http from '../utils/http';
/**
* @typedef {('计划分析'|'等待'|'下料')} TaskType
* @typedef {('计划分析'|'等待'|'下料'|'全量采集')} TaskType
*/
/**
@@ -67,6 +67,10 @@ import http from '../utils/http';
* @typedef {('子计划'|'任务')} PlanContentType
*/
/**
* @typedef {('自定义任务'|'系统任务')} PlanType
*/
/**
* @typedef {object} PlanResponse
* @property {number} id
@@ -78,17 +82,41 @@ import http from '../utils/http';
* @property {number} execute_count
* @property {PlanStatus} status
* @property {PlanContentType} content_type
* @property {PlanType} plan_type
* @property {Array<TaskResponse>} tasks
* @property {Array<SubPlanResponse>} sub_plans
*/
/**
* @typedef {object} ListPlansResponse
* @property {Array<PlanResponse>} plans
* @property {number} total
*/
/**
* @typedef {object} PlanExecutionLogDTO
* @property {string} created_at
* @property {string} ended_at
* @property {string} error
* @property {number} id
* @property {number} plan_id
* @property {string} plan_name
* @property {string} started_at
* @property {string} status
* @property {string} updated_at
*/
/**
* 获取所有计划的列表
* @returns {Promise<Array<PlanResponse>>}
* @param {object} params - 查询参数
* @param {number} [params.page] - 页码
* @param {number} [params.pageSize] - 每页大小
* @param {('所有任务'|'自定义任务'|'系统任务')} [params.planType] - 计划类型
* @returns {Promise<ListPlansResponse>}
*/
const getPlans = () => {
return http.get('/api/v1/plans');
const getPlans = (params) => {
return http.get('/api/v1/plans', { params });
};
/**
@@ -110,7 +138,7 @@ const getPlanById = (id) => {
};
/**
* 根据计划ID更新计划的详细信息
* 根据计划ID更新计划的详细信息。系统计划不允许修改。
* @param {number} id - 计划ID
* @param {UpdatePlanRequest} planData - 更新后的计划信息
* @returns {Promise<PlanResponse>}
@@ -120,7 +148,7 @@ const updatePlan = (id, planData) => {
};
/**
* 根据计划ID删除计划软删除
* 根据计划ID删除计划(软删除)系统计划不允许删除。
* @param {number} id - 计划ID
* @returns {Promise<*>}
*/
@@ -129,7 +157,7 @@ const deletePlan = (id) => {
};
/**
* 根据计划ID启动一个计划的执行
* 根据计划ID启动一个计划的执行。系统计划不允许手动启动。
* @param {number} id - 计划ID
* @returns {Promise<*>}
*/
@@ -138,7 +166,7 @@ const startPlan = (id) => {
};
/**
* 根据计划ID停止一个正在执行的计划
* 根据计划ID停止一个正在执行的计划。系统计划不能被停止。
* @param {number} id - 计划ID
* @returns {Promise<*>}
*/