import request from '@/config/axios'

// 保养工单明细 VO
export interface IotMainWorkOrderDetailsVO {
  id: number // 主键id
  planId: number // 保养计划id
  workOrderId: number // 保养工单id
  deviceId: number // 设备id
  deviceAssetNumber: string // 设备资产编号
  deviceName: string // 设备名称
  deviceCategory: string // 设备类别
  deviceBrand: string // 设备品牌
  runningKilometers: number // 当前运行公里数(km)
  runningTime: number // 当前运行时间(小时)
  naturalDate: number // 自然日期(天)
  remark: string // 备注
  sort: number // 排序
  status: number // 状态 0启用  1停用
}

// 保养工单明细 API
export const IotMainWorkOrderDetailsApi = {
  // 查询保养工单明细分页
  getIotMainWorkOrderDetailsPage: async (params: any) => {
    return await request.get({ url: `/pms/iot-main-work-order-details/page`, params })
  },

  // 查询保养工单明细详情
  getIotMainWorkOrderDetails: async (id: number) => {
    return await request.get({ url: `/pms/iot-main-work-order-details/get?id=` + id })
  },

  // 新增保养工单明细
  createIotMainWorkOrderDetails: async (data: IotMainWorkOrderDetailsVO) => {
    return await request.post({ url: `/pms/iot-main-work-order-details/create`, data })
  },

  // 修改保养工单明细
  updateIotMainWorkOrderDetails: async (data: IotMainWorkOrderDetailsVO) => {
    return await request.put({ url: `/pms/iot-main-work-order-details/update`, data })
  },

  // 删除保养工单明细
  deleteIotMainWorkOrderDetails: async (id: number) => {
    return await request.delete({ url: `/pms/iot-main-work-order-details/delete?id=` + id })
  },

  // 导出保养工单明细 Excel
  exportIotMainWorkOrderDetails: async (params) => {
    return await request.download({ url: `/pms/iot-main-work-order-details/export-excel`, params })
  },
}
