import { baseHttpUtils } from "@/utils/http/baseHttpUtils";
import { dict_pre, equipcomponentdic_pre } from "./preTypes";
class Dic {
  static http = new baseHttpUtils();

  /**
   * @description: all - 查询数据字典 --列表表头 api/dict
   * @param {*} params
   * @return {*}
   */
  static async getDataDictionary(params, fn) {
    const res = await Dic.http.postRequest(`${dict_pre}/query`, params);
    res.content = res.content || res.data;
    return fn ? fn(res) : res;
  }

  /**
   * @description: 统计-根据条件统计返回信息点
   * @param {*} params
   * @return {*}
   */
  static async deliveredInfos(params, fn) {
    const res = await Dic.http.postRequest(
      dict_pre + "/delivered/infos",
      params
    );
    res.content = res.content || res.data;
    return fn ? fn(res) : res;
  }
  /**
   * 字典-项目下已有的设备类型带系统
   * @param params
   * @returns
   */
  static async getEquipLkSys(params) {
    return await Dic.http.postRequest(
      dict_pre + "/system/equip/category",
      params
    );
  }

  /**
   *  @description: 头部信息查询(查询所有设备类型-所有部件类型-所有系统类型-所有专业类型)
   *  @param {*}
   *  @return {*}
   */
  static async queryPhysicsAllType(params) {
    return await Dic.http.postRequest(dict_pre + "/category", params);
  }
  /**
   *  @description: 设置项目数据字典显隐 --列表表头 api/dict
   *  @param {*}
   *  @return {*}
   */
  static async setDataDictionary(params, fn) {
    const res = await Dic.http.postRequest(
      dict_pre + "/setting-dic-project",
      params
    );
    return fn ? fn(res) : res;
  }
}

export default Dic;
