service.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import { request } from 'umi';
  2. import BaseService from '@/utils/BaseService';
  3. import SystemConst from '@/utils/const';
  4. import type { AccessItem } from './typings';
  5. class Service extends BaseService<AccessItem> {
  6. public queryGatewayDetail = (data: any) =>
  7. request(`/${SystemConst.API_BASE}/gateway/device/detail/_query`, {
  8. method: 'POST',
  9. data,
  10. });
  11. public queryList = (data: any) =>
  12. request(`/${SystemConst.API_BASE}/gateway/device/detail/_query`, {
  13. method: 'POST',
  14. data,
  15. });
  16. public startUp = (id: string) =>
  17. request(`/${SystemConst.API_BASE}/gateway/device/${id}/_startup`, {
  18. method: 'POST',
  19. });
  20. public shutDown = (id: string) =>
  21. request(`/${SystemConst.API_BASE}/gateway/device/${id}/_shutdown`, {
  22. method: 'POST',
  23. });
  24. public getProviders = () =>
  25. request(`/${SystemConst.API_BASE}/gateway/device/providers`, {
  26. method: 'GET',
  27. });
  28. public getNetworkList = (networkType: string, params?: any) =>
  29. request(`/${SystemConst.API_BASE}/network/config/${networkType}/_alive`, {
  30. method: 'GET',
  31. params,
  32. });
  33. public getProtocolList = (transport?: string, params?: any) => {
  34. return request(`/${SystemConst.API_BASE}/protocol/supports/${transport ? transport : ''}`, {
  35. method: 'GET',
  36. params,
  37. });
  38. };
  39. public getChildConfigView = (id: string) => {
  40. return request(`/${SystemConst.API_BASE}/protocol/${id}/transports`, {
  41. method: 'GET',
  42. });
  43. };
  44. public getConfigView = (id: string, transport: string) =>
  45. request(`/${SystemConst.API_BASE}/protocol/${id}/transport/${transport}`, {
  46. method: 'GET',
  47. });
  48. public getClusters = () =>
  49. request(`/${SystemConst.API_BASE}/network/resources/clusters`, {
  50. method: 'GET',
  51. });
  52. //引导页-不在提示
  53. public productGuide = () =>
  54. request(`/${SystemConst.API_BASE}/user/settings/product/guide`, {
  55. method: 'GET',
  56. });
  57. public productGuideSave = (data: any) =>
  58. request(`/${SystemConst.API_BASE}/user/settings/product/guide`, {
  59. method: 'PATCH',
  60. data,
  61. });
  62. public productGuideDetail = () =>
  63. request(`/${SystemConst.API_BASE}/user/settings/product/guide`, {
  64. method: 'DELETE',
  65. });
  66. public getResourcesCurrent = () =>
  67. request(`${SystemConst.API_BASE}/network/resources/alive/_current`, {
  68. method: 'GET',
  69. });
  70. }
  71. export default Service;