import request from '@/utils/request';

// 产品关联物料
export async function productTieUpMaterial(data) {
  const res = await request.post(`/main/category/productTieUpMaterial`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 查询产品已关联物料信息
export async function getRelatesInformationList(data) {
  const res = await request.post(
    `/main/category/getRelatesInformationList`,
    data
  );
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 查询未关联产品物料信息
export async function unassociated(data) {
  const res = await request.post(`/main/category/unassociated`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 获取产品bom信息
export async function getCategoryBom(categoryId) {
  const res = await request.get(`/main/category/getCategoryBom/${categoryId}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
