api.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { request,downloadFile } from '/@/utils/service';
  2. import { PageQuery, AddReq, DelReq, EditReq, InfoReq } from '@fast-crud/fast-crud';
  3. export const apiPrefix = '/api/system/user/';
  4. export function GetDept(query: PageQuery) {
  5. return request({
  6. url: "/api/system/dept/dept_lazy_tree/",
  7. method: 'get',
  8. params: query,
  9. });
  10. }
  11. export function GetList(query: PageQuery) {
  12. return request({
  13. url: apiPrefix,
  14. method: 'get',
  15. params: query,
  16. });
  17. }
  18. export function GetObj(id: InfoReq) {
  19. return request({
  20. url: apiPrefix + id,
  21. method: 'get',
  22. });
  23. }
  24. export function AddObj(obj: AddReq) {
  25. return request({
  26. url: apiPrefix,
  27. method: 'post',
  28. data: obj,
  29. });
  30. }
  31. export function UpdateObj(obj: EditReq) {
  32. return request({
  33. url: apiPrefix + obj.id + '/',
  34. method: 'put',
  35. data: obj,
  36. });
  37. }
  38. export function DelObj(id: DelReq) {
  39. return request({
  40. url: apiPrefix + id + '/',
  41. method: 'delete',
  42. data: { id },
  43. });
  44. }
  45. export function exportData(params:any){
  46. return downloadFile({
  47. url: apiPrefix + 'export_data/',
  48. params: params,
  49. method: 'get'
  50. })
  51. }
  52. export function resetToDefaultPassword(id:any){
  53. return request({
  54. url: apiPrefix + id + '/reset_to_default_password/',
  55. method: 'put'
  56. })
  57. }
  58. export function getShopOptions(query: any) {
  59. return request({
  60. url: '/api/choice/marketplace_shops/select/',
  61. method: 'GET',
  62. params: query
  63. })
  64. }
  65. export function getAuthorizedShop(query: any) {
  66. return request({
  67. url: '/api/system/user/authorized-shop/',
  68. method: 'GET',
  69. params: query
  70. })
  71. }
  72. export function postAuthorize(body: any) {
  73. return request({
  74. url: '/api/system/user/authorized-shop/',
  75. method: 'POST',
  76. data: body
  77. })
  78. }