import request from "@/utils/request";

// 查询根据层级指标库
export function getIndicatorByParentId(parentId, type) {
  return request({
    url: '/evaluate/indicator/getIndicatorByParentId',
    method: "get",
    params: {
      parentId,
      type
    }
  });
}

/**
 * 新增指标
 * @param {*} data 
 * @returns 
 */
export function addIndicator(data) {
  return request({
    url: `/evaluate/indicator/indicator/insert`,
    method: "post",
    data
  });
}

/**
 * 删除指标
 * @param {*} id 
 * @returns 
 */
export function deleteIndicator(id) {
  return request({
    url: `/evaluate/indicator/${id}`,
    method: "delete",
  });
}

/**
 * 修改指标
 * @param {*} id 
 * @returns 
 */
export function updateIndicator(data) {
  return request({
    url: `/evaluate/indicator`,
    method: "put",
    data
  });
}

/**
 * 获取指定层级的指标
 * @param {*} id 
 * @returns 
 */
export function getChildrenByParentIdWithLevelLimitApi(parentId, maxLevel, type) {
  return request({
    url: `/evaluate/indicator/getChildrenByParentIdWithLevelLimit`,
    method: "get",
    params: {
      parentId,
      maxLevel,
      type
    }
  });
}