salesInvoiceForm.api.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import {defHttp} from '/@/utils/http/axios';
  2. import { useMessage } from "/@/hooks/web/useMessage";
  3. const { createConfirm } = useMessage();
  4. enum Api {
  5. list = '/saleCode/saleQuotation/list',
  6. save='/saleCode/saleQuotation/add',
  7. edit='/saleCode/saleQuotation/edit',
  8. deleteOne = '/saleCode/saleQuotation/delete',
  9. deleteBatch = '/saleCode/saleQuotation/deleteBatch',
  10. importExcel = '/saleCode/saleQuotation/importExcel',
  11. exportXls = '/saleCode/saleQuotation/exportXls',
  12. queryDataById = '/saleCode/saleQuotation/queryById',
  13. saleInvoiceFormShipList = '/saleCode/saleQuotation/querySaleQuotationShipByMainId',
  14. saleInvoiceDetailList = '/saleCode/saleQuotation/querySaleQuotationProductByMainId',
  15. submitBatch='/saleCode/saleQuotation/submitBatch',
  16. cancelSubmitBatch='/saleCode/saleQuotation/returnSubmitBatch',
  17. supplierList='/cuspCode/cuspSupplierProfile/list?pageSize=-1'
  18. }
  19. /**
  20. * 导出api
  21. * @param params
  22. */
  23. export const getExportUrl = Api.exportXls;
  24. /**
  25. * 导入api
  26. */
  27. export const getImportUrl = Api.importExcel;
  28. /**
  29. * 查询子表数据
  30. * @param params
  31. */
  32. export const querysaleInvoiceFormShipListByMainId = (id) => defHttp.get({url: Api.saleInvoiceFormShipList, params:{ id }});
  33. /**
  34. * 查询子表数据
  35. * @param params
  36. */
  37. export const querySaleInvoiceDetailListByMainId = (id) => defHttp.get({url: Api.saleInvoiceDetailList, params:{ id }});
  38. /**
  39. * 列表接口
  40. * @param params
  41. */
  42. export const list = (params) =>
  43. defHttp.get({url: Api.list, params});
  44. // 供应商列表接口
  45. export const listSupplier = (params) =>
  46. defHttp.get({url: Api.supplierList, params});
  47. /**
  48. * 删除单个
  49. */
  50. export const deleteOne = (params,handleSuccess) => {
  51. return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
  52. handleSuccess();
  53. });
  54. }
  55. /**
  56. * 批量删除
  57. * @param params
  58. */
  59. export const batchDelete = (params, handleSuccess) => {
  60. createConfirm({
  61. iconType: 'warning',
  62. title: '确认删除',
  63. content: '是否删除选中数据',
  64. okText: '确认',
  65. cancelText: '取消',
  66. onOk: () => {
  67. return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
  68. handleSuccess();
  69. });
  70. }
  71. });
  72. }
  73. /**
  74. * 保存或者更新
  75. * @param params
  76. */
  77. export const saveOrUpdate = (params, isUpdate) => {
  78. let url = isUpdate ? Api.edit : Api.save;
  79. return defHttp.post({url: url, params});
  80. }
  81. //
  82. /**
  83. * 根据id查询数据
  84. * @param params
  85. */
  86. export const queryDataById = (id) => defHttp.get({url: Api.queryDataById, params:{ id }});
  87. // 提交
  88. export const batchSubmit = (params, handleSuccess) => {
  89. createConfirm({
  90. iconType: 'warning',
  91. title: '确认提交',
  92. content: '是否提交选中数据',
  93. okText: '确认',
  94. cancelText: '取消',
  95. onOk: () => {
  96. return defHttp.get({url: Api.submitBatch, params}, {joinParamsToUrl: true}).then(() => {
  97. handleSuccess();
  98. });
  99. }
  100. });
  101. }
  102. // 取消提交
  103. export const cancelBatchSubmit = (params, handleSuccess) => {
  104. createConfirm({
  105. iconType: 'warning',
  106. title: '确认取消提交',
  107. content: '是否取消提交选中数据',
  108. okText: '确认',
  109. cancelText: '取消',
  110. onOk: () => {
  111. return defHttp.get({url: Api.cancelSubmitBatch, params}, {joinParamsToUrl: true}).then(() => {
  112. handleSuccess();
  113. });
  114. }
  115. });
  116. }