import { middlewareHttpUtils } from '@/utils/http/middlewareHttpUtils';

export class businessSpaceController {
  static middlewareHttpUtilsInstance = new middlewareHttpUtils();

  //项目关系类型查询
  static async getrelationTypeProject(param, call) {
    var result = await this.middlewareHttpUtilsInstance.postRequest('/graphic/relation_type_project', param);
    result.content = result.content || result.data;
    call(result);

    // let url = '/datacenter/graphic/relation_type_project';
    // http.postJson(url, param, success)
  }

  //关系-----统计 属于多建筑楼层的空间
  static async getSpaceBdFlCount(param, call) {
    var result = await this.middlewareHttpUtilsInstance.postRequest('/space/space-bd-fl', param);
    result.content = result.content || result.data;
    call(result);
    // let url = '/equip-component/space/space-bd-fl';
    // http.postJson(url, param, success)
  }

  // 查询业务空间分区类型包含其他
  static async queryAllZoneType(param, call) {
    var result = await this.middlewareHttpUtilsInstance.postRequest('/object/zone/type', param);
    result.content = result.content || result.data;
    call(result);
    // let url = '/datacenter/object/zone/type';
    // http.postJson(url, param, success)
  }

  // 查询建筑楼层-统计业务空间state
  static async queryBFloorWithState(param, call) {
    var result = await this.middlewareHttpUtilsInstance.postRequest('/object/zone/building-floor', param);
    result.content = result.content || result.data;
    call(result);
    // let url = '/datacenter/object/zone/building-floor';
    // http.postJson(url, param, success)
  }

  //查询分区对象信息
  static async zoneCount(param, call) {
    var result = await this.middlewareHttpUtilsInstance.postRequest('/object/zone/count', param);
    result.content = result.content || result.data;
    call(result);
    // let url = '/datacenter/object/zone/count'
    // http.postJson(url, param, success)
  }

  //关系-----业务空间内的元空间，业务空间一对多,累计添加会覆盖以前记录
  static async createRelateInZoneAndISp(param, success) {
    var result = await this.middlewareHttpUtilsInstance.postRequest('/rel/si-in-sp-base/link-sp?type=' + param.type, param.data);
    success(result);
  }

  //关系-----未关联业务空间的元空间
  static async getIspNotInSpace(param, success) {
    var result = await this.middlewareHttpUtilsInstance.postRequest(`/space/unspace-ispace?objectType=${param.objectType}`, param.data);
    result.content = result.content || result.data;
    success(result);
  }

  //关系-----业务空间内的元空间，创建业务空间内的元空间关系, 累计添加不会覆盖-批量关联
  static async groupCreRelaZoneAndISp(param, success) {
    let url = `/rel/si-in-sp-base/link-list?type=${param.type}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    result.content = result.content || result.data;
    success(result);
  }

  //关系-----统计 属于多建筑楼层的空间数据
  static async getSpaceBdFlData(param, success) {
    let url = `/space/space-bd-fl-data`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param);
    result.content = result.content || result.data;
    success(result);
  }

  //关系-----业务空间所属建筑楼层修改
  static async updateRelateInSpAndBuild(param, success) {
    let url = `/update-relationship/update-sp`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param);
    result.content = result.content || result.data;
    success(result);
  }

  //关系-----设备所在业务空间--删除关系
  static async eqInSpaceDelete(param, success) {
    let url = `/rel/eq-in-sp-base/unlink-list?type=${param.type}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    success(result);
  }

  //关系-----设备服务业务空间--删除关系
  static async eqForSpaceDelete(param, success) {
    let url = `/rel/eq-for-sp-base/unlink-list?type=${param.type}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    success(result);
  }

  //关系-----没有和当前空间绑定的设备
  static async notEqInSpaceQuery(param, success) {
    let url = `/space/unspace-in-eq?type=${param.type}&spaceId=${param.spaceId}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    result.content = result.content || result.data;
    success(result);
  }

  //关系-----未服务当前空间的设备
  static async notEqForSpaceQuery(param, success) {
    let url = `/space/unspace-for-eq?type=${param.type}&spaceId=${param.spaceId}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    result.content = result.content || result.data;
    success(result);
  }

  //关系-----设备所在业务空间--创建关系
  static async eqInSpaceCreate(param, success) {
    let url = `/rel/eq-in-sp-base/link-eq-sp?type=${param.type}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    success(result);
  }

  //关系-----设备服务业务空间--创建关系
  static async eqForSpaceCreate(param, success) {
    let url = `/rel/eq-for-sp-base/link-eq-sp?type=${param.type}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    success(result);
  }

  //关系-----空间内没有和空间关联的设备 根据坐标计算(专用接口)
  static async getEqNotInSpace(param, success) {
    let url = `/space/unspace-fIn-eq-point?spaceId=${param.spaceId}&type=${param.type}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    result.content = result.content || result.data;
    success(result);
  }

  //关系-----空间内没有服务空间的设备 根据坐标计算(专用接口)
  static async getEqNotForSpace(param, success) {
    let url = `/space/unspace-for-eq-point?spaceId=${param.spaceId}&type=${param.type}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    result.content = result.content || result.data;
    success(result);
  }

  //关系-----系统所在业务空间--删除关系
  static async syInSpaceDelete(param, success) {
    let url = `/rel/sy-in-sp-base/unlink-list?type=${param.type}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    success(result);
  }

  //关系-----没有和当前空间绑定的系统
  static async notSyInSpaceQuery(param, success) {
    let url = `/space/unspace-in-sys?type=${param.type}&spaceId=${param.spaceId}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    result.content = result.content || result.data;
    success(result);
  }

  //关系-----系统所在业务空间--创建关系
  static async syInSpaceCreate(param, success) {
    let url = `/rel/sy-in-sp-base/link-sp-sys?type=${param.type}`;
    var result = await this.middlewareHttpUtilsInstance.postRequest(url, param.data);
    success(result);
  }

}