import { postJ, post, get } from "@/utils/request";
import Vue from "vue";

// 物品信息列表
export async function getList(params) {
  const data = await get(
    Vue.prototype.apiUrl + "/main/category/getList",
    params
  );
  if (data.code == 0) {
    return data.data;
  }
  return Promise.reject(data.message);
}
// 根据生产版本ID查询bom子项列表
export async function bomSubListByVersionId(params) {
  const res = await get(
    Vue.prototype.apiUrl +
      `/main/produceversion/resource/bomSubListByVersionId/${params.versionId}/${params.taskInstanceId}`
  );
  if (res.code == 0) {
    return res.data;
  }
  return Promise.reject(res.message);
}
// 实例
export async function getByRootLevelId(levelId) {
  const res = await get(
    Vue.prototype.apiUrl + `/main/asset/getByRootLevelId/${levelId}`
  );
  if (res.code == 0) {
    return res.data;
  }
  return Promise.reject(res.message);
}
