import request from '@/utils/request'; import { AxiosPromise } from 'axios'; import { RecipeVO, RecipeForm, RecipeQuery } from '@/api/system/recipe/types'; /** * 查询食谱管理列表 * @param query * @returns {*} */ export const listRecipe = (query?: RecipeQuery): AxiosPromise => { return request({ url: '/system/recipe/list', method: 'get', params: query }); }; export const nutrientAnalysis = (query?: RecipeQuery): AxiosPromise => { return request({ url: '/system/recipe/nutrientAnalysis', method: 'get', params: query }); }; export const changeRecipeStatus = (recipeIds: string | number, status: string) => { const data = { recipeIds, status }; return request({ url: '/system/recipe/changeStatus', method: 'put', data: data }); }; /** * 查询食谱管理详细 * @param recipeId */ export const getRecipe = (recipeId: string | number): AxiosPromise => { return request({ url: '/system/recipe/' + recipeId, method: 'get' }); }; /** * 新增食谱管理 * @param data */ export const addRecipe = (data: RecipeForm) => { return request({ url: '/system/recipe', method: 'post', data: data }); }; /** * 修改食谱管理 * @param data */ export const updateRecipe = (data: RecipeForm) => { return request({ url: '/system/recipe', method: 'put', data: data }); }; /** * 删除食谱管理 * @param recipeId */ export const delRecipe = (recipeId: string | number | Array) => { return request({ url: '/system/recipe/' + recipeId, method: 'delete' }); };