PadLockType.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { request } from '../utils/axios';
  2. export interface PadLockTypeVO {
  3. lockTypeId?: number;
  4. parentTypeId?: number;
  5. lockTypeCode: string;
  6. lockTypeName: string;
  7. enableFlag?: string;
  8. remark?: string;
  9. createBy?: string;
  10. createTime?: Date;
  11. updateBy?: string;
  12. updateTime?: Date;
  13. }
  14. export interface PageParam {
  15. pageNo: number;
  16. pageSize: number;
  17. lockTypeCode?: string;
  18. lockTypeName?: string;
  19. enableFlag?: string;
  20. }
  21. // 分页响应类型
  22. export interface PageResponse<T> {
  23. list: T[];
  24. total: number;
  25. }
  26. // 挂锁类型管理 API
  27. export const padLockTypeApi = {
  28. // 查询挂锁类型-列表
  29. listPadLockType: async (params: PageParam): Promise<PageResponse<PadLockTypeVO>> => {
  30. const response = await request.get({
  31. url: '/iscs/lock-type/getLockTypePage',
  32. params
  33. });
  34. // 处理响应数据格式
  35. if (response && typeof response === 'object') {
  36. if ('data' in response && response.data) {
  37. return response.data;
  38. } else if ('list' in response || 'records' in response) {
  39. return {
  40. list: response.list || response.records || [],
  41. total: response.total || 0,
  42. };
  43. }
  44. }
  45. return response;
  46. },
  47. // 获取挂锁类型详细信息
  48. getPadLockTypeInfo: async (id: number): Promise<PadLockTypeVO> => {
  49. const response = await request.get({
  50. url: '/iscs/lock-type/selectLockTypeById',
  51. params: { id }
  52. });
  53. return response?.data || response;
  54. },
  55. // 新增挂锁类型
  56. addPadLockType: async (data: PadLockTypeVO): Promise<void> => {
  57. return await request.post({
  58. url: '/iscs/lock-type/insertLockType',
  59. data
  60. });
  61. },
  62. // 修改挂锁类型信息
  63. updatePadLockType: async (data: PadLockTypeVO): Promise<void> => {
  64. return await request.put({
  65. url: '/iscs/lock-type/updateLockType',
  66. data
  67. });
  68. },
  69. // 删除挂锁类型信息
  70. delPadLockType: async (ids: number | number[]): Promise<void> => {
  71. const idsParam = Array.isArray(ids) ? ids.join(',') : ids;
  72. return await request.delete({
  73. url: `/iscs/lock-type/deleteLockTypeList?ids=${idsParam}`,
  74. });
  75. },
  76. };