(function(){
    X.pageLogic['addrole'] = {
        init : function(){
            var data;
            X.api("authority/api_list/","get",{},function(d){
                data = d;
                X.laytpldata("#addrole-info-table-con-dot",d,".addrole-info-table-con");
                layui.form.render();
            })

            $(".addrole-qd").click(function(){
                var tit = $(".addrole-tit").val();
                var addroledata = layui.form.val("addroleexample");
                var dataArr =[];
                for(let i in addroledata){
                    dataArr.push(i);
                }
                X.api("authority/add_role","post",{role_name:tit,role_api:dataArr},function(d){
                    layer.msg("创建成功");
                    $(".addrole-qx a").click();
                })
            })

        }
    };
})();