index.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import request from '@/utils/request';
  2. import { AxiosPromise } from 'axios';
  3. import { RecipeVO, RecipeForm, RecipeQuery } from '@/api/system/recipe/types';
  4. /**
  5. * 查询食谱管理列表
  6. * @param query
  7. * @returns {*}
  8. */
  9. export const listRecipe = (query?: RecipeQuery): AxiosPromise<RecipeVO[]> => {
  10. return request({
  11. url: '/system/recipe/list',
  12. method: 'get',
  13. params: query
  14. });
  15. };
  16. export const nutrientAnalysis = (query?: RecipeQuery): AxiosPromise<JSON> => {
  17. return request({
  18. url: '/system/recipe/nutrientAnalysis',
  19. method: 'get',
  20. params: query
  21. });
  22. };
  23. export const changeRecipeStatus = (recipeIds: string | number, status: string) => {
  24. const data = {
  25. recipeIds,
  26. status
  27. };
  28. return request({
  29. url: '/system/recipe/changeStatus',
  30. method: 'put',
  31. data: data
  32. });
  33. };
  34. /**
  35. * 查询食谱管理详细
  36. * @param recipeId
  37. */
  38. export const getRecipe = (recipeId: string | number): AxiosPromise<RecipeVO> => {
  39. return request({
  40. url: '/system/recipe/' + recipeId,
  41. method: 'get'
  42. });
  43. };
  44. /**
  45. * 新增食谱管理
  46. * @param data
  47. */
  48. export const addRecipe = (data: RecipeForm) => {
  49. return request({
  50. url: '/system/recipe',
  51. method: 'post',
  52. data: data
  53. });
  54. };
  55. /**
  56. * 修改食谱管理
  57. * @param data
  58. */
  59. export const updateRecipe = (data: RecipeForm) => {
  60. return request({
  61. url: '/system/recipe',
  62. method: 'put',
  63. data: data
  64. });
  65. };
  66. /**
  67. * 删除食谱管理
  68. * @param recipeId
  69. */
  70. export const delRecipe = (recipeId: string | number | Array<string | number>) => {
  71. return request({
  72. url: '/system/recipe/' + recipeId,
  73. method: 'delete'
  74. });
  75. };