bx.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import { bxRequest, bxUploadFile } from '@/utils/bxRequest'
  2. export const advanceApi = {
  3. list: (params) => bxRequest({ url: '/advances/', method: 'GET', params }),
  4. my: (params) => bxRequest({ url: '/advances/my', method: 'GET', params }),
  5. getById: (id) => bxRequest({ url: `/advances/${id}`, method: 'GET' }),
  6. getApprovals: (id) => bxRequest({ url: `/advances/${id}/approvals`, method: 'GET' }),
  7. getApprovalHistory: (id) => bxRequest({ url: `/advances/${id}/approval-history`, method: 'GET' }),
  8. create: (data) => bxRequest({ url: '/advances/', method: 'POST', data }),
  9. update: (id, data) => bxRequest({ url: `/advances/${id}`, method: 'PUT', data }),
  10. submit: (id) => bxRequest({ url: `/advances/${id}/submit`, method: 'POST' }),
  11. delete: (id) => bxRequest({ url: `/advances/${id}`, method: 'DELETE' })
  12. }
  13. export const reimburseApi = {
  14. generateTitle: (params) =>
  15. bxRequest({ url: '/reimburses/generate-title', method: 'GET', params }),
  16. list: (params) => bxRequest({ url: '/reimburses/', method: 'GET', params }),
  17. my: (params) => bxRequest({ url: '/reimburses/my', method: 'GET', params }),
  18. getById: (id) => bxRequest({ url: `/reimburses/${id}`, method: 'GET' }),
  19. getApprovals: (id) => bxRequest({ url: `/reimburses/${id}/approvals`, method: 'GET' }),
  20. getApprovalHistory: (id) =>
  21. bxRequest({ url: `/reimburses/${id}/approval-history`, method: 'GET' }),
  22. create: (data) => bxRequest({ url: '/reimburses/', method: 'POST', data }),
  23. update: (id, data) => bxRequest({ url: `/reimburses/${id}`, method: 'PUT', data }),
  24. submit: (id, data) =>
  25. bxRequest({ url: `/reimburses/${id}/submit`, method: 'POST', data }),
  26. delete: (id) => bxRequest({ url: `/reimburses/${id}`, method: 'DELETE' })
  27. }
  28. export const expenseItemApi = {
  29. tree: () => bxRequest({ url: '/expense-items/tree', method: 'GET' })
  30. }
  31. export const invoiceWalletApi = {
  32. mineSummary: (params) =>
  33. bxRequest({ url: '/invoice-wallets/mine/summary', method: 'GET', params })
  34. }
  35. export const invoiceApi = {
  36. list: (params) => bxRequest({ url: '/invoices', method: 'GET', params })
  37. }
  38. /** 附件:申请页图片上传所需最小集合 */
  39. export const attachmentApi = {
  40. upload: (filePath, bizType = '', bizId = 0) =>
  41. bxUploadFile(filePath, { bizType, bizId }),
  42. listByBiz: (bizType, bizId) =>
  43. bxRequest({
  44. url: '/attachments/list',
  45. method: 'GET',
  46. params: { biz_type: bizType, biz_id: bizId }
  47. }),
  48. preview: (id) => bxRequest({ url: `/attachments/preview/${id}`, method: 'GET' }),
  49. delete: (id) => bxRequest({ url: `/attachments/${id}`, method: 'DELETE' }),
  50. bindBiz: (ids, bizType, bizId) =>
  51. bxRequest({
  52. url: '/attachments/bind-biz',
  53. method: 'PUT',
  54. params: {
  55. ids: (ids || []).join(','),
  56. biz_type: bizType,
  57. biz_id: bizId
  58. }
  59. })
  60. }
  61. export default {
  62. advanceApi,
  63. reimburseApi,
  64. expenseItemApi,
  65. invoiceWalletApi,
  66. invoiceApi,
  67. attachmentApi
  68. }