list.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import { defHttp } from '/@/utils/http/axios';
  2. import {
  3. PageParams,
  4. CorporationListGetResultModel,
  5. UpdateCompanyParam,
  6. DeviceListItem,
  7. DeviceGetResultModel,
  8. } from './model';
  9. import { Result, UploadFileParams } from '/#/axios';
  10. enum Api {
  11. selectCompanyNum = '/zfb-api/zfb/company/selectCompanyNum',
  12. listAllCompany = '/zfb-api/zfb/company/getListAll',
  13. selectCompanyByType = '/zfb-api/zfb/company/selectCompanyByType',
  14. uploadLogo = '/zfb-api/zfb/company/uploadLogo',
  15. updateCompany = '/zfb-api/zfb/company/updateCompany',
  16. selectCompanyDevice = '/zfb-api/zfb/company/selectCompanyDevice',
  17. }
  18. /**
  19. * @description: Get sample list value
  20. */
  21. export const ListApi = (params: PageParams) =>
  22. defHttp.post<CorporationListGetResultModel>({
  23. url: Api.selectCompanyNum,
  24. params,
  25. headers: {
  26. // @ts-ignore
  27. ignoreCancelToken: true,
  28. },
  29. });
  30. export const ListAllCompanyApi = (params: PageParams) =>
  31. defHttp.post<CorporationListGetResultModel>({
  32. url: Api.listAllCompany,
  33. params,
  34. headers: {
  35. // @ts-ignore
  36. ignoreCancelToken: true,
  37. },
  38. });
  39. export const ListVerifyApi = (params: PageParams) =>
  40. defHttp.post<CorporationListGetResultModel>({
  41. url: Api.selectCompanyByType,
  42. params,
  43. headers: {
  44. // @ts-ignore
  45. ignoreCancelToken: true,
  46. },
  47. });
  48. export const selectCompanyDevice = (params: UpdateCompanyParam) =>
  49. defHttp.post<Result>({
  50. url: Api.updateCompany,
  51. params,
  52. headers: {
  53. // @ts-ignore
  54. ignoreCancelToken: true,
  55. },
  56. });
  57. export const updateCompnayApi = (params: UpdateCompanyParam) =>
  58. defHttp.post<Result>({
  59. url: Api.updateCompany,
  60. params,
  61. headers: {
  62. // @ts-ignore
  63. ignoreCancelToken: true,
  64. },
  65. });
  66. export const companyDeviceApi = (params: DeviceListItem) =>
  67. defHttp.post<DeviceGetResultModel>({
  68. url: Api.selectCompanyDevice,
  69. params,
  70. headers: {
  71. // @ts-ignore
  72. ignoreCancelToken: true,
  73. },
  74. });
  75. export function uploadLogoApi(
  76. params: UploadFileParams,
  77. onUploadProgress: (progressEvent: ProgressEvent) => void,
  78. ) {
  79. return defHttp.uploadFile<Result>(
  80. {
  81. url: Api.uploadLogo,
  82. onUploadProgress,
  83. },
  84. params,
  85. );
  86. }