(function(){
    X.pageLogic['kanbantypeset'] = {
        init : function(parms){
            var me = this;
            this.parms = parms;
            this.callback = parms.callback;
            var listdata = parms.extData;
            console.log(listdata);
            layui.form.render();

            if(listdata){
                layui.form.val('kanbantypeexample',{
                    graph_type: listdata.graph_type || 'table',
                    graph_size: listdata.graph_size || 'in',
                    sort: listdata.sort
                });
            }

            $(document).off('click','.adduser-top-box img').on('click','.adduser-top-box img',function(){
                layer.close(parms.layIndex);
            });

            $(document).off('click','.kanbantypeset-but-box .adduser-btn').on('click','.kanbantypeset-but-box .adduser-btn',function(){
                layer.close(parms.layIndex);
            });

            layui.form.on('radio(graph_type)', function (data) {
                if(listdata.model == 'ltv'){
                    if(data.value == "echarts"){
                        layui.form.val('kanbantypeexample',{
                            graph_type: listdata.graph_type || 'table'
                        });
                        layer.msg('ltv没有图像,请选择其他方式展示');
                    }
                }
            });

            layui.form.on('radio(graph_size)', function (data) {
                if(listdata.model == 'ltv'){
                    if(data.value == "small"){
                        layui.form.val('kanbantypeexample',{
                            graph_size: listdata.graph_size || 'table'
                        });
                        layer.msg('ltv没有小图,请选择其他方式展示');
                    }
                }
            });

            $(document).off('click','.kanbantypeset-but-box .adduser-btn2').on('click','.kanbantypeset-but-box .adduser-btn2',function(){
                var data = layui.form.val('kanbantypeexample');
                me.callback && me.callback(data);
                layer.close(parms.layIndex);
            });

        }
    };
})();