$package('itsm.request');  
 /**  
 * @author sinba  
 * @constructor 
 * @description 新增请求主函数.
 * @date 2010-11-17
 * @since version 1.0 
 * @returns
 * @param select
 */

itsm.request.requestStats = function(){
	return {
		countAllRquest: function(){
			var url = 'request!countRequest.action';
			$.post(url,'requestQueryDTO.createdByName='+userName+'&requestQueryDTO.loginName='+userName+'&requestQueryDTO.userName='+userName+'&requestQueryDTO.ownerName='+userName,function(res){
				$("#allRequest").text("[ "+res.countAllRquest+" ]");
				
				$("#myProposedRequest").text("[ "+res.countMyRquest+" ]");
				$("#myGroupProposedRequest").text("[ "+res.countMyGroupProposedRequest+" ]");
				
				$("#assigneeToMyRequest").text("[ "+res.countMyPeRquest+" ]");
				$("#assigneeGroupRequest").text("[ "+res.countMyGrRquest+" ]");
				
				$("#myOwnerRequest").text("[ "+res.countMyOwRquest+" ]");
				
				$("#myRequestTask").text("["+res.countMyRequestTask+"]");
				$("#myGroupRequestTask").text("["+res.countMyGroupRequestTask+"]");
			});
		},
		/**
		 * @description 请求统计搜索
		 */
		requestCountSearch:function(type){
			

			if ($('#itsmMainTab').tabs('exists',i18n['title_allRequestList']))
			{
				$('#itsmMainTab').tabs('select',i18n['title_allRequestList'])
				$('#request_countQueryType').val(type);
				$('#request_currentUser').val(userName);
				itsm.request.requestMain.doSearchRequest();
				
			}else{
				
				itsm.common.utility.tabUtility.reOpenTab('../pages/request/requestMain.jsp?countQueryType='+type+'&currentUser='+userName,i18n['title_allRequestList']);
				
			}
		}
	}
}();