import request from '@/config/axios'

export interface QualityGradeVO {
  id?: number
  code?: string
  name: string
  remark?: string
  createTime?: Date
}

export interface QualityGradePageReqVO {
  pageNo: number
  pageSize: number
  code?: string
  name?: string
}

// 查询质检等级分页
export const getQualityGradePage = (params: QualityGradePageReqVO) => {
  return request.get({ url: '/mes/quality-grade/page', params })
}

// 查询质检等级详情
export const getQualityGrade = (id: number) => {
  return request.get({ url: '/mes/quality-grade/get', params: { id } })
}

// 新增质检等级
export const createQualityGrade = (data: QualityGradeVO) => {
  return request.post({ url: '/mes/quality-grade/create', data })
}

// 修改质检等级
export const updateQualityGrade = (data: QualityGradeVO) => {
  return request.put({ url: '/mes/quality-grade/update', data })
}

// 删除质检等级
export const deleteQualityGrade = (id: number) => {
  return request.delete({ url: '/mes/quality-grade/delete', params: { id } })
}

// 获取质检等级列表
export const getQualityGradeList = () => {
  return request.get({ url: '/mes/quality-grade/list' })
}

// 导出质检等级 Excel
export const exportQualityGrade = (params: QualityGradePageReqVO) => {
  return request.download({ url: '/mes/quality-grade/export-excel', params })
}
