profile.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright 2022 Pnoker All Rights Reserved
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * https://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import request from '@/config/axios'
  17. /**
  18. * 新增模板
  19. *
  20. * @param profile Profile
  21. * @returns MyAxiosPromise
  22. */
  23. export const addProfile = (profile: any) =>
  24. request<R>({
  25. url: `api/v3/manager/profile/add`,
  26. method: 'post',
  27. data: profile,
  28. })
  29. /**
  30. * 删除模板
  31. *
  32. * @param id 模板ID
  33. * @returns MyAxiosPromise
  34. */
  35. export const deleteProfile = (id: string) =>
  36. request<R>({
  37. url: `api/v3/manager/profile/delete/${id}`,
  38. method: 'post',
  39. })
  40. /**
  41. * 修改模板
  42. *
  43. * @param profile Profile
  44. * @returns MyAxiosPromise
  45. */
  46. export const updateProfile = (profile: any) =>
  47. request<R>({
  48. url: `api/v3/manager/profile/update`,
  49. method: 'post',
  50. data: profile,
  51. })
  52. /**
  53. * 通过模板ID查询模板
  54. *
  55. * @param id 模板ID
  56. * @returns MyAxiosPromise
  57. */
  58. export const getProfileById = (id: string) =>
  59. request<R>({
  60. url: `api/v3/manager/profile/id/${id}`,
  61. method: 'get',
  62. })
  63. /**
  64. * 通过模板ID集查询模板
  65. *
  66. * @param profileIds ProfileId Array
  67. * @returns MyAxiosPromise
  68. */
  69. export const getProfileByIds = (profileIds: any) =>
  70. request<R>({
  71. url: `api/v3/manager/profile/ids`,
  72. method: 'post',
  73. data: profileIds,
  74. })
  75. /**
  76. * 通过设备ID查询模板
  77. *
  78. * @param deviceId DeviceId
  79. * @returns MyAxiosPromise
  80. */
  81. export const getProfileByDeviceId = (deviceId: string) =>
  82. request<R>({
  83. url: `api/v3/manager/profile/device_id/${deviceId}`,
  84. method: 'get',
  85. })
  86. /**
  87. * 分页查询
  88. *
  89. * @param profile Profile
  90. * @returns MyAxiosPromise
  91. */
  92. export const getProfileList = (profile: any) =>
  93. request<R>({
  94. url: `api/v3/manager/profile/list`,
  95. method: 'post',
  96. data: profile,
  97. })