import request from '@/config/axios'

// 设备巡检标准 VO
export interface InspectionStandardVO {
  id: number // 主键ID
  standNo: string // 流水号
  standName: string // 名称
  state: number // 状态
  sort: number // 排序
}

// 设备巡检标准 API
export const InspectionStandardApi = {
  // 查询设备巡检标准分页
  getInspectionStandardPage: async (params: any) => {
    return await request.get({ url: `/device/inspection-standard/page`, params })
  },

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

  // 新增设备巡检标准
  createInspectionStandard: async (data: InspectionStandardVO) => {
    return await request.post({ url: `/device/inspection-standard/create`, data })
  },

  // 修改设备巡检标准
  updateInspectionStandard: async (data: InspectionStandardVO) => {
    return await request.put({ url: `/device/inspection-standard/update`, data })
  },

  // 删除设备巡检标准
  deleteInspectionStandard: async (id: number) => {
    return await request.delete({ url: `/device/inspection-standard/delete?id=` + id })
  },

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

  // 导出设备巡检标准 Excel
  exportInspectionStandard: async (params) => {
    return await request.download({ url: `/device/inspection-standard/export-excel`, params })
  },

// ==================== 子表（设备巡检标准内容） ====================

  // 获得设备巡检标准内容列表
  getInspectionStandardItemListByStandId: async (standId) => {
    return await request.get({ url: `/device/inspection-standard/inspection-standard-item/list-by-stand-id?standId=` + standId })
  },
    getInspectionStandardScopeListByStandId: async (standId) => {
      return await request.get({ url: `/device/inspection-standard/inspection-standard-scope/list-by-stand-id?standId=` + standId })

    }
}
