bx.js 2.7 KB

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