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

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

  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 根据 WindowNo获取 Window 的定义 
	 */
  uniqueByNoAccessControl: function(curdWindowNo){
    var requestUrl = 'CurdWindowResourceV2/uniqueByNoAccessControl';
    var paramCount = 0;
    if(curdWindowNo != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('curdWindowNo=' + curdWindowNo);
      paramCount ++;
    }


    return new Promise((resolve, reject) => {
      $.ajax({
        url: Common.getApiURL(requestUrl),
        type: 'get',
        contentType: 'application/json',
				
				
				
				
        beforeSend: function(request) {
          Common.addTokenToRequest(request);
        },
        success: function(data) {
          resolve(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          reject(XMLHttpRequest);
        },
      });
    });
  },

  // 根据WindowNo获取 curd 版本号
  uniqueByNoVersionNumber: function(curdWindowNo){
    var requestUrl = 'CurdWindowResource/uniqueByNoVersionNumber';
    var paramCount = 0;
    if(curdWindowNo != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('no=' + curdWindowNo);
      paramCount ++;
    }

    return new Promise((resolve, reject) => {
      $.ajax({
        url: Common.getApiURL(requestUrl),
        type: 'get',
        contentType: 'application/json',
				
        beforeSend: function(request) {
          Common.addTokenToRequest(request);
        },
        success: function(data) {
          resolve(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          reject(XMLHttpRequest);
        },
      });
    });
  },
};
