import { Common } from 'pc-component-v3';

/**
 * 工具类自动生成的API，请勿做任何修改，请勿做任何修改，请勿做任何修改（重要的事情说3遍）
 * 工具作者: 杨志杰
 * 查询窗口资源类 
 */
export default {

  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 *  
	 */
  queryInfoRootTreeItems: function(treeQueryParamDto){
    var requestUrl = 'InfoWindowResource/QueryInfoRootTreeItems';
    return new Promise((resolve, reject) => {
      $.ajax({
        url: Common.getApiURL(requestUrl),
        type: 'post',
        contentType: 'application/json',
        dataType: 'json',
        data: JSON.stringify(treeQueryParamDto),
				
        beforeSend: function(request) {
          Common.addTokenToRequest(request);
        },
        success: function(data) {
          resolve(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          reject(XMLHttpRequest);
        },
      });
    });
  },

  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 *  
	 */
  queryInfoSubTreeItems: function(treeQueryParamDto){
    var requestUrl = 'InfoWindowResource/QueryInfoSubTreeItems';
    return new Promise((resolve, reject) => {
      $.ajax({
        url: Common.getApiURL(requestUrl),
        type: 'post',
        contentType: 'application/json',
        dataType: 'json',
        data: JSON.stringify(treeQueryParamDto),
				
        beforeSend: function(request) {
          Common.addTokenToRequest(request);
        },
        success: function(data) {
          resolve(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          reject(XMLHttpRequest);
        },
      });
    });
  },

  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 *  
	 */
  queryInfoTreeItems: function(infoQueryParam){
    var requestUrl = 'InfoWindowResource/QueryInfoTreeItems';
    return new Promise((resolve, reject) => {
      $.ajax({
        url: Common.getApiURL(requestUrl),
        type: 'post',
        contentType: 'application/json',
        dataType: 'json',
        data: JSON.stringify(infoQueryParam),
				
        beforeSend: function(request) {
          Common.addTokenToRequest(request);
        },
        success: function(data) {
          resolve(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          reject(XMLHttpRequest);
        },
      });
    });
  },

  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 *  
	 */
  queryInfoTreeItemsForSimple: function(infoQueryParam){
    var requestUrl = 'InfoWindowResource/QueryInfoTreeItemsForSimple';
    return new Promise((resolve, reject) => {
      $.ajax({
        url: Common.getApiURL(requestUrl),
        type: 'post',
        contentType: 'application/json',
        dataType: 'json',
        data: JSON.stringify(infoQueryParam),
				
        beforeSend: function(request) {
          Common.addTokenToRequest(request);
        },
        success: function(data) {
          resolve(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          reject(XMLHttpRequest);
        },
      });
    });
  },

  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 获取查询窗口的数据 
	 */
  queryInfoWindowData: function(start, length, infoWindowNo, whereClause, sortClause){
    var requestUrl = 'InfoWindowResource/QueryInfoWindowData';
    var paramCount = 0;
    if(start != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('start=' + start);
      paramCount ++;
    }
    if(length != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('length=' + length);
      paramCount ++;
    }
    if(infoWindowNo != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('infoWindowNo=' + infoWindowNo);
      paramCount ++;
    }
    if(whereClause != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('whereClause=' + whereClause);
      paramCount ++;
    }
    if(sortClause != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('sortClause=' + sortClause);
      paramCount ++;
    }
    return new Promise((resolve, reject) => {
      $.ajax({
        url: Common.getApiURL(requestUrl),
        type: 'get',
				
        dataType: 'json',
				
				
        beforeSend: function(request) {
          Common.addTokenToRequest(request);
        },
        success: function(data) {
          resolve(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          reject(XMLHttpRequest);
        },
      });
    });
  },


  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 获取查询窗口的数据(简单查询) 
	 */
  queryInfoWindowDataSimple: function(infoQueryParam){
    var requestUrl = 'InfoWindowResource/queryInfoWindowDataSimple';
    return new Promise((resolve, reject) => {
      $.ajax({
        url: Common.getApiURL(requestUrl),
        type: 'post',
        contentType: 'application/json',
        dataType: 'json',
        data: JSON.stringify(infoQueryParam),
				
        beforeSend: function(request) {
          Common.addTokenToRequest(request);
        },
        success: function(data) {
          resolve(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          reject(XMLHttpRequest);
        },
      });
    });
  },

  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 根据infoWindowId 获取查询窗口数据定义 用在 Window数据字典、InfoWindow数据字典、
ProcessReportParameter数据字典、FilterSchemaLine数据字典 
	 */
  uniqueByNo: function(infoWindowNo){
    var requestUrl = 'InfoWindowResource/uniqueByNo';
    var paramCount = 0;
    if(infoWindowNo != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('infoWindowNo=' + infoWindowNo);
      paramCount ++;
    }
    return new Promise((resolve, reject) => {
      $.ajax({
        url: Common.getApiURL(requestUrl),
        type: 'get',
				
        dataType: 'json',
				
				
        beforeSend: function(request) {
          Common.addTokenToRequest(request);
        },
        success: function(data) {
          resolve(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          reject(XMLHttpRequest);
        },
      });
    });
  },
};
