SelectionQuotationForm.api.ts 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. import {defHttp} from '/@/utils/http/axios';
  2. import { useMessage } from "/@/hooks/web/useMessage";
  3. const { createConfirm } = useMessage();
  4. enum Api {
  5. list = '/purCode/purQuotationSelection/list',
  6. save='/purCode/purQuotationSelection/add',
  7. edit='/purCode/purQuotationSelection/edit',
  8. deleteOne = '/purCode/purQuotationSelection/delete',
  9. deleteBatch = '/purCode/purQuotationSelection/deleteBatch',
  10. importExcel = '/purCode/purQuotationSelection/importExcel',
  11. exportXls = '/purCode/purQuotationSelection/exportXls',
  12. queryDataById = '/purCode/purQuotationSelection/queryById',
  13. purCodeSelectFormShipList = '/purCode/purQuotationSelection/queryPurQuotationSelectionShipByMainId',
  14. purCodeSelectFormProductList = '/purCode/purQuotationSelection/queryPurQuotationSelectionProductByMainId',
  15. submitBatch='/purCode/purQuotationSelection/submitBatch',
  16. cancelSubmitBatch='/purCode/purQuotationSelection/returnSubmitBatch',
  17. classList='baseCode/baseProductClass/list',
  18. projectList='/baseCode/baseProjectArchive/list',
  19. approvalBatch='/purCode/purQuotationSelection/approvalBatch',
  20. }
  21. /**
  22. * 导出api
  23. * @param params
  24. */
  25. export const getExportUrl = Api.exportXls;
  26. /**
  27. * 导入api
  28. */
  29. export const getImportUrl = Api.importExcel;
  30. /**
  31. * 查询子表数据
  32. * @param params
  33. */
  34. export const SelectQuotationFormShippTable = (id) => defHttp.get({url: Api.purCodeSelectFormShipList, params:{ id }});
  35. /**
  36. * 查询子表数据
  37. * @param params
  38. */
  39. export const SelectQuotationFormProductListByMainId = (id) => defHttp.get({url: Api.purCodeSelectFormProductList, params:{ id }});
  40. /**
  41. * 列表接口
  42. * @param params
  43. */
  44. export const list = (params) =>
  45. defHttp.get({url: Api.list, params});
  46. /**
  47. * 删除单个
  48. */
  49. export const deleteOne = (params,handleSuccess) => {
  50. return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
  51. handleSuccess();
  52. });
  53. }
  54. /**
  55. * 批量删除
  56. * @param params
  57. */
  58. export const batchDelete = (params, handleSuccess) => {
  59. createConfirm({
  60. iconType: 'warning',
  61. title: '确认删除',
  62. content: '是否删除选中数据',
  63. okText: '确认',
  64. cancelText: '取消',
  65. onOk: () => {
  66. return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
  67. handleSuccess();
  68. });
  69. }
  70. });
  71. }
  72. /**
  73. * 保存或者更新
  74. * @param params
  75. */
  76. export const saveOrUpdate = (params, isUpdate) => {
  77. let url = isUpdate ? Api.edit : Api.save;
  78. return defHttp.post({url: url, params});
  79. }
  80. /**
  81. * 根据id查询数据
  82. * @param params
  83. */
  84. export const queryDataById = (id) => defHttp.get({url: Api.queryDataById, params:{ id }});
  85. // 提交
  86. export const batchSubmit = (params, handleSuccess) => {
  87. createConfirm({
  88. iconType: 'warning',
  89. title: '确认提交',
  90. content: '是否提交选中数据',
  91. okText: '确认',
  92. cancelText: '取消',
  93. onOk: () => {
  94. return defHttp.get({url: Api.submitBatch, params}, {joinParamsToUrl: true}).then(() => {
  95. handleSuccess();
  96. });
  97. }
  98. });
  99. }
  100. // 取消提交
  101. export const cancelBatchSubmit = (params, handleSuccess) => {
  102. createConfirm({
  103. iconType: 'warning',
  104. title: '确认取消提交',
  105. content: '是否取消提交选中数据',
  106. okText: '确认',
  107. cancelText: '取消',
  108. onOk: () => {
  109. return defHttp.get({url: Api.cancelSubmitBatch, params}, {joinParamsToUrl: true}).then(() => {
  110. handleSuccess();
  111. });
  112. }
  113. });
  114. }
  115. // 审批
  116. export const approvalBatch = (params, handleSuccess) => {
  117. createConfirm({
  118. iconType: 'warning',
  119. title: '确认审批',
  120. content: '是否审批选中数据',
  121. okText: '确认',
  122. cancelText: '取消',
  123. onOk: () => {
  124. return defHttp.get({url: Api.approvalBatch, params}, {joinParamsToUrl: true}).then(() => {
  125. handleSuccess();
  126. });
  127. }
  128. });
  129. }
  130. //获取项目下拉框列表
  131. export const ProjectOption = (params) => defHttp.get({ url: Api.projectList, params });
  132. /**
  133. * 分类列表接口
  134. * @param params
  135. */
  136. export const ClassList = (params) =>
  137. defHttp.get({url: Api.classList, params});