(function(){
    X.pageLogic['datacheck_list'] = {
        init : function(parms){
            var me = this;
            this.parms = parms;
            this.callback = parms.callback;
            // var data = parms.extData;
            $('.datacheck_list-box').css('height',window.innerHeight+'px');

            posttemplate();
            var savelist;
            function posttemplate(){
                X.api('check_data/template','get',{},function(d){
                    savelist = d;
                    X.laytpldata("#save-list-content-box-dot",d,".save-list-content-box");
                })
            };

            $(document).off('click','.save-list').on('click','.save-list',function(){
                var index = $(this).attr('data-index');
                var data = savelist[index];
                layer.closeAll();
                me.callback && me.callback(data);
            });
            // 删除
            $(document).off('click',".save-list-del").on('click','.save-list-del',function(e){
                e.stopPropagation();
                var title = $(this).attr("data-title");
                var data = {
                    title: title
                }
                X.api('check_data/del_template','post',data,function(){
                    layer.msg('删除成功');
                    posttemplate();
                })
            });

            $(document).off('click','.save-list-qx').on('click','.save-list-qx',function(){
                layer.closeAll();
            });

        }
    };
})();