equipment.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. // function setEquipeHttp(params) {
  13. // return $http({
  14. // serverSp: config.brsgServer.duoduoUrl,
  15. // url: `/server/object/eqp/infocode/set?${commonParams()}`,
  16. // method: 'POST',
  17. // isNotShowErrorToast: true,
  18. // errorSave: true,
  19. // data: JSON.stringify(params),
  20. // });
  21. // }
  22. //窗帘 获取设备
  23. export const getObjectDataEqpGroupHttp = (params) => {
  24. return request(`/server/object/objectDataEqpGroup/query?${commonParams()}`, {
  25. method: 'POST',
  26. isNotShowErrorToast: true,
  27. errorSave: true,
  28. data: JSON.stringify({ ...params }),
  29. headers: {
  30. 'Content-Type': 'application/json',
  31. },
  32. });
  33. };
  34. // 灯的状态
  35. export const getLampHttp = (params) => {
  36. return request(`/server/light/status/query?${commonParams()}&spaceId=${params}`, {
  37. isNotShowErrorToast: true,
  38. errorSave: true,
  39. method: 'GET',
  40. headers: {
  41. 'Content-Type': 'application/json',
  42. },
  43. });
  44. };
  45. // 开关失败时 定时查询灯状态
  46. export const getStatusHttp = (params) => {
  47. return request(`/server/light/onoff/setSatus?${commonParams()}`, {
  48. method: 'POST',
  49. isNotShowErrorToast: true,
  50. errorSave: true,
  51. data: JSON.stringify(params),
  52. headers: {
  53. 'Content-Type': 'application/json',
  54. },
  55. });
  56. };
  57. // 空调 - 调节文案/空调信息
  58. export const getFeedbackDocumentsHttp = (params) => {
  59. return request(`/server/custom/feedback/documents?${commonParams()}`, {
  60. isNotShowErrorToast: true,
  61. errorSave: true,
  62. method: 'POST',
  63. data: JSON.stringify(params),
  64. headers: {
  65. 'Content-Type': 'application/json',
  66. },
  67. });
  68. };
  69. // 空调 调节
  70. export const changeAirHttp = (params) => {
  71. return request(`/server/custom/feedbackCreate/v2?${commonParams()}`, {
  72. method: 'POST',
  73. isNotShowErrorToast: true,
  74. errorSave: true,
  75. data: JSON.stringify({ ...params, projectId: getProjectId() }),
  76. headers: {
  77. 'Content-Type': 'application/json',
  78. },
  79. });
  80. };
  81. // 空间环境质量
  82. export const getSpaceAdjustList = (params) => {
  83. return request(`/server/space/property?${commonParams()}`, {
  84. method: 'POST',
  85. isNotShowErrorToast: true,
  86. errorSave: true,
  87. data: JSON.stringify({ ...params, criteria: { ...params.criteria, projectId: getProjectId() } }),
  88. headers: {
  89. 'Content-Type': 'application/json',
  90. },
  91. });
  92. }
  93. // 空调 调节
  94. export const changeAllAirHttp = (body) => {
  95. return request(`/server/custom/feedbackCreate/v2Batch?${commonParams()}`, {
  96. method: 'POST',
  97. isNotShowErrorToast: true,
  98. errorSave: true,
  99. data: body,
  100. headers: {
  101. 'Content-Type': 'application/json',
  102. },
  103. });
  104. };