
/**
 * 分页列表--刷新用户列表
 * @param parameter
 * @param currentPage
 * @returns
 */
function refreshCuringPagination(parameter,currentPage){
	$.ajax({
        cache :false,
        type: 'get',
        url: '/cloud/build/ajax/getCuringPage/'+currentPage+parameter,
        dataType: 'json',
        success: function(data) {
            if (data.status == 1) {
                fnStructureCuringUser(data.curingList);
                fnPage(data.pageData);
                refreshColumn(columnLength);
            } else {
                alert(data.msg);
            }
        }
    })
}

/**
 * 筛选-统一请求--刷新用户列表
 * @returns
 */
function refreshCuringPage(compilation,latestCompilation,sortField,sort,wd){
	$.ajax({
        cache :false,
        type: 'get',
        url: '/cloud/build/ajax/refreshCuringPage?sortField='+sortField+'&sort='+sort+'&compilation='+compilation+'&latestCompilation='+latestCompilation+
        	'&wd='+wd,
        dataType: 'json',
        success: function(data) {
            if (data.status == 1) {
            	fnStructureCuringUser(data.curingList);
                fnPage(data.pageData);
                refreshColumn(columnLength);
            } else {
                alert(data.msg);
            }
        }
    })
    
}

/**
 * 通行证账号检索用户--刷新列表和分页
 * @returns
 */
function fnMobile2Info(){
    mobile2InfoTimeout = null;
    if((/^1[34578]\d{9}$/.test(mobile))) {
    	refreshCuringPage('','','','',mobile);
    }
}

/**
 * 刷新用户详情页
 * @param ssoid
 * @param client_id
 * @returns
 */
function refreshCuringPageDetail(ssoid,client_id){
	$.ajax({
        cache :false,
        type: 'GET',
        url: '/cloud/build/ajax/getCuringBySsoid',
        data: {ssoid: encodeURI(ssoid),client_id:encodeURI(client_id)},
        dataType: 'json',
        success: function(data){
            if(data.status==1||data.status==2){
                //设置 养护用户信息
                var objHtml=buildCuringInfo(data.detail.userInfo);
                $('div[curingInfo] curing').html(objHtml);

                $('div[curingInfo] curingClient').html('');
                //设置CLD客户信息
                //if(data.detail.curingInfo.updateTotal!=0){
                	 //$("#id").val(id);
                     var clientHtml=relevanceClient(data.detail.clientInfo);
                     $('div[curingInfo] curingClient').html(clientHtml);
                //}
               
                //设置养护详情页里产品升级信息
                var upMajorBoxHtml=buildCuringCompilation(data);
                $('tbody[upMajorBox]').html(upMajorBoxHtml);
                
                //更新在线时长
                var onlineTimesHtml=buildCuringOnlineTimes(data.detail.userInfo.online_list);
                $('tbody[onlineTimes]').html(onlineTimesHtml);
                
                //设置参数
                $('#curingSsoid').val(data.detail.userInfo.ssoIdKey);
                $('#curingMobile').val(data.detail.userInfo.mobile);
                $('#client_id').val(data.detail.clientInfo.cidKey);
                
                //设置养护日志
                var operateLogHtml=buildCuringOperateLog(data.detail.operateLog);
                $('div[operateLog] curingOperate').html(operateLogHtml);

                setTimeout(autoHeight, 400);

                //autoHeight();
                $('#detail').modal('show');
            }else if(data.status==3){
                alert(data.msg);
            }
        },
        error: function(xhr, type){
            console.log('Ajax error!')
        }
    })
}

/**
 * DOM加载完毕后初始化
 * @returns
 */
function init(){
	refreshColumn(columnLength);
}



