import request from '@/config/axios'

// 物料 VO
export interface QualityMaterialVO {
  id: number // 主键ID
  materialName: string // 物料名称
  materialCode: string // 物料编号
}

// 物料 API
export const QualityMaterialApi = {
  // 查询物料分页
  getQualityMaterialPage: async (params: any) => {
    return await request.get({ url: `/contract/quality-material/page`, params })
  },

  // 查询物料详情
  getQualityMaterial: async (id: number) => {
    return await request.get({ url: `/contract/quality-material/get?id=` + id })
  },

  // 新增物料
  createQualityMaterial: async (data: QualityMaterialVO) => {
    return await request.post({ url: `/contract/quality-material/create`, data })
  },

  // 修改物料
  updateQualityMaterial: async (data: QualityMaterialVO) => {
    return await request.put({ url: `/contract/quality-material/update`, data })
  },

  // 删除物料
  deleteQualityMaterial: async (id: number) => {
    return await request.delete({ url: `/contract/quality-material/delete?id=` + id })
  },

  // 导出物料 Excel
  exportQualityMaterial: async (params) => {
    return await request.download({ url: `/contract/quality-material/export-excel`, params })
  }
}