import request from '@/config/axios'

// 设备计量信息 VO
export interface MeasurementVO {
  id: number // 主键
  deviceId: number // 设备ID
  measurementNumber: string // 计量编号
  measurementRange: string // 计量范围
  allowableError: string // 允许误差
  measurementPoint: string // 计量点位
  manageLeavel: string // 管理等级
  instrumentPrecision: string // 仪器精度
  measurementMethod: string // 计量方式
  lastMeasurementDate: Date // 上次计量日期
  nextMeasurementDate: Date // 下次计量日期
  measurementCycle: string // 计量周期
  reminderTime: string // 提醒时间
  responsiblePerson: string // 负责人
  description: string // 说明
}

// 设备计量信息 API
export const MeasurementApi = {
  // 查询设备计量信息分页
  getMeasurementPage: async (params: any) => {
    return await request.get({ url: `/device/measurement/page`, params })
  },

  // 查询设备计量信息详情
  getMeasurement: async (id: number) => {
    return await request.get({ url: `/device/measurement/get?id=` + id })
  },
  // 查询设备计量信息详情
  getMeasurementByDeviceId: async (deviceId: number) => {
    return await request.get({ url: `/device/measurement/getByDeviceId?deviceId=` + deviceId })
  },

  // 新增设备计量信息
  createMeasurement: async (data: MeasurementVO) => {
    return await request.post({ url: `/device/measurement/create`, data })
  },

  // 修改设备计量信息
  updateMeasurement: async (data: MeasurementVO) => {
    return await request.put({ url: `/device/measurement/update`, data })
  },

  // 删除设备计量信息
  deleteMeasurement: async (id: number) => {
    return await request.delete({ url: `/device/measurement/delete?id=` + id })
  },

  // 导出设备计量信息 Excel
  exportMeasurement: async (params) => {
    return await request.download({ url: `/device/measurement/export-excel`, params })
  },
}
