import request from '@/utils/request'

// 查询bom明细列表
export function listDetails(query) {
  return request({
    url: '/system/details/list',
    method: 'get',
    params: query
  })
}

// 查询bom明细详细
export function getDetails(id) {
  return request({
    url: '/system/details/' + id,
    method: 'get'
  })
}

export function updateFBl(data) {
  return request({
    url: '/system/details/updateFBMaterial',
    method: 'post',
    data: data
  })
}

// 获取BOM上传状态
export function viewGetBomUploadStatus(rooteProdet) {
  return request({
    url: '/system/details/viewGetBomUploadStatus',
    method: 'post',
    params: {
      rooteProdet: rooteProdet
    }
  })
}
// 获取项目令号列表
export function getProjectCodes(query) {
  return request({
    url: '/system/route/getDistinctProjectCodes',  // 你的项目令号接口路径
    method: 'get',
    params: { query }  // 如果需要传递查询参数
  });
}

// 新增bom明细
export function addDetails(data) {
  return request({
    url: '/system/details',
    method: 'post',
    data: data
  })
}

// 修改bom明细
export function updateDetails(data) {
  return request({
    url: '/system/details',
    method: 'put',
    data: data
  })
}

// 删除bom明细
export function delDetails(id) {
  return request({
    url: '/system/details/' + id,
    method: 'delete'
  })
}

// 导入电气BOM（Excel）
export function importElectricalBom(formData) {
  return request({
    url: '/system/details/importElectricalBom',
    method: 'post',
    data: formData,
    headers: { 'Content-Type': 'multipart/form-data' }
  })
}
