import request from '@/config/axios'

// 设备保养标准 VO
export interface MaintenanceStandardVO {
  standNo: string // 流水号
  standName: string // 名称
  state: number // 状态
  sort: number // 排序
}

// 设备保养标准 API
export const MaintenanceStandardApi = {
  // 查询设备保养标准分页
  getMaintenanceStandardPage: async (params: any) => {
    return await request.get({ url: `/device/maintenance-standard/page`, params })
  },

  // 查询设备保养标准详情
  getMaintenanceStandard: async (id: number) => {
    return await request.get({ url: `/device/maintenance-standard/get?id=` + id })
  },

  // 新增设备保养标准
  createMaintenanceStandard: async (data: MaintenanceStandardVO) => {
    return await request.post({ url: `/device/maintenance-standard/create`, data })
  },

  // 修改设备保养标准
  updateMaintenanceStandard: async (data: MaintenanceStandardVO) => {
    return await request.put({ url: `/device/maintenance-standard/update`, data })
  },

  // 删除设备保养标准
  deleteMaintenanceStandard: async (id: number) => {
    return await request.delete({ url: `/device/maintenance-standard/delete?id=` + id })
  },

  // 批量删除设备保养标准
  deleteMaintenanceStandardList: async (ids: number[]) => {
    return await request.delete({ url: `/device/maintenance-standard/delete-list?ids=` + ids  })
  },

  // 导出设备保养标准 Excel
  exportMaintenanceStandard: async (params) => {
    return await request.download({ url: `/device/maintenance-standard/export-excel`, params })
  },

// ==================== 子表（设备保养标准耗材） ====================

  // 获得设备保养标准耗材列表
  getMaintenanceStandardConsumableListByStandId: async (standId) => {
    return await request.get({ url: `/device/maintenance-standard/maintenance-standard-consumable/list-by-stand-id?standId=` + standId })
  },

// ==================== 子表（设备保养标准内容） ====================

  // 获得设备保养标准内容列表
  getMaintenanceStandardItemListByStandId: async (standId) => {
    return await request.get({ url: `/device/maintenance-standard/maintenance-standard-item/list-by-stand-id?standId=` + standId })
  },
}
