/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) * Copyright (c) 2013-2018 北京泉江科技有限公司 * 创建人:陈彬彬 * 日 期:2017.03.16 * 描 述:经典风格皮肤 */ var autoopenid = request('autoopen'); var pwd = request("pwd"); var bootstrap = function ($, learun) { "use strict"; // 菜单操作 var meuns = { init: function () { this.load(); this.bind(); }, load: function () { var modulesTree = learun.clientdata.get(['modulesTree']); // 第一级菜单 var parentId = '0'; var modules = modulesTree[parentId] || []; var $firstmenus = $('
'); for (var i = 0, l = modules.length; i < l; i++) { var item = modules[i]; if (item.F_IsMenu == 1) { var $firstMenuItem = $(''); if (!!item.F_Description) { $firstMenuItem.attr('title', item.F_Description); } var menuItemHtml = ''; menuItemHtml += ''; menuItemHtml += ' '; menuItemHtml += ''; $firstMenuItem.append(menuItemHtml); // 第二级菜单 // var secondModules = modulesTree[item.F_ModuleId] || []; // var $secondMenus = $(' '); // var secondMenuHad = false; // for (var j = 0, sl = secondModules.length; j < sl; j++) { // var secondItem = secondModules[j]; // if (secondItem.F_IsMenu == 1) { // secondMenuHad = true; // var $secondMenuItem = $(''); // if (!!secondItem.F_Description) { // $secondMenuItem.attr('title', secondItem.F_Description); // } // var secondItemHtml = ''; // secondItemHtml += ''; // secondItemHtml += ' '; // secondItemHtml += ''; // // $secondMenuItem.append(secondItemHtml); // // 第三级菜单 // var threeModules = modulesTree[secondItem.F_ModuleId] || []; // var $threeMenus = $(' '); // var threeMenuHad = false; // for (var m = 0, tl = threeModules.length; m < tl; m++) { // var threeItem = threeModules[m]; // if (threeItem.F_IsMenu == 1) { // threeMenuHad = true; // var $threeMenuItem = $(''); // $threeMenuItem.attr('title', threeItem.F_FullName); // var threeItemHtml = ''; // threeItemHtml += ''; // threeItemHtml += ' '; // threeItemHtml += ''; // $threeMenuItem.append(threeItemHtml); // //第四级菜单 // var fourModules = modulesTree[threeItem.F_ModuleId] || []; // var $fourMenus = $(' '); // var fourMenuHad = false; // for (var n = 0, fl = fourModules.length; n < fl; n++) { // var fourItem = fourModules[n]; // if (fourItem.F_IsMenu == 1) { // fourMenuHad = true; // var $fourMenuItem = $(''); // $fourMenuItem.attr('title', fourItem.F_FullName); // var fourItemHtml = ''; // fourItemHtml += ''; // fourItemHtml += ' '; // fourItemHtml += ''; // $fourMenuItem.append(fourItemHtml); // $fourMenus.append($fourMenuItem); // } // } // if (fourMenuHad) { // $threeMenuItem.addClass('lr-meun-had'); // $threeMenuItem.append($fourMenus); // } // $threeMenus.append($threeMenuItem); // } // } // if (threeMenuHad) { // $secondMenuItem.addClass('lr-meun-had'); // $secondMenuItem.append($threeMenus); // } // $secondMenus.append($secondMenuItem); // } // } // if (secondMenuHad) { // $firstMenuItem.append($secondMenus); // } $firstmenus.append($firstMenuItem); } } $('#lr_frame_menu').html($firstmenus); // 语言包翻译 $('.lr-menu-item-text').each(function () { var $this = $(this); var text = $this.text(); learun.language.get(text, function (text) { $this.text(text); $this.parent().parent().attr('title', text); }); }); }, bind: function () { $("#lr_frame_menu").lrscroll(); $("#lr_frame_menu .lr-first-menu-list > li").hover(function (e) {// 一级菜单选中的时候判断二级菜单的位置 //$('#lr_frame_menu').width(4000); var $secondMenu = $(this).find('.lr-second-menu-list'); var length = $secondMenu.find('li').length; if (length > 0) { $secondMenu.css('top', '0px'); var secondMenuTop = $(this).offset().top + $secondMenu.height() + 23; var bodyHeight = $(window).height(); if (secondMenuTop > bodyHeight) { $secondMenu.css('top', '-' + (secondMenuTop - bodyHeight) + 'px'); } } }, function (e) { $('#lr_frame_menu').width(80); }); $("#lr_frame_menu .lr-second-menu-list > li.lr-meun-had").hover(function (e) {// 二级菜单选中的时候判断三级菜单的位置 var $ul = $(this).find('.lr-three-menu-list'); $ul.css('top', '-9px'); var ulTop = $(this).offset().top + $ul.height() + 23; var bodyHeight = $(window).height(); if (ulTop > bodyHeight) { $ul.css('top', '-' + (ulTop - bodyHeight) + 'px'); } }); $("#lr_frame_menu .lr-three-menu-list > li.lr-meun-had").hover(function (e) {// 二级菜单选中的时候判断三级菜单的位置 var $ul = $(this).find('.lr-four-menu-list'); $ul.css('top', '-9px'); var ulTop = $(this).offset().top + $ul.height() + 23; var bodyHeight = $(window).height(); if (ulTop > bodyHeight) { $ul.css('top', '-' + (ulTop - bodyHeight) + 'px'); } }); var desktopnavigation = learun.clientdata.get(['modulesMap', "be81bdde-8bbc-4080-b976-84faefc414d2"]); // 添加点击事件 $('#lr_frame_menu .lr-menu-item').on('click', function () { var $obj = $(this); var id = $obj.attr('id'); if ($('#lr_tab_be81bdde-8bbc-4080-b976-84faefc414d2').length != 0) { learun.frameTab.close('be81bdde-8bbc-4080-b976-84faefc414d2'); } var _module = learun.clientdata.get(['modulesMap', id]); learun.frameTab.open({ F_ModuleId: desktopnavigation.F_ModuleId, F_Icon: desktopnavigation.F_Icon, F_FullName: desktopnavigation.F_FullName, F_UrlAddress: desktopnavigation.F_UrlAddress + '?id=' + id }, false); }); //使用引导页 var guide = learun.clientdata.get(['modulesMap', "44e91494-942d-482d-949e-ae8af5333956"]); if (guide) { //learun.frameTab.open(guide); learun.frameTab.open({ F_ModuleId: guide.F_ModuleId, F_Icon: guide.F_Icon, F_FullName: guide.F_FullName, F_UrlAddress: guide.F_UrlAddress }, true); } //上网认证 if (ACIp != null && ACIp != "") { //Ip上网 sendToAc(ACIp, 'logon', Ip, learun.clientdata.get(['userinfo']).account, ''); } if (ACIp2 != null && ACIp2 != "") { //Ip上网 sendToAc(ACIp2, 'logon', Ip, learun.clientdata.get(['userinfo']).account, ''); } //桌面导航 // var desktopnavigation = learun.clientdata.get(['modulesMap', "be81bdde-8bbc-4080-b976-84faefc414d2"]); // if (desktopnavigation) { // learun.frameTab.open({ F_ModuleId: desktopnavigation.F_ModuleId, F_Icon: desktopnavigation.F_Icon, F_FullName: desktopnavigation.F_FullName, F_UrlAddress: desktopnavigation.F_UrlAddress }, true); // } //var needtodo = learun.clientdata.get(['modulesMap', "021a59b0-2589-4f9e-8140-6052177a967c"]); //if (needtodo) { // //自动弹出待办事项 // top.layer.open({ // id: 'ntdform', // title: '我的待办事项', // type: 2, // skin: 'lr-layer', // btn: ['关闭'], // content: top.$.rootUrl + '/Home/NeedToDoForm', // area: ['500px', '300px'] // }); //} if (pwd == "true") { top.layer.open({ id: 'pwdform', title: '密码修改', closeBtn: 0, resize: false, type: 2, skin: 'lr-layer', btn: ['确定'], content: top.$.rootUrl + '/Home/ChangePwd', area: ['500px', '300px'], success: function (layero, index) { top['layer_pwdform'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames); layero[0].learun_layerid = 'layer_pwdform'; }, yes: function (index, layero) { var flag = top['layer_pwdform'].acceptClick(function () { top.location.href = "/Login/Index"; }); if (!!flag) { learun.layerClose('', index); } }, end: function () { top['layer_pwdform'] = null; } }); } if (!!autoopenid) { var _module = learun.clientdata.get(['modulesMap', autoopenid]); switch (_module.F_Target) { case 'iframe':// 窗口 if (learun.validator.isNotNull(_module.F_UrlAddress).code) { learun.frameTab.open(_module); var keyValue = request('keyValue'); //内部邮件 if (autoopenid == '252878d7-d807-497f-b01e-839bb1b869c6' && !!keyValue) { var iframe = document.getElementById('lr_iframe_' + autoopenid); top.layer.open({ id: 'viewform', title: '查看', type: 2, skin: 'lr-layer', btn: ['回复', '转发', '关闭'], content: top.$.rootUrl + '/EducationalAdministration/SYS_ReceiveMessage/FormView?keyValue=' + keyValue, area: ['800px', '700px'], success: function (layero, index) { top['viewform'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames); //自动已读 learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/SYS_ReceiveMessage/Read', { keyValue: keyValue }, function () { iframe.contentWindow.refreshreceivetableGirdData(); }); }, yes: function (index, layero) { top.layer.open({ id: 'resendform', title: '回复邮件', type: 2, skin: 'lr-layer', btn: ['发送', '保存草稿', '关闭'], content: top.$.rootUrl + '/EducationalAdministration/SYS_ReceiveMessage/Form?keyValue=' + keyValue, area: ['800px', '700px'], success: function (layero, index) { top['resendform'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames); }, yes: function (index, layero) { top['resendform'].acceptClick(iframe.contentWindow.sendthismessage); top['resendform'] = null; top.layer.close(index); } , btn2: function (index, layero) { top['resendform'].acceptClick(iframe.contentWindow.refreshsendtableGirdData); top['resendform'] = null; top.layer.close(index); } , btn3: function (index, layero) { top['resendform'] = null; top.layer.close(index); } }); top['viewform'] = null; top.layer.close(index); }, btn2: function (index, layero) { top.layer.open({ id: 'chsendform', title: '转发邮件', type: 2, skin: 'lr-layer', btn: ['发送', '保存草稿', '关闭'], content: top.$.rootUrl + '/EducationalAdministration/SYS_ReceiveMessage/FormCh?keyValue=' + keyValue, area: ['800px', '700px'], success: function (layero, index) { top['chsendform'] = learun.iframe($(layero).find('iframe').attr('id'), top.frames); }, yes: function (index, layero) { top['chsendform'].acceptClick(iframe.contentWindow.sendthismessage); top['chsendform'] = null; top.layer.close(index); } , btn2: function (index, layero) { top['chsendform'].acceptClick(iframe.contentWindow.refreshsendtableGirdData); top['chsendform'] = null; top.layer.close(index); } , btn3: function (index, layero) { top['chsendform'] = null; top.layer.close(index); } }); top['viewform'] = null; top.layer.close(index); }, btn3: function (index, layero) { top['viewform'] = null; top.layer.close(index); } }); } //我的任务 if (autoopenid == '021a59b0-2589-4f9e-8140-6052177a967c' && !!request('F_Id')) { var processId = request('F_Id'); var taskId = request('F_TaskId'); var taskType = request('F_TaskType'); if (taskType == 4) { if (learun.checkrow(taskId)) { learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '审核流程', F_UrlAddress: '/LR_WorkFlowModule/WfMyTask/CustmerWorkFlowForm?tabIframeId=' + taskId + '&type=4' + "&processId=" + processId + "&taskId=" + taskId }); } } else if (taskType == 1) { if (learun.checkrow(taskId)) { learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '审核流程', F_UrlAddress: '/LR_WorkFlowModule/WfMyTask/CustmerWorkFlowForm?tabIframeId=' + taskId + '&type=1' + "&processId=" + processId + "&taskId=" + taskId }); } } else if (taskType == 2) { learun.alert.warning('请点击重新发起'); } else { if (learun.checkrow(taskId)) { learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '审核流程', F_UrlAddress: '/LR_WorkFlowModule/WfMyTask/CustmerWorkFlowForm?tabIframeId=' + taskId + '&type=3' + "&processId=" + processId + "&taskId=" + taskId }); } } } //办事大厅 if (autoopenid == '56ce34c2-882e-47d1-b12d-5036e3b79fcf' && !!request('shcemeCode')) { var id = request('id'); var shcemeCode = request('shcemeCode'); //learun.frameTab.open({ F_ModuleId: id, F_Icon: 'fa magic', F_FullName: '发起流程【快捷发起】', F_UrlAddress: '/LR_WorkFlowModule/WfMyTask/CustmerWorkFlowForm?shcemeCode=' + shcemeCode + '&tabIframeId=' + id + '&type=0' }); learun.frameTab.open({ F_ModuleId: id, F_Icon: 'fa magic', F_FullName: '发起流程【快捷发起】', F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?shcemeCode=' + shcemeCode + '&tabIframeId=' + id + '&type=create' }); } //公告 if (autoopenid == '6252983c-52f5-402c-991b-ad19a9cb1f94' && !!keyValue) { learun.frameTab.open({ F_ModuleId: "dtlist" + keyValue, F_FullName: '通知公告', F_UrlAddress: "/Utility/ListContentIndex?id=" + keyValue }); } } break; case 'open':// 窗口 var newWin = window.open(_module.F_UrlAddress); newWin.location.replace(_module.F_UrlAddress); break; } } } }; meuns.init(); var companyMap = {}; var departmentMap = {}; var userMap = {}; var sysUserMap = {}; var imUserId = ''; //获取头像 var getHeadImg = function (user) { var url = top.$.rootUrl; switch (user.img) { case '0': url += '/Content/images/head/on-girl.jpg'; break; case '1': url += '/Content/images/head/on-boy.jpg'; break; default: url += '/LR_OrganizationModule/User/GetImg?userId=' + user.id; break; } return url; }; // 发送聊天信息 var sendMsg = function (msg, time) { var loginInfo = learun.clientdata.get(['userinfo']); learun.clientdata.getAsync('user', { key: loginInfo.userId, callback: function (data, op) { data.id = op.key; var _html = '\