import request from '@/config/axios'

// 基地维修记录 VO
export interface IotJdRecordVO {
  id: number // 主键id
  deviceId: number // 设备id
  repairTime: Date // 维修日期时间
  repairContent: string // 维修内容
  pic: string // 图片
  solution: string // 解决办法
  remark: string // 备注
  deviceName: string // 设备名称
  repairPersonName: string
  repairPerson: string
}

// 基地维修记录 API
export const IotJdRecordApi = {
  getIotJdRecordByRepairId: async (id: any) => {
    return await request.get({ url: `/rq/iot-jd-record/repair?repairId=` + id })
  },
  // 查询基地维修记录分页
  getIotJdRecordPage: async (params: any) => {
    return await request.get({ url: `/rq/iot-jd-record/page`, params })
  },

  // 查询基地维修记录详情
  getIotJdRecord: async (id: number) => {
    return await request.get({ url: `/rq/iot-jd-record/get?id=` + id })
  },
  getIotJdRecordAssist: async (id: number) => {
    return await request.get({ url: `/rq/iot-jd-record/assist/`+id})
  },
  // 新增基地维修记录
  createIotJdRecord: async (data: IotJdRecordVO) => {
    return await request.post({ url: `/rq/iot-jd-record/create`, data })
  },

  // 修改基地维修记录
  updateIotJdRecord: async (data: IotJdRecordVO) => {
    return await request.put({ url: `/rq/iot-jd-record/update`, data })
  },

  // 删除基地维修记录
  deleteIotJdRecord: async (id: number) => {
    return await request.delete({ url: `/rq/iot-jd-record/delete?id=` + id })
  },

  // 导出基地维修记录 Excel
  exportIotJdRecord: async (params) => {
    return await request.download({ url: `/rq/iot-jd-record/export-excel`, params })
  },
}
