(function(){
    X.pageLogic['grouptable'] = {
        init : function(parms){
            var me = this;
            this.parms = parms;
            this.callback = parms.callback;
            var data = parms.extData;

            data['eventView']['endTime'] = data.time+" 23:59:59";
            data['eventView']['startTime'] = data.time+" 00:00:00";
            
            X.api("ck/scatter_model_details","post",data,function(d){
                d['tabletitle'] = $.extend(true,[],d['label']);
                d['tabletitle'].unshift(d.biaotou,'全部用户');
                var contnetdata =[];
                for(let i in d.list){
                    var arrdata= [];
                    for(let j in d.list[i]['n']){
                        var n = d.list[i]['n'][j];
                        var p = d.list[i]['p'][j];
                        var arr = {
                            n: n,
                            p: p
                        }
                        arrdata.push(arr);
                    }
                    var drr = {
                        total : d.list[i]['total'],
                        first: i,
                        data: arrdata
                    }
                    contnetdata.push(drr);
                }
                // console.log(contnetdata);
                $('.grouptable-title-box span').html(d.start_date);
                X.laytpldata("#table-fenxi-th-group-dot",d.tabletitle,".table-fenxi-group-th");
                X.laytpldata("#table-fenxi-td-group-dot",contnetdata,".table-fenxi-group-td");

            });

            $(document).off("click",'.grouptable-title-box img').on("click",'.grouptable-title-box img',function(){
                data.eventView['download'] = 1;
                X.download("ck/scatter_model_details",data,'分布分析')
            })
           

        }
    };
})();