equipment.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. import { request } from 'umi';
  2. const API = 'https://duoduoenv.sagacloud.cn';
  3. function commonParams() {
  4. return `openid=9a1ecfbacb6b4f249bf2dd3ec7793ead&pubname=sagacareAndtenantslink&projectId=Pj1101080259&userName=%E5%AE%89%E5%B0%8F%E9%9C%9E&userPhone=17611228068&userId=9a1ecfbacb6b4f249bf2dd3ec7793ead`;
  5. // return `openid=9a1ecfbacb6b4f249bf2dd3ec7793ead&pubname=sagacareAndtenantslink&projectId=Pj1101080259&userName=anxiaoxia&userPhone=17611228068
  6. // &userId=9a1ecfbacb6b4f249bf2dd3ec7793ead`;
  7. }
  8. function getProjectId() {
  9. return 'Pj1101080259';
  10. }
  11. //窗帘 设置设备
  12. export const setEquipeHttp = (params)=> {
  13. return request(`/server/object/eqp/infocode/set?${commonParams()}`,{
  14. method: 'POST',
  15. isNotShowErrorToast: true,
  16. errorSave: true,
  17. data: JSON.stringify(params),
  18. headers: {
  19. 'Content-Type': 'application/json',
  20. },
  21. });
  22. }
  23. //窗帘 获取设备
  24. export const getObjectDataEqpGroupHttp = (params) => {
  25. return request(`/server/object/objectDataEqpGroup/query?${commonParams()}`, {
  26. method: 'POST',
  27. isNotShowErrorToast: true,
  28. errorSave: true,
  29. data: JSON.stringify(params),
  30. headers: {
  31. 'Content-Type': 'application/json',
  32. },
  33. });
  34. }
  35. // 灯的状态
  36. export const getLampHttp = (params) => {
  37. return request(`/server/light/status/query?${commonParams()}&spaceId=${params}`, {
  38. isNotShowErrorToast: true,
  39. errorSave: true,
  40. method: 'GET',
  41. headers: {
  42. 'Content-Type': 'application/json',
  43. },
  44. });
  45. };
  46. // 批量 开关灯
  47. export const setallLampHttp = (params) => {
  48. return request(`/server/light/onoff/set?${commonParams()}`, {
  49. method: 'POST',
  50. isNotShowErrorToast: true,
  51. errorSave: true,
  52. data: JSON.stringify(params),
  53. headers: {
  54. 'Content-Type': 'application/json',
  55. },
  56. });
  57. };
  58. // 开关失败时 定时查询灯状态
  59. export const getStatusHttp = (params) => {
  60. return request(`/server/light/onoff/setSatus?${commonParams()}`, {
  61. method: 'POST',
  62. isNotShowErrorToast: true,
  63. errorSave: true,
  64. data: JSON.stringify(params),
  65. headers: {
  66. 'Content-Type': 'application/json',
  67. },
  68. });
  69. };
  70. // 空调 - 调节文案/空调信息
  71. export const getFeedbackDocumentsHttp = (params) => {
  72. return request(`/server/custom/feedback/documents?${commonParams()}`, {
  73. isNotShowErrorToast: true,
  74. errorSave: true,
  75. method: 'POST',
  76. data: JSON.stringify(params),
  77. headers: {
  78. 'Content-Type': 'application/json',
  79. },
  80. });
  81. };
  82. // 空调 调节
  83. export const changeAirHttp = (params) => {
  84. return request(`/server/custom/feedbackCreate/v2?${commonParams()}`, {
  85. method: 'POST',
  86. isNotShowErrorToast: true,
  87. errorSave: true,
  88. data: JSON.stringify({ ...params, projectId: getProjectId() }),
  89. headers: {
  90. 'Content-Type': 'application/json',
  91. },
  92. });
  93. };
  94. // 空间环境质量
  95. export const getSpaceAdjustList = (params) => {
  96. return request(`/server/space/property?${commonParams()}`, {
  97. method: 'POST',
  98. isNotShowErrorToast: true,
  99. errorSave: true,
  100. data: JSON.stringify({ ...params, criteria: { ...params.criteria, projectId: getProjectId() } }),
  101. headers: {
  102. 'Content-Type': 'application/json',
  103. },
  104. });
  105. }
  106. // 空调 调节
  107. export const changeAllAirHttp = (body) => {
  108. return request(`/server/custom/feedbackCreate/v2Batch?${commonParams()}`, {
  109. method: 'POST',
  110. isNotShowErrorToast: true,
  111. errorSave: true,
  112. data: body,
  113. headers: {
  114. 'Content-Type': 'application/json',
  115. },
  116. });
  117. };