tableColumns.api.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { defHttp } from '/@/utils/http/axios';
  2. import { Modal } from 'ant-design-vue';
  3. enum Api {
  4. list = '/safety/ventanalyShowColum/list',
  5. save = '/safety/ventanalyShowColum/add',
  6. edit = '/safety/ventanalyShowColum/edit',
  7. selectDevice = '/jeecg-system/sys/dict/DeviceKind/query',
  8. deleteById = '/safety/ventanalyShowColum/delete',
  9. importExcel = '/safety/ventanalyShowColum/importExcel',
  10. exportXls = '/safety/ventanalyShowColum/exportXls',
  11. }
  12. /**
  13. * 导出api
  14. * @param params
  15. */
  16. export const getExportUrl = Api.exportXls;
  17. /**
  18. * 导入api
  19. */
  20. export const getImportUrl = Api.importExcel;
  21. /**
  22. * 列表接口
  23. * @param params
  24. */
  25. export const list = (params) => {
  26. if (params['devicetype']) params['devicetype'] = params['devicetype'] + '*';
  27. return defHttp.get({ url: Api.list, params });
  28. };
  29. /**
  30. * 设备类型查询接口
  31. * @param params
  32. */
  33. export const selectDevice = (params) => defHttp.get({ url: Api.selectDevice, params });
  34. /**
  35. * 删除用户
  36. */
  37. export const deleteById = (params, handleSuccess) => {
  38. return defHttp.delete({ url: Api.deleteById, params }, { joinParamsToUrl: true }).then(() => {
  39. handleSuccess();
  40. });
  41. };
  42. /**
  43. * 批量删除用户
  44. * @param params
  45. */
  46. export const batchDeleteById = (params, handleSuccess) => {
  47. Modal.confirm({
  48. title: '确认删除',
  49. content: '是否删除选中数据',
  50. okText: '确认',
  51. cancelText: '取消',
  52. onOk: () => {
  53. return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
  54. handleSuccess();
  55. });
  56. },
  57. });
  58. };
  59. /**
  60. * 保存或者更新用户
  61. * @param params
  62. */
  63. export const saveOrUpdate = (params, isUpdate) => {
  64. const url = isUpdate ? Api.edit : Api.save;
  65. return isUpdate ? defHttp.put({ url: url, params }) : defHttp.post({ url: url, params });
  66. };