import request from '@/config/axios'

// 设备调拨日志 VO
export interface IotDeviceAllotLogVO {
  id: number // 主键id
  deviceId: number // 设备id
  oldDeptId: number // 设备调拨前部门
  newDeptId: number // 设备调拨后部门
  reason: string // 设备调拨原因
  remark: string // 备注
  deviceCode: string    // 设备编码
  deviceName: string    // 设备名称
  creatorName: string   // 操作人姓名
  oldDeptName: string   // 设备调拨前部门名称
  newDeptName: string   // 设备调拨后部门名称
}

// 设备调拨日志 API
export const IotDeviceAllotLogApi = {
  // 查询设备调拨日志分页
  getIotDeviceAllotLogPage: async (params: any) => {
    return await request.get({ url: `/pms/iot-device-allot-log/page`, params })
  },

  // 查询设备调拨日志详情
  getIotDeviceAllotLog: async (id: number) => {
    return await request.get({ url: `/pms/iot-device-allot-log/get?id=` + id })
  },

  // 新增设备调拨日志
  createIotDeviceAllotLog: async (data: IotDeviceAllotLogVO) => {
    return await request.post({ url: `/pms/iot-device-allot-log/create`, data })
  },

  // 修改设备调拨日志
  updateIotDeviceAllotLog: async (data: IotDeviceAllotLogVO) => {
    return await request.put({ url: `/pms/iot-device-allot-log/update`, data })
  },

  // 删除设备调拨日志
  deleteIotDeviceAllotLog: async (id: number) => {
    return await request.delete({ url: `/pms/iot-device-allot-log/delete?id=` + id })
  },

  // 导出设备调拨日志 Excel
  exportIotDeviceAllotLog: async (params) => {
    return await request.download({ url: `/pms/iot-device-allot-log/export-excel`, params })
  },
}
