<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=0, maximum-scale=0, user-scalable=yes,shrink-to-fit=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>{:get_config('web_site_title')}</title>
    <link rel="icon" href="./favicon.png">
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" href="/static/hplus/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/hplus/css/font-awesome.min.css?v=4.4.0" />
    <link rel="stylesheet" href="/static/hplus/css/animate.css"/>
    <link rel="stylesheet" href="/static/hplus/css/style.css?v=4.1.0">
    <link rel="stylesheet" href="/static/hplus/css/jquery.contextMenu.min.css"/>
    <link rel="stylesheet" href="/static/elementui2.15.5/index.css"/>
    <link rel="stylesheet" href="/admin/css/common.css">
    <link rel="stylesheet" href="/admin/css/index.css">
    <link rel="stylesheet" href="/admin/css/indexsub.css">
    <link rel="stylesheet" href="/static/swiper4.5/css/swiper.min.css">

    <script src="/static/hplus/js/jquery.min.js?v=2.1.4"></script>

    <style>
        .nav.navbar-right > li > a {
            display: inline-block;
        }
        #orderNums{
            /*vertical-align: middle;*/
            color: red;
            position: relative;
            top: -3px;
        }
        .nn:focus, .nn:hover{
            background-color:#fff !important;
        }

        .navbar-title{
            display: inline-block;
            font-size: 20px;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #284A94;
            padding-left: 20px;
            line-height: 60px;
            float: left;
        }
        .navbar-header{
            width: auto;
            max-width: 310px;
            height: 70px;
            line-height: 70px;
            font-size: 20px;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #284A94;
            overflow: hidden;
            text-overflow:ellipsis;
            white-space: nowrap;
        }
        .sidebox{
            width: 100%;
            height: 100%;
            position: relative;
        }

        .side-box-switch{
            width: 28px;
            height: 168px;
            position: absolute;
            z-index: 10;
            top: 50%;
            right: -28px;
            /*background-color: red !important;*/
            margin-top: -84px;
            cursor: pointer;
        }
        .side-box-switch .switch-img{
            width: 100%;
            height: 100%;
        }
        .main-box-padding-left{
            padding-left: 120px !important;
        }
        .main-box-padding-left1{
            padding-left: 280px !important;
        }
        .main-box-padding-left3{
            padding-left: 0px !important;
        }
        .menusub-box{
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        html,body{
            width: 100%;
            height: 100% !important;
            overflow: hidden;
            padding-bottom: 5px;
        }
        body{
            background-image: url("/admin/img/indexsub-bg.png");
            background-repeat: no-repeat;
            background-size: 100% 100%;
            /*background-size: cover;*/
        }
        .navbar{
            width: 100%;
            height: 70px !important;
            background-color:transparent!important;
            border-bottom: 0 !important;
            margin-bottom: 0px;
            /*background-image: url("/admin/img/index-header-bg.png");*/
            /*background-repeat: no-repeat;*/
            /*background-size: 100% 100%;*/
            /*margin-bottom: 0 !important;*/
            /*border-bottom: none !important;*/
        }
        .navbar-logo{
            width: 157px;
            height: 40px;
            display: inline-block;
            float: left;
            margin-left: 50px;
            margin-top: 15px;
        }
        .navbar-logo img{
            width: 100%;
            height: 100%;
        }
        .nav>li>a:focus, .nav>li>a:hover{
            background: none !important;
        }
        .nav .open > a, .nav .open > a:hover, .nav .open > a:focus{
            background: none !important;
        }
        .userhead{
            width: 41px;
            height: 40px;
            border-radius: 50%;
        }


    </style>
</head>
<!--<body class="fixed-sidebar full-height-layout gray-bg  fixed-nav pace-done">-->
<body>

<nav class="navbar navbar-fixed-top" role="navigation">
    <!--    <div class="navbar-title">{:get_config('web_site_title')}</div>-->
    <!--    <div class="navbar-logo" style="margin-left: 20px!important;">-->
    <!--        <img src="/admin/img/index-logo.png" alt="">-->
    <!--    </div>-->
    <div style="width: 100%;height: 70px">
        <div class="navbar-header">
            {if $userInfo.type==1}
            <!--{:get_config('web_site_title')}&nbsp;|&nbsp;-->
            <div data-width="60%" data-title="切换组织" url="{:url('Index/changeOrg')}" onclick="layer_open(this,2)" style="cursor: pointer;display: inline-block;height: 70px;line-height: 70px;width: 100%;text-overflow:ellipsis;
            white-space: nowrap;overflow: hidden;">
                {:session('orgName')} <span class="glyphicon glyphicon-menu-down" style="font-size: 16px;" aria-hidden="true"></span>
            </div>
            {else}
            <!--{:get_config('web_site_title')}&nbsp;|&nbsp;-->
            <div data-width="60%" style="display: inline-block;width: 100%;text-overflow:ellipsis;
            white-space: nowrap;">
                {:session('orgName')}
            </div>
            {/if}

        </div>
        <div class="level-menu-box">
            {volist name="menus" id="v"}
            <div class="menu-name-box {if $curmenu == $v.id}cur-menu-style{/if}" data-id="{$v['id']}" onclick="changeMenu(this)">
                <text>{$v.title}</text>
            </div>
            {/volist}
        </div>

        <ul class="nav navbar-top-links navbar-right" style="height: 70px">
            {empty name="userInfo['head_image']"}
            <img src="/img/defaulthead.png" class="userhead" style="" alt="">
            {else /}
            <img src="{$userInfo['head_image']}" class="userhead"  alt="">
            {/empty}
            <li class="dropdown" style="height: 100%">
                <!-- {if ($isDispatch == 1)}
                 <a href="javascript:;" id="goOrder" url="{:url('Index/ordersList')}?mode=0&order_mode=1"  onclick="layer_open_dispatch(this,2)" class="glyphicon glyphicon-bell">
                     <text id="orderNums">{if condition="$orderNums > 0"}({$orderNums}){/if}</text>
                 </a>
                 <a href="javascript:;" class="nn" onclick="offNotice()" id="offNotice" >
                     <text id="offNoticeBtn">关闭通知</text>
                 </a>
                 <input type="hidden" id="offNoticeVal" value="0">
                 {/if}-->
                <a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;" style="color: #284A94;height: 100%;margin-top: 5px">欢迎,{:session('user_auth.real_name')} </a>
                <ul class="dropdown-menu animated fadeInRight m-t-xs">
                    <li><a class="JmenuItem" href="{:url('User/modifyPass')}">修改密码</a></li>
                    <li><a href="{:url('Common/logout')}">安全退出</a></li>
                </ul>
            </li>
        </ul>
    </div>
</nav>

<div class="gyindexsub-menu-list-box"  style="display: none">

    <div class="indexsub-bread-crumbs-box" style="margin: 70px 19px 0px;width: calc(100% - 38px)">
        <a href="{:url('index/index')}" class="active">首页</a>
        {if $menuTitle}
        <a href="javascript:;" id="onebreadcrumbs">{$menuTitle}</a>
        {/if}
        {if $menuTitle1}
        <a href="javascript:;" id="twobreadcrumbs">{$menuTitle1}</a>
        {/if}
        {if $menuTitle2}
        <a href="javascript:;" id="threebreadcrumbs">{$menuTitle2}</a>
        {/if}
    </div>
    <div class="qsidenav" style="height: calc(100% - 58px)!important;">
        <div class="qsidenav-list qsidenablistthreemenulist" >
            <!--  <div class="qsidenav-twomenu-name">设备维保</div>
              <div class="sub">
                  <a href="">
                      <div class="sub-list cur">设备管理</div>
                  </a>
                  <a href="">
                      <div class="sub-list">设备管理</div>
                  </a>
              </div>-->
        </div>
    </div>

    <div class="gymenu-body-box" id="gy-main-iframe-menu">
        <!--        <iframe class="J_iframe" name="iframe0" width="100%" height="100%" id="gyindexsub-iframes"  frameborder="0" data-id="index_v1.html" seamless></iframe>-->
    </div>
</div>


<div class="main-box main-box-h2 gongzuotaimenu" id="main-iframe">
    <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="{:url('Index/def')}" frameborder="0" data-id="index_v1.html" seamless></iframe>
</div>




<script src="/static/hplus/js/bootstrap.min.js?v=3.3.7"></script>
<script src="/static/layer3.2.0/layer.js"></script>
<script src="/static/hplus/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/static/hplus/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/static/hplus/js/plugins/contextMenu/jquery.contextMenu.min.js"></script>
<script src="/static/hplus/js/hplus.js?v=4.1.0"></script>

<script type="text/javascript" src="/static/hplus/js/contabs.js"></script>

<!-- 第三方插件 -->
<script src="/static/hplus/js/plugins/pace/pace.min.js"></script>

<script src="/static/elementui2.15.5/vue-2.6.14.js"></script>
<script src="/static/elementui2.15.5/index.js"></script>
<script src="/admin/js/common.js"></script>

{if condition="is_login() and !is_admin(is_login()) and btnAuth(is_login(),'PhoneMonitor/show')"}
<textarea style="display: none;" id="StatusArea" rows="13" name="S1" class="form-control" readonly></textarea>
<script language="javascript" type="text/javascript" src="/static/phonejs/qnviccub.js"></script>
<script language="javascript" type="text/javascript" src="/static/phonejs/qnvfunc.js"></script>
<script language="javascript" type="text/javascript" src="/static/phonejs/json2.js"></script>
<script language="javascript" type="text/javascript" src="/static/phonejs/deviceapi.js"></script>
<script>
    var fp;
    $(document).ready(function(){
        TV_Initialize();
        getEvent(T_GetEvent);
    });
    $(window).unload(function(){
        TV_Disable();
    });
    setInterval(function () {
        OpenDevice(ODT_LBRIDGE,function(nResult){AppendStatus('打开设备.');});
    },30000);
    //离开页面
    $(window).bind('beforeunload',function(){
        TV_Disable();
    });
    function openPhone() {
        // let gphone = "13838379499";
        // let fp = "d:\\wyluyin\\" + getCurrentDate(3) + "_" + gphone + ".wav";
        // check_phone(gphone,fp);
    }

    function playBtn() {
        // let path = "d:\\wyluyin\\20220608191204_13027625915.wav";
        // console.log('path:',path);
        PlayFile(1,QNV_PLAY_FILE_START,0,PLAYFILE_MASK_REPEAT,path,function(id){
            console.log('play:',id);
        });
    }

    function check_phone(gphone,fp) {
        fp = base64encode(fp);
        var url = '{:url("orders/phone")}?phone=' + gphone + '&fp='+fp;
        var title = '添加订单';
        layer.open({
            type: 2,
            shade: 0.8,
            title: title,
            area: ['800px', '400px'],
            fix: false, //不固定
            maxmin: true,
            content: url,
            skin: 'layer-ext-moon',
            success: function(layero, index) {
                layer.iframeAuto(index);
            },
            // btn: ['取消']
        });

        return false;
    }

    function AppendStatus(szStatus)
    {
        // console.log(szStatus);
        // $("#StatusArea").append(szStatus+"\r\n" );
        // var scrollTop = $("#StatusArea")[0].scrollHeight;
        // $("#StatusArea").scrollTop(scrollTop);
    }
    function AppendStatusEx(uID,szStatus)
    {
        uID=uID+1;
        AppendStatus("通道"+uID+":"+szStatus);
    }

    function  T_GetEvent(uID,uEventType,uHandle,uResult,szdata)
    {
        // console.log(uID,uEventType,uHandle,uResult,szdata);
        //var vValueArray=qnviccub.QNV_Event(0,2,0,"","",1024);
        if(uEventType == -1)
            return;
        var vValue=" type="+uEventType+" Handle="+uHandle+" Result="+uResult+" szdata="+szdata;
        switch(uEventType)
        {
            case BriEvent_PhoneHook:// 本地电话机摘机事件
                AppendStatusEx(uID,"本地电话机摘机"+vValue);
                TV_StartRecordFile(uID,fp);
                break;
            case BriEvent_PhoneDial:// 只有在本地话机摘机,没有调用软摘机时,检测到DTMF拨号
                AppendStatusEx(uID,"本地话机拨号"+vValue);
                break;
            case BriEvent_PhoneHang:// 本地电话机挂机事件
                TV_HangUpCtrl(uID);
                AppendStatusEx(uID,"本地电话机挂机"+vValue);
                TV_StopRecordFile(uID);
                break;
            case BriEvent_CallIn:// 外线通道来电响铃事件
                AppendStatusEx(uID,"外线通道来电响铃事件"+vValue);
                break;
            case BriEvent_GetCallID://得到来电号码
                AppendStatusEx(uID,"得到来电号码"+vValue);
                fp = "d:\\wyluyin\\" + getCurrentDate(3) + "_" + szdata + ".wav";
                check_phone(szdata,fp);
                break;
            case BriEvent_StopCallIn:// 对方停止呼叫(产生一个未接电话)
                AppendStatusEx(uID,"对方停止呼叫(产生一个未接电话)"+vValue);
                break;
            case BriEvent_DialEnd:// 调用开始拨号后,全部号码拨号结束
                AppendStatusEx(uID,"调用开始拨号后,全部号码拨号结束"+vValue);
                break;
            case BriEvent_PlayFileEnd:// 播放文件结束事件
                AppendStatusEx(uID,"播放文件结束事件"+vValue);
                break;
            case BriEvent_PlayMultiFileEnd:// 多文件连播结束事件
                AppendStatusEx(uID,"多文件连播结束事件"+vValue);
                break;
            case BriEvent_PlayStringEnd://播放字符结束
                AppendStatusEx(uID,"播放字符结束"+vValue);
                break;
            case BriEvent_RepeatPlayFile:// 播放文件结束准备重复播放
                AppendStatusEx(uID,"播放文件结束准备重复播放"+vValue);
                break;
            case BriEvent_SendCallIDEnd:// 给本地设备发送震铃信号时发送号码结束
                AppendStatusEx(uID,"给本地设备发送震铃信号时发送号码结束"+vValue);
                break;
            case BriEvent_RingTimeOut://给本地设备发送震铃信号时超时
                AppendStatusEx(uID,"给本地设备发送震铃信号时超时"+vValue);
                break;
            case BriEvent_Ringing://正在内线震铃
                AppendStatusEx(uID,"正在内线震铃"+vValue);
                break;
            case BriEvent_Silence:// 通话时检测到一定时间的静音.默认为5秒
                AppendStatusEx(uID,"通话时检测到一定时间的静音"+vValue);
                break;
            case BriEvent_GetDTMFChar:// 线路接通时收到DTMF码事件
                AppendStatusEx(uID,"线路接通时收到DTMF码事件"+vValue);
                break;
            case BriEvent_RemoteHook:// 拨号后,被叫方摘机事件
                AppendStatusEx(uID,"拨号后,被叫方摘机事件"+vValue);
                break;
            case BriEvent_RemoteHang://对方挂机事件
                TV_HangUpCtrl(uID);
                AppendStatusEx(uID,"对方挂机事件"+vValue);
                TV_StopRecordFile(uID);
                break;
            case BriEvent_Busy:// 检测到忙音事件,表示PSTN线路已经被断开
                AppendStatusEx(uID,"检测到忙音事件,表示PSTN线路已经被断开"+vValue);
                break;
            case BriEvent_DialTone:// 本地摘机后检测到拨号音
                AppendStatusEx(uID,"本地摘机后检测到拨号音"+vValue);
                break;
            case BriEvent_RingBack:// 电话机拨号结束呼出事件。
                AppendStatusEx(uID,"电话机拨号结束呼出事件"+vValue);
                break;
            case BriEvent_MicIn:// MIC插入状态
                AppendStatusEx(uID,"MIC插入状态"+vValue);
                break;
            case BriEvent_MicOut:// MIC拔出状态
                AppendStatusEx(uID,"MIC拔出状态"+vValue);
                break;
            case BriEvent_FlashEnd:// 拍插簧(Flash)完成事件,拍插簧完成后可以检测拨号音后进行二次拨号
                AppendStatusEx(uID,"拍插簧(Flash)完成事件,拍插簧完成后可以检测拨号音后进行二次拨号"+vValue);
                break;
            case BriEvent_RefuseEnd:// 拒接完成
                AppendStatusEx(uID,"拒接完成"+vValue);
                break;
            case BriEvent_SpeechResult:// 语音识别完成
                AppendStatusEx(uID,"语音识别完成"+vValue);
                break;
            case BriEvent_FaxRecvFinished:// 接收传真完成
                AppendStatusEx(uID,"接收传真完成"+vValue);
                break;
            case BriEvent_FaxRecvFailed:// 接收传真失败
                AppendStatusEx(uID,"接收传真失败"+vValue);
                break;
            case BriEvent_FaxSendFinished:// 发送传真完成
                AppendStatusEx(uID,"发送传真完成"+vValue);
                break;
            case BriEvent_FaxSendFailed:// 发送传真失败
                AppendStatusEx(uID,"发送传真失败"+vValue);
                break;
            case BriEvent_OpenSoundFailed:// 启动声卡失败
                AppendStatusEx(uID,"启动声卡失败"+vValue);
                break;
            case BriEvent_UploadSuccess://远程上传成功
                AppendStatusEx(uID,"远程上传成功"+vValue);
                break;
            case BriEvent_UploadFailed://远程上传失败
                AppendStatusEx(uID,"远程上传失败"+vValue);
                break;
            case BriEvent_EnableHook:// 应用层调用软摘机/软挂机成功事件
                AppendStatusEx(uID,"应用层调用软摘机/软挂机成功事件"+vValue);
                break;
            case BriEvent_EnablePlay:// 喇叭被打开或者/关闭
                AppendStatusEx(uID,"喇叭被打开或者/关闭"+vValue);
                break;
            case BriEvent_EnableMic:// MIC被打开或者关闭
                AppendStatusEx(uID,"MIC被打开或者关闭"+vValue);
                break;
            case BriEvent_EnableSpk:// 耳机被打开或者关闭
                AppendStatusEx(uID,"耳机被打开或者关闭"+vValue);
                break;
            case BriEvent_EnableRing:// 电话机跟电话线(PSTN)断开/接通
                AppendStatusEx(uID,"电话机跟电话线(PSTN)断开/接通"+vValue);
                break;
            case BriEvent_DoRecSource:// 修改录音源
                AppendStatusEx(uID,"修改录音源"+vValue);
                break;
            case BriEvent_DoStartDial:// 开始软件拨号
                AppendStatusEx(uID,"开始软件拨号"+vValue);
                break;
            case BriEvent_RecvedFSK:// 接收到FSK信号,包括通话中FSK/来电号码的FSK
                AppendStatusEx(uID,"接收到FSK信号,包括通话中FSK/来电号码的FSK"+vValue);
                break;
            case BriEvent_PlugOut:
                AppendStatusEx(uID,"设备移除");
                // alert('设备移除');
                break;
            case BriEvent_DevErr://设备错误
                AppendStatusEx(uID,"设备错误"+ decodeURIComponent(vValue) );
                // alert('设备错误');
                break;
            default:
                if(uEventType < BriEvent_EndID)
                    AppendStatusEx(uID,"忽略其它事件发生:ID=" + uEventType+ vValue);
                break;
        }

    }
</script>
{/if}

{if condition="$isDispatch eq 1"}
<audio id="dingdantixing" src="/static/tixing.mp3" controls="controls" style="display: none;"></audio>
<script>



    var time1;
    var audio = document.getElementById('dingdantixing');

    $(function () {
        var  interval = function () {
            var url = "{:url('Index/order')}";
            $.get(url,function (data) {
                if(data.code == 1){
                    var audio = document.getElementById('dingdantixing');
                    audio.play();
                    if(data.data > 0){
                        document.getElementById('orderNums').innerHTML ='('+data.data +')';
                    }

                    // layer.msg('您有新的订单请及时处理',{time:3000});
                }
            });
        }
        time1 =  setInterval(interval,30000);

        $("#offNoticeBtn").click(function () {
            var off = parseInt($("#offNoticeVal").val());
            if(off==0){
                clearInterval(time1);
                $("#offNoticeVal").val(1)
                $("#offNoticeBtn").html('开启通知');
                audio.pause();
            }else {
                $("#offNoticeVal").val(0)
                time1 = setInterval(interval,30000);
                $("#offNoticeBtn").html('关闭通知');

            }
        })
    })


</script>
{/if}

<script>
    var menus = {:json_encode($menus)};
    $(function () {
        // $('#side-menu').slimScroll({
        //     height: ($('.sidebar-box').height() + 40) + 'px'
        // });
        // $('#side-menu2').slimScroll({
        //     height: $('.sidebar-box').height() + 'px'
        // });
        $('#sidebar-box-h2').removeClass('sidebar-box-h2');
        $('#main-iframe').addClass('main-box-h2');
        $('#menu-1').addClass('active');

        // $('.sidenav .side-list a').hover(
        //     function () {
        //         $(this).addClass("hover");
        //         let id = $(this).attr('data-id');
        //         initSubMenu(id);
        //     },
        //     function () {
        //         $(this).removeClass("hover");
        //     }
        // );

        $(document).on('click','#side-menu .Jiframe',function () {
            let id = $(this).attr('data-id');

            let url = $(this).attr('data-url');
            $('#main-iframe').removeClass('main-box-padding-left');
            $('#main-iframe').removeClass('main-box-padding-left1');
            $('#main-iframe').removeClass('main-box-padding-left3');
            // var width2 = localStorage.getItem("width1");
            // console.log(width2,'xxxxxxxxxxxxxxxx')
            // if(width2 == 120){
            //     $('#main-iframe').css('padding-left','120px');
            // }
            // if(width2 == 280){
            //     $('#main-iframe').css('padding-left','280px');
            // }

            if(url){
                if(id==485 || id==467 || id==488 || id==489){
                    $('#sidebar-box-h2').removeClass('sidebar-box-h2');
                    $('#main-iframe').addClass('main-box-h2');
                    window.open(url);
                }else {
                    $('#sidebar-box-h2').removeClass('sidebar-box-h2');
                    $('#main-iframe').addClass('main-box-h2');
                    let str = '<iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="'+url+'" frameborder="0" data-id="'+url+'" seamless></iframe>';
                    $('#main-iframe').html(str);
                }

            }else{
                $('#sidebar-box-h2').addClass('sidebar-box-h2');
                $('#main-iframe').removeClass('main-box-h2');
            }


            $(this).addClass("hover");
            initSubMenu(id);

            $('#side-menu .Jiframe').removeClass('active');
            $(this).addClass('active');
        });
        $(document).on('click','#side-menu2 .Jiframe',function () {
            $('#main-iframe').removeClass('main-box-padding-left');
            $('#main-iframe').removeClass('main-box-padding-left1');
            $('#main-iframe').removeClass('main-box-padding-left3');
            let pid = $(this).attr('data-pid');
            let url = $(this).attr('data-url');
            let str = '<iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="'+url+'" frameborder="0" data-id="'+url+'" seamless></iframe>';
            $('#main-iframe').html(str);
            $('#side-menu2 .Jiframe').removeClass('active');
            $(this).addClass('active');
            // 寻找父级元素
            $('#side-menu .Jiframe').removeClass('active');
            $('#menu'+pid).addClass('active');

        });

        $(document).on('click','.JmenuItem',function () {
            $('#main-iframe').removeClass('main-box-padding-left');
            $('#main-iframe').removeClass('main-box-padding-left1');
            $('#main-iframe').removeClass('main-box-padding-left3');
            let url = $(this).attr('href');
            let str = '<iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="'+url+'" frameborder="0" data-id="'+url+'" seamless></iframe>';
            $('#main-iframe').html(str);
            return false;
        });

    });


    function initSubMenu(id) {
        $('#main-iframe').removeClass('main-box-padding-left');
        $('#main-iframe').removeClass('main-box-padding-left1');
        $('#main-iframe').removeClass('main-box-padding-left3');
        let submenus = [];
        for (let o in menus){
            if(id == menus[o].id){
                submenus = menus[o].child;
                break;
            }
        }
        if(submenus.length > 0){
            $('#sidebar-box-h2').addClass('sidebar-box-h2');
            $('#main-iframe').removeClass('main-box-h2');
        }else{
            $('#sidebar-box-h2').removeClass('sidebar-box-h2');
            $('#main-iframe').addClass('main-box-h2');
        }

        let str = '';
        for (let o in submenus){
            if(submenus[o].child.length > 0){
                // <div class="side-group">
                //     <div class="side-group-label">系统设置</div>
                //     <div class="side-list">
                //         <a class="J_iframe" href="layouts.html"><span>项目管理</span></a>
                //     </div>
                // </div>
                str += '<div class="side-group">';
                str += '<div class="side-group-label">'+submenus[o].title+'</div>';
                let children = submenus[o].child;
                for(let n in children){
                    str += '<div class="side-list">';
                    str += '<a class="Jiframe" id="menu'+children[n].id+'" data-id="'+children[n].id+'" data-pid="'+submenus[o].pid+'" data-url="'+children[n].url+'" href="javascript:;"><span>'+children[n].title+'</span></a>';
                    str += '</div>';
                }

                str += '</div>';
            }else{
                // <div class="side-list">
                //     <a class="J_iframe active" href="layouts.html"><span>权限管理</span></a>
                // </div>
                str += '<div class="side-list">';
                str += '<a class="Jiframe" id="menu'+submenus[o].id+'" data-id="'+submenus[o].id+'" data-pid="'+submenus[o].pid+'" data-url="'+submenus[o].url+'" href="javascript:;"><span>'+submenus[o].title+'</span></a>';
                str += '</div>';
            }
        }
        $('#side-menu2').html(str);
    }

    function add_highlight(url){
        console.log('url',url);
        $('.side-list a').removeClass('active');
        for (let o in menus){
            if(menus[o].url && menus[o].url == url){
                $('#menu'+menus[o].id).addClass('active');
                break;
            }
            let child1 = menus[o].child;
            let flag = false;
            let id = 0;
            if(child1.length > 0){
                for (let m in child1){
                    if(child1[m].url && child1[m].url == url){
                        flag = true;
                        id = child1[m].id;
                        break;
                    }
                    let child2 = child1[m].child;
                    for (let n in child2){
                        if(child2[n].url && child2[n].url == url){
                            flag = true;
                            id = child2[n].id;
                            break;
                        }
                    }
                    if(flag){
                        break;
                    }
                }
            }
            console.log('flag11',flag,id);
            if(flag){
                initSubMenu(menus[o].id);
                $('#menu'+menus[o].id).addClass('active');
                $('#menu'+id).addClass('active');
                break;
            }

        }
    }



    function layer_open_dispatch(_self,flag){
        var url = $(_self).attr('url');
        var title = $(_self).attr('data-title');
        var width = $(_self).attr('data-width')?$(_self).attr('data-width'):'90%';
        var height = $(_self).attr('data-height')?$(_self).attr('data-height'):'90%';
        layer.open({
            type: 2,
            title: title,
            shadeClose: true,
            shade: 0.3,
            maxmin: true,
            area: [width, height],
            content: url,
            end: function () {
                update_order_count();
            }
        });
    }

    function update_order_count() {
        let url = "{:url('Index/ocount')}";
        $.post(url,function (res) {
            if(res.code == 1){
                let count = res.data.count;
                if(count > 0){
                    $('#orderNums').html('('+count+')');
                }else{
                    $('#orderNums').html('');
                }
            }
        });
    }

</script>

<script>
    function goindex(){
        window.location.href = '{:url("index/index")}';
    }

    var menus = {:json_encode($menus)};

    function changeMenu(_self) {
        var menuId = $(_self).attr('data-id');
        window.location.href="{:url('indexsub','','')}/curmenu/"+menuId;

    }

    function changeEndSubMenu(_self,type){
        var menuId = $(_self).attr('data-id');
        var menuurl = $(_self).attr('data-url');
        $('.sub-list').removeClass('cur');
        $(_self).addClass('cur');

        var menutitle = $(_self).attr('data-title');
        var menuftitle = $(_self).attr('data-ftitle');
        if(type == 1){
            $('#twobreadcrumbs').html(menuftitle)
            $('#threebreadcrumbs').html(menutitle)
        }else{
            $('#twobreadcrumbs').html(menutitle)
        }


        let str = '<iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="'+menuurl+'" frameborder="0" data-id="'+menuurl+'" seamless></iframe>';
        $('#gy-main-iframe-menu').html(str);
        return false;
    }

    var curmenu = {:json_encode($curmenu)};
    var menuId = {:json_encode($menuId)};
    var ct = {:json_encode($ct)};
    var submenus = {:json_encode($submenus)};
    $(function (){
        if(ct == 0){
            if(curmenu == 500){
                $('.gyindexsub-menu-list-box').css('display','none');
                $('.gongzuotaimenu').css('display','block');
            }else{
                $('.gyindexsub-menu-list-box').css('display','block');
                $('.gongzuotaimenu').css('display','none');

                var menusublist = [];
                var menuurl2 = '';
                var firstmenuid = '';
                for (let i in menus){
                    if(curmenu == menus[i].id){
                        menusublist = menus[i].child;
                        let submenulistaa = menus[i].child;
                        if(submenulistaa.length >0){
                            for (let a in submenulistaa){
                                menuurl2 = submenulistaa[0].url;
                                firstmenuid = submenulistaa[0].id;
                                let aaaa = submenulistaa[0].child;
                                if(aaaa.length > 0){
                                    for (let z in aaaa){
                                        menuurl2 = aaaa[0].url;
                                        firstmenuid = aaaa[0].id;
                                    }
                                }
                            }

                        }else{
                            menuurl2 = submenus[0].url;
                            firstmenuid = submenus[0].id;
                        }
                    }

                }

                var str = '';
                for (let i in menusublist){
                    var childList = menusublist[i].child;
                    if(childList.length >0){
                        str += '<div class="qsidenav-list">';
                        str += '<div class="qsidenav-twomenu-name">'+menusublist[i].title+'</div>';
                        str += '<div class="sub">';
                        let ftitle = menusublist[i].title;
                        if(childList.length >0){
                            for (let o in childList){
                                str += '<a href="javascript:;">';
                                str += '<div class="sub-list endmenuactive'+childList[o].id+'" data-url="'+childList[o].url+'"  data-id="'+menusublist[i].id+'" data-title="'+childList[o].title+'" data-ftitle="'+ftitle+'" onclick="changeEndSubMenu(this,1)">'+childList[o].title+'</div>';
                                str += '</a>';
                            }
                        }
                        str += '</div>';
                        str += '</div>';
                    }else{
                        str += '<div class="qsidenav-list">';
                        str += '<div class="sub">';
                        str += '<a href="javascript:;">';
                        str += '<div class="sub-list endmenuactive'+menusublist[i].id+'" data-url="'+menusublist[i].url+'"  data-id="'+menusublist[i].id+'" data-ftitle="" data-title="'+menusublist[i].title+'" onclick="changeEndSubMenu(this,2)">'+menusublist[i].title+'</div>';
                        str += '</a>';
                        str += '</div>';
                        str += '</div>';
                    }

                }
                $('.qsidenablistthreemenulist').html(str);


                let menustr = '<iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="'+menuurl2+'" frameborder="0" data-id="'+menuurl2+'" seamless></iframe>';
                $('#gy-main-iframe-menu').html(menustr);

                if(firstmenuid){
                    $('.endmenuactive'+firstmenuid).addClass('cur');
                }
            }

        }else{
            $('.gyindexsub-menu-list-box').css('display','block');
            $('.gongzuotaimenu').css('display','none');

            var menusublist = [];
            var menuurl2 = '';
            var firstmenuid = '';
            console.log(menuId);
            console.log(submenus);
            for (let i in submenus){
                if(menuId == submenus[i].id){
                    menusublist.push(submenus[i]);
                    let submenulistaa = submenus[i].child;
                    if(submenulistaa.length >0){
                        for (let a in submenulistaa){
                            menuurl2 = submenulistaa[0].url;
                            firstmenuid = submenulistaa[0].id;
                            let aaaa = submenulistaa[0].child;
                            if(aaaa.length > 0){
                                for (let z in aaaa){
                                    menuurl2 = aaaa[0].url;
                                    firstmenuid = aaaa[0].id;
                                }
                            }
                        }
                    }else{
                        menuurl2 = submenus[0].url;
                        firstmenuid = submenus[0].id;
                    }
                }

            }
            var str = '';
            for (let i in menusublist){
                var childList = menusublist[i].child;
                if(childList.length >0){
                    str += '<div class="qsidenav-list">';
                    str += '<div class="qsidenav-twomenu-name">'+menusublist[i].title+'</div>';
                    str += '<div class="sub">';
                    let ftitle = menusublist[i].title;
                    if(childList.length >0){
                        for (let o in childList){
                            str += '<a href="javascript:;">';
                            str += '<div class="sub-list endmenuactive'+childList[o].id+'" data-url="'+childList[o].url+'"  data-id="'+menusublist[i].id+'" data-title="'+childList[o].title+'" data-ftitle="'+ftitle+'" onclick="changeEndSubMenu(this,1)">'+childList[o].title+'</div>';
                            str += '</a>';
                        }
                    }
                    str += '</div>';
                    str += '</div>';
                }else{
                    str += '<div class="qsidenav-list">';
                    str += '<div class="sub">';
                    str += '<a href="javascript:;">';
                    str += '<div class="sub-list endmenuactive'+menusublist[i].id+'" data-url="'+menusublist[i].url+'"  data-id="'+menusublist[i].id+'" data-ftitle="" data-title="'+menusublist[i].title+'"  onclick="changeEndSubMenu(this,2)">'+menusublist[i].title+'</div>';
                    str += '</a>';
                    str += '</div>';
                    str += '</div>';
                }

            }
            $('.qsidenablistthreemenulist').html(str);


            let menustr = '<iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="'+menuurl2+'" frameborder="0" data-id="'+menuurl2+'" seamless></iframe>';
            $('#gy-main-iframe-menu').html(menustr);

            if(firstmenuid){
                $('.endmenuactive'+firstmenuid).addClass('cur');
            }
        }




    })

</script>

</body>
</html>