This commit is contained in:
2025-10-20 14:52:25 +08:00
parent a457b9713c
commit c68dff6123
6 changed files with 93 additions and 28 deletions

View File

@@ -4,7 +4,7 @@ import http from '../utils/http';
* 获取所有计划的列表
* @returns {Promise<*>}
*/
export const getPlans = () => {
const getPlans = () => {
return http.get('/api/v1/plans');
};
@@ -13,7 +13,7 @@ export const getPlans = () => {
* @param {object} planData - 计划信息,对应 dto.CreatePlanRequest
* @returns {Promise<*>}
*/
export const createPlan = (planData) => {
const createPlan = (planData) => {
return http.post('/api/v1/plans', planData);
};
@@ -22,7 +22,7 @@ export const createPlan = (planData) => {
* @param {number} id - 计划ID
* @returns {Promise<*>}
*/
export const getPlanById = (id) => {
const getPlanById = (id) => {
return http.get(`/api/v1/plans/${id}`);
};
@@ -32,7 +32,7 @@ export const getPlanById = (id) => {
* @param {object} planData - 更新后的计划信息,对应 dto.UpdatePlanRequest
* @returns {Promise<*>}
*/
export const updatePlan = (id, planData) => {
const updatePlan = (id, planData) => {
return http.put(`/api/v1/plans/${id}`, planData);
};
@@ -41,7 +41,7 @@ export const updatePlan = (id, planData) => {
* @param {number} id - 计划ID
* @returns {Promise<*>}
*/
export const deletePlan = (id) => {
const deletePlan = (id) => {
return http.delete(`/api/v1/plans/${id}`);
};
@@ -50,7 +50,7 @@ export const deletePlan = (id) => {
* @param {number} id - 计划ID
* @returns {Promise<*>}
*/
export const startPlan = (id) => {
const startPlan = (id) => {
return http.post(`/api/v1/plans/${id}/start`);
};
@@ -59,6 +59,16 @@ export const startPlan = (id) => {
* @param {number} id - 计划ID
* @returns {Promise<*>}
*/
export const stopPlan = (id) => {
const stopPlan = (id) => {
return http.post(`/api/v1/plans/${id}/stop`);
};
export const PlanApi = {
getPlans,
createPlan,
getPlanById,
updatePlan,
deletePlan,
startPlan,
stopPlan,
};