tableColumns.api.ts 1.8 KB

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