delivertNoticeForm.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. saleQuotationFormShipList = '/saleCode/saleQuotation/querySaleQuotationShipByMainId',
  14. saleQuotationFormProductList = '/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 querysaleQuotationFormShipListByMainId = (id) => defHttp.get({url: Api.saleQuotationFormShipList, params:{ id }});
  33. /**
  34. * 查询子表数据
  35. * @param params
  36. */
  37. export const querySaleQuotationFormProductListByMainId = (id) => defHttp.get({url: Api.saleQuotationFormProductList, params:{ id }});
  38. /**
  39. * 列表接口
  40. * @param params
  41. */
  42. export const list = (params) =>
  43. defHttp.get({url: Api.list, params});
  44. /**
  45. * 删除单个
  46. */
  47. export const deleteOne = (params,handleSuccess) => {
  48. return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
  49. handleSuccess();
  50. });
  51. }
  52. /**
  53. * 批量删除
  54. * @param params
  55. */
  56. export const batchDelete = (params, handleSuccess) => {
  57. createConfirm({
  58. iconType: 'warning',
  59. title: '确认删除',
  60. content: '是否删除选中数据',
  61. okText: '确认',
  62. cancelText: '取消',
  63. onOk: () => {
  64. return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
  65. handleSuccess();
  66. });
  67. }
  68. });
  69. }
  70. /**
  71. * 保存或者更新
  72. * @param params
  73. */
  74. export const saveOrUpdate = (params, isUpdate) => {
  75. let url = isUpdate ? Api.edit : Api.save;
  76. return defHttp.post({url: url, params});
  77. }
  78. //
  79. /**
  80. * 根据id查询数据
  81. * @param params
  82. */
  83. export const queryDataById = (id) => defHttp.get({url: Api.queryDataById, params:{ id }});
  84. // 提交
  85. export const batchSubmit = (params, handleSuccess) => {
  86. createConfirm({
  87. iconType: 'warning',
  88. title: '确认提交',
  89. content: '是否提交选中数据',
  90. okText: '确认',
  91. cancelText: '取消',
  92. onOk: () => {
  93. return defHttp.get({url: Api.submitBatch, params}, {joinParamsToUrl: true}).then(() => {
  94. handleSuccess();
  95. });
  96. }
  97. });
  98. }
  99. // 取消提交
  100. export const cancelBatchSubmit = (params, handleSuccess) => {
  101. createConfirm({
  102. iconType: 'warning',
  103. title: '确认取消提交',
  104. content: '是否取消提交选中数据',
  105. okText: '确认',
  106. cancelText: '取消',
  107. onOk: () => {
  108. return defHttp.get({url: Api.cancelSubmitBatch, params}, {joinParamsToUrl: true}).then(() => {
  109. handleSuccess();
  110. });
  111. }
  112. });
  113. }
  114. //获取供应商列表
  115. export const supplierOption = (params) => defHttp.get({url: Api.supplierList, params});