123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394 |
- <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
- <%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
- <script>
- // 设置jQuery Ajax全局的参数
- $.ajaxSetup({
- type: "POST",
- error: function(jqXHR, textStatus, errorThrown){
- isLogin();
- switch (jqXHR.status){
- case(500):
- $.ligerDialog.error("服务器系统内部错误");
- break;
- case(401):
- $.ligerDialog.error("未登录");
- break;
- case(403):
- $.ligerDialog.error("无权限执行此操作");
- break;
- case(408):
- $.ligerDialog.error("请求超时");
- break;
- default:
- $.ligerDialog.error("未知错误");
- }
- }
- });
- //判断是否登录
- function isLogin(){
- $.ajax({ //获取是否
- type: "POST",
- url : "${contextRoot}/system/isLogin",
- dataType : "json",
- cache:false,
- success :function(data){
- if(!data.successFlg) {
- location.href = "${contextRoot}/loginPage";
- }
- },
- error :function(data){
- location.href = "${contextRoot}/loginPage";
- }
- });
- }
- var indexPage = {
- localNav:[],
- homeUrl:"${contextRoot}/homePage",
- init:function(){
- var me = this;
- //主布局
- $("#divIndexMain").ligerLayout({
- space:0,
- topHeight:120,
- leftWidth:220,
- allowLeftCollapse:false,
- allowLeftResize:false,
- allowTopResize:false
- });
- $(".l-layout-left").css({background:"#dce6f0"})
- //菜单列表
- var menu = [
- //任务管理
- {id: 1, text: '任务管理',icon:'${staticRoot}/images/index/menu2_icon.png'},
- {id: 11, pid: 1, text: '任务跟踪', url: '${contextRoot}/datacollect/trackJob',targetType:'1'},
- {id: 12, pid: 1, text: '任务补采', url: '${contextRoot}/datacollect/repeatDatacollect'},
- {id: 13, pid: 1, text: '任务配置', url: '${contextRoot}/datacollect/configJob'},
- {id: 14, pid: 1, text: '任务编排', url: '${contextRoot}/crawler/jobLayout'},
- //标准管理
- //标准规范中心
- {id: 2, text: '标准管理',icon:'${staticRoot}/images/index/menu3_icon.png'},
- {id: 21, pid: 2, text: '集成标准', url: '${contextRoot}/integration/initial/standard'},
- {id: 22, pid: 2, text: '应用标准', url: '${contextRoot}/integration/initial/application'},
- {id: 23, pid: 2, text: '适配方案', url: '${contextRoot}/adapterPlan/initial'},
- //资源管理
- {id: 3, text: '资源管理',icon:'${staticRoot}/images/index/menu4_icon.png'},
- {id: 31, pid: 3, text: '资源注册', url: '${contextRoot}/resource/resource/initial'},
- {id: 32, pid: 3, text: '资源浏览', url: '${contextRoot}/resource/resourcePage'},
- {id: 34, pid: 3, text: '资源分类', url: '${contextRoot}/resource/rsCategory/initial'},
- {id: 35, pid: 3, text: '业务资源', url: '${contextRoot}/resourceRest/initial'},
- //维度管理
- {id: 4, text: '维度管理',icon:'${staticRoot}/images/index/menu5_icon.png'},
- {id: 41, pid: 4, text: '维度配置', url: '${contextRoot}/dimension/dimension'},
- {id: 42, pid: 4, text: '维度类别配置', url: '${contextRoot}/dimension/dimensioncatetory'},
- //系统配置
- {id: 9, text: '系统配置',icon:'${staticRoot}/images/index/menu6_icon.png'},
- {id: 91, pid: 9, text: '机构配置', url: '${contextRoot}/org/initial'},
- {id: 92, pid: 9, text: '数据源配置', url: '${contextRoot}/datasource/configSources'},
- {id: 93, pid: 9, text: '菜单配置', url: '${contextRoot}/menu/initial'},
- {id: 100, pid: 9, text: '菜单按钮配置', url: '${contextRoot}/menu/menuAction/initial'},
- {id: 94, pid: 9, text: '用户管理', url: '${contextRoot}/user/initial'},
- {id: 95, pid: 9, text: '角色管理', url: '${contextRoot}/role/initial'},
- {id: 96, pid: 9, text: '权限管理', url: '${contextRoot}/authority/initial'},
- {id: 97, pid: 9, text: '字典管理', url: '${contextRoot}/dict/initial' },
- {id: 98, pid: 9, text: '系统参数', url: '${contextRoot}/param/initial'},
- {id: 99, pid: 9, text: '<spring:message code="title.app.manage"/>', url: '${contextRoot}/app/initial'}
- ];
- me.menuTree = $('#ulTree').ligerTree({
- data: menu,
- idFieldName: 'id',
- parentIDFieldName: 'pid',
- checkbox: false,
- treeLine: false,
- autoCheckboxEven: false,
- needCancel: false,
- btnClickToToggleOnly: false,
- slide: false,
- nodeDraggable: false,
- isExpand: false,
- parentIcon:true,
- nodeWidth:176,
- onSelect: function (obj) {
- if(obj.data.url!=undefined)
- {
- me.openMenu(obj);
- }
- },
- //一级节点不可选中
- onAfterAppend:function(){
- $.each($("#ulTree li[outlinelevel='1']"),function(index,item){
- $(item).addClass("l-unselectable");
- });
- }
- });
- //首页按钮
- $('#btnIndexHome').bind('click',function(){
- me.openHome();
- });
- //退出按钮
- $('#btnIndexLogout').click(function(){
- $.ligerDialog.confirm('是否确认退出!', function (yes)
- {
- if(yes)
- {
- $.ajax({ //获取表的字段列表
- type: "POST",
- url : "${contextRoot}/system/logoutAction",
- dataType : "json",
- cache:false,
- success :function(data){
- if(data.successFlg) {
- location.href = "${contextRoot}/loginPage";
- }
- else{
- $.ligerDialog.error(data.message);
- }
- },
- error :function(data){
- $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
- }
- });
- }
- });
- });
- $('#btnIndexPassword').click(function(){
- me.dialog= $.ligerDialog.open({
- height: 300,
- width: 600,
- title: "修改密码",
- url: '${contextRoot}/user/renewPassword',
- });
- });
- //me.openHome();
- //打开默认菜单
- me.openMenuByText("任务跟踪");
- },
- //加载中
- loading:function(){
- $('#divIndexContent').html("loading...");
- },
- //首页按钮选择/取消
- clickHomeBtn:function(isClick){
- try {
- var btn = $("#btnIndexHome");
- if (!isClick) {
- btn.removeClass('m-index-menu-top-over');
- }
- else {
- btn.addClass('m-index-menu-top-over');
- }
- }
- catch(e)
- {
- return;
- }
- },
- //打开首页
- openHome:function(){
- try {
- var me = this;
- me.localNav = [];
- me.localNav.push({text: "主页", url: me.homeUrl});
- me.localRender();
- me.clickHomeBtn(true);
- //取消菜单选中
- $('#ulTree .l-body.l-selected').removeClass("l-selected");
- me.loading();
- $('#divIndexContent').load(me.homeUrl);
- }
- catch(e)
- {
- return;
- }
- },
- //刷新当前位置栏
- localRender:function(){
- try {
- var me = this;
- var html = "";
- if (me.localNav.length > 0) {
- for (var i = 0; i < me.localNav.length; i++) {
- var text = me.localNav[i].text;
- var url = me.localNav[i].url;
- if (i == me.localNav.length - 1) //最后一个节点
- {
- html += text;
- }
- else {// html += "<a class='localNavBtn' href='javascripr:void(0)' url='"+url+"' onclick='indexPage.openMenu()'>"+text + "</a> > ";
- html += "<a class='localNavBtn' href='javascripr:void(0)' url='" + url + "' onclick='indexPage.openMenu()'>" + text + "</a>";
- }
- }
- }
- $('#indexNav').html(html);
- }
- catch(e)
- {
- return;
- }
- },
- //打开菜单(暂不考虑多级菜单)
- openMenu:function(obj){
- try {
- var me = this;
- var id = obj.data.id;
- var text = obj.data.text;
- var url = obj.data.url;
- me.localNav = [];
- me.localNav.push({id: id, text: text, url: url});
- //父亲节点
- me.localRender();
- me.clickHomeBtn(false);
- if (obj.data.targetType == "1") {
- me.loadIframePage(url);
- }
- else if (obj.data.targetType == "2") {
- window.open(url);
- }
- else {
- me.loadPage(url);
- }
- }
- catch(e)
- {
- return;
- }
- },
- //弹窗返回
- dialogSuccess:function(message){
- this.dialog.close();
- $.ligerDialog.success(message);
- },
- //打开子功能页面
- openChildPage:function(text,url,targetType,data,fun){
- try {
- var me = this;
- me.localNav.push({text: text, url: url, data: data, fun: fun});
- me.localRender();
- if (targetType == "1") {
- me.loadIframePage(url, data, fun);
- }
- else if (targetType == "2") {
- window.open(url);
- }
- else {
- me.loadPage(url, data, fun);
- }
- }
- catch(e)
- {
- return;
- }
- },
- //加载页面
- loadPage:function(url,data,fun){
- try {
- var me = this;
- me.loading();
- var div = $("<div class='m-index-content'></div>").load(url, data, function () {
- if (fun != undefined && typeof fun == 'function') {
- fun();
- }
- });
- $('#divIndexContent').html(div);
- }
- catch(e)
- {
- return;
- }
- },
- //加载iframe页面
- loadIframePage:function(url,data,fun){
- try {
- var me = this;
- $('#divIndexContent').html("<iframe style='height:98%;width:100%' frameborder='0' src='" + url + "' allowTransparency='true'></iframe>");
- }
- catch(e)
- {
- return;
- }
- },
- //通过text打开菜单
- openMenuByText:function(text,params,select){
- try {
- var me = this;
- if(select==false) {
- var nodeText = $("span", me.menuTree.tree);
- var url = "";
- $.each($("div[class='l-body l-selected']", me.menuTree.tree),function(){
- $(this).removeClass("l-selected");
- });
- debugger
- for (var i = 0; i < nodeText.length; i++) {
- if ($(nodeText[i]).text().indexOf(text) >= 0) {
- var id = $(nodeText[i]).closest("li").attr("id");
- url = $(nodeText[i]).closest("li").attr("url");
- me.menuTree.expandNode(id);
- $(nodeText[i]).closest("li").find("div[class='l-body']").addClass("l-selected");
- break;
- }
- }
- //当前位置栏
- me.localNav = [];
- me.localNav.push({id: id, text: text, url: url});
- me.localRender();
- me.clickHomeBtn(false);
- //打开页面
- me.loadPage(url,params);
- }
- else{
- //选择节点
- me.menuTree.queryByText(text,select);
- }
- }
- catch(e)
- {
- return;
- }
- },
- //刷新当前页面
- refresh:function(){
- try {
- var me = this;
- if (me.localNav.length > 0) {
- var text = me.localNav[me.localNav.length - 1].text;
- me.openMenuByText(text);
- }
- }
- catch(e)
- {
- return;
- }
- }
- }
- $(function () {
- isLogin();
- indexPage.init();
- });
- </script>
|