
@{
    Layout = null;
}

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <title>百伦数据中心</title>

    <meta name="keywords" content="百伦数据中心">
    <meta name="description" content="百伦数据中心">

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/hplus/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/css/hplus/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/css/hplus/css/animate.min.css" rel="stylesheet">
    <link href="/css/hplus/css/style.min.css?v=4.2.0" rel="stylesheet">

    <script src="/css/hplus/js/jquery.min.js?v=2.1.4"></script>
    <script src="/js/jquery.cookie.js" type="text/javascript"></script>
    <script src="/js/common.js?20200220017" type="text/javascript"></script>
</head>

<body class="fixed-sidebar full-height-layout white-bg" style="overflow:hidden">
    @if (ViewBag.companyid == -1)
    {
        <script type="text/javascript">
            logout();
        </script>
    }
    <script type="text/javascript">
        login();
    </script>
    <div id="wrapper">
        <!--左侧导航开始-->
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="nav-close">
                <i class="fa fa-times-circle"></i>
            </div>
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header" id="first-menu">
                        <div class="dropdown profile-element">
                            <span><img alt="image" class="img-circle" src="/css/hplus/img/profile_small.jpg" /></span>
                            <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                <span class="clear">
                                    <span class="block m-t-xs"><strong class="font-bold" id="user-job">@(ViewBag.username)</strong></span>
                                    <span class="text-muted text-xs block" id="user-name">@(ViewBag.departmentname)</span>
                                </span>
                            </a>
                        </div>
                    </li>

                    @if (ViewBag.allcompany == 1 || ViewBag.companyid == 1)
                    {
                        if (ViewBag.menus.Count > 0)
                        {
                            foreach (var item in ViewBag.menus)
                            {
                                <li>
                                    <a href="#">
                                        <i class="@item.icon"></i>
                                        <span class="nav-label">@item.name</span>
                                        <span class="fa arrow"></span>
                                    </a>
                                    <ul class="nav nav-second-level collapse">
                                        @if (item.childrens.Count > 0)
                                        {
                                            foreach (var f_level in item.childrens)
                                            {
                                                <li>
                                                    @if (f_level.childrens.Count > 0)
                                                    {
                                                        <a href="#">
                                                            <i class="@f_level.icon"></i>
                                                            <span class="nav-label">@f_level.name</span>
                                                            <span class="fa arrow"></span>
                                                        </a>
                                                        <ul class="nav nav-third-level collapse">
                                                            @foreach (var s_level in f_level.childrens)
                                                            {
                                                                <li>
                                                                    <a class="J_menuItem" href="@Url.Content("~"+s_level.path)" data-index="0">
                                                                        <i class="fa fa-dot-circle-o"></i>
                                                                        <span class="nav-label">@s_level.name</span>
                                                                    </a>
                                                                </li>
                                                            }
                                                        </ul>
                                                    }
                                                    else
                                                    {
                                                        <a class="J_menuItem" href="@Url.Content("~"+f_level.path)" data-index="0">
                                                            <i class="fa fa-dot-circle-o"></i>
                                                            <span class="nav-label">@f_level.name</span>
                                                        </a>
                                                    }
                                                </li>
                                            }
                                        }
                                    </ul>
                                </li>
                            }
                        }
                    }
                </ul>
            </div>
        </nav>
        <!--左侧导航结束-->
        <!--右侧部分开始-->
        <div id="page-wrapper" class="gray-bg dashbard-1">
            <div class="row border-bottom">
                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                    <h3 style="padding-left: 20px;margin-top: 14px;font-size: 1.6em;">百伦数据中心</h3>
                </nav>
            </div>
            <div class="row content-tabs">
                <button class="roll-nav roll-left navbar-minimalize" style="background: #fff;border-color: #eee;">
                    <i class="fa fa-bars"></i>
                </button>
                <button class="roll-nav roll-left J_tabLeft" style="left: 40px;">
                    <i class="fa fa-backward"></i>
                </button>
                <nav class="page-tabs J_menuTabs" style="margin-left: 80px;">
                    <div class="page-tabs-content">
                        <a href="javascript:;" class="active J_menuTab" data-id="@Url.Content("~/Home/Index")">首页</a>
                    </div>
                </nav>
                <button class="roll-nav roll-right J_tabRight">
                    <i class="fa fa-forward"></i>
                </button>
                <div class="btn-group roll-nav roll-right">
                    <button class="dropdown J_tabClose" data-toggle="dropdown">
                        关闭操作<span class="caret"></span>

                    </button>
                    <ul role="menu" class="dropdown-menu dropdown-menu-right">
                        <li class="J_tabShowActive">
                            <a>定位当前选项卡</a>
                        </li>
                        <li class="divider"></li>
                        <li class="J_tabCloseAll">
                            <a>关闭全部选项卡</a>
                        </li>
                        <li class="J_tabCloseOther">
                            <a>关闭其他选项卡</a>
                        </li>
                    </ul>
                </div>
                <a href="javascript:;" onclick="logout();" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
            </div>
            <div class="row J_mainContent" id="content-main">
                <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="@Url.Content("~/Home/Index")" frameborder="0" data-id="@Url.Content("~/Home/Index")" seamless></iframe>
            </div>
            <!-- <div class="footer">
                <div class="pull-right">&copy; 2018 广州百伦
                </div>
            </div> -->
        </div>
        <!--右侧部分结束-->

    </div>
    <script src="/css/hplus/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="/css/hplus/js/plugins/layer/layer.min.js"></script>
    <script type="text/javascript" src="/css/hplus/js/contabs.min.js"></script>
    <script src="/css/hplus/js/plugins/pace/pace.min.js"></script>
    <script>
        $(document).ready(function () {
            getuser();
        })

        function getuser() {
            var token = getUrlParam('token');
            if (token != '') {
                $.cookie('BailunToken', token, { expires: 1, domain: 'bailuntec.com' });
            }
            else {
                token = $.cookie('BailunToken');

                if (token == '' || token == undefined || token == null) {
                    window.location = "http://sso.bailuntec.com/?returnUrl=" + baseUrl;
                    return false;
                }
            }

            //请求获取用户信息
            $.ajax({
                url: "http://sso.bailuntec.com/GetUserResource",
                data: {},
                type: "GET",
                beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', token); },//这里设置header
                success: function (result) {
                    if (result.result.success) {
                        $('#user-job').html(result.result.Account);
                        global_userid = result.result.OaUserId;
                        global_username = result.result.Account;
                        if (result.result.Department != null) {
                            $('#user-name').html(result.result.Department.Name);
                        }

                        getmenu();
                    }
                    else {

                        window.location = "http://sso.bailuntec.com/?returnUrl=" + baseUrl;
                        $.cookie('BailunToken', token, { expires: -1 });
                    }
                }
            });

        }

        function getmenu() {
            if (global_username != null) {
                $.submit({
                    type: 'POST',
                    url: baseUrl + '/Home/ListMenu',
                    paramData: 'userid=' + global_userid,
                    func: function (result) {
                        if (result) {
                            var s = '<li class="nav-header" id="first-menu">' + $('#first-menu').html() + '</li>';
                            $('#side-menu').html('');
                            for (var onepart in result) {
                                s += '<li>' +
                                    '<a href="#">' +
                                    '<i class="' + result[onepart].icon + '"></i>' +
                                    '<span class="nav-label">' + result[onepart].name + '</span>' +
                                    '<span class="fa arrow"></span>' +
                                    '</a>' +
                                    '<ul class="nav nav-second-level">';

                                if (result[onepart].childrens.length > 0) {
                                    for (var second in result[onepart].childrens) {
                                        var f_level = result[onepart].childrens[second];
                                        s += '<li>';
                                        if (f_level.childrens.length > 0) {
                                            s += ('<a href="#">' +
                                                '<i class="' + f_level.icon + '"></i>' +
                                                '<span class="nav-label">' + f_level.name + '</span>' +
                                                '<span class="fa arrow"></span>' +
                                                '</a>' +
                                                '<ul class="nav nav-third-level">');

                                            for (var third in f_level.childrens) {
                                                var s_level = f_level.childrens[third];
                                                s += ('<li>' +
                                                    '<a class="J_menuItem" href="' + baseUrl + s_level.path + '" data-index="0">' +
                                                    '<i class="fa fa-dot-circle-o"></i>' +
                                                    '<span class="nav-label">' + s_level.name + '</span>' +
                                                    '</a>' +
                                                    '</li>');
                                            }

                                            s += '</ul>';
                                        }
                                        else {
                                            s += ('<a class="J_menuItem" href="' + baseUrl + f_level.path + '" data-index="0">' +
                                                '<i class="fa fa-dot-circle-o"></i>' +
                                                '<span class="nav-label">' + f_level.name + '</span>' +
                                                '</a>');
                                        }

                                        s += '</li>';
                                    }
                                }

                                s += '</ul>';
                                s += '</li>';
                            }

                            $('#side-menu').append(s);

                            $.getScript('../css/hplus/js/plugins/metisMenu/jquery.metisMenu.js', function () {
                                $.getScript('../css/hplus/js/plugins/slimscroll/jquery.slimscroll.min.js', function () {
                                    $.getScript('../css/hplus/js/hplus.min.js?v=4.1.0', function () {
                                        $.getScript('../css/hplus/js/contabs.min.js', function () {

                                        });
                                    });
                                });
                            });
                        }
                    }
                })
            }
        }

    </script>

</body>
</html>
