Ext.onReady(function(){
//定义右下内容部分 var content = new Ext.Panel({ region:'center', id:'content', html:'<iframe id="mainIframe" src="/dyzc/system/navigation.html" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>', bodyStyle:'background:url(../resources/images/zairu.jpg) #FFFFFF center center fixed no-repeat;' }); //定义Viewport视图 new Ext.Viewport({ layout:'border', items:[{ region:'north', border:false, bodyBorder:false, contentEl:'header', height:132, split: true, minSize: 132, maxSize: 132, collapseMode: 'mini' },{ region:'west', width:200, contentEl:'mymenu', split: true, minSize: 200, maxSize: 200, bodyCfg:{ cls:'body' }, scollapsible:true, collapseMode: 'mini' }, content ] }); //退出系统 var exit = Ext.get("exit"); exit.addClass('exit01'); exit.on({ 'mouseover':function(){exit.replaceClass('exit01','exit02');}, 'mouseout':function(){exit.replaceClass('exit02','exit01');}, scope:this }); exit.on('click',function(){ Ext.MessageBox.confirm('提示信息','你确定要退出系统吗?',function(btn){ if(btn=='yes'){ Ext.Ajax.request({ url : 'loginOut.action', // 请求地址 // 成功时回调 success : function(response, options) { var responseArray = response.responseText; if (responseArray == 'success') { location.replace('login.html'); } else { Ext.Msg.alert('操作失败'); } } }); } }); }); Ext.Ajax.request({ url : 'getLoginName.action', // 请求地址 // 成功时回调 success : function(response, options) { var responseArray = response.responseText; var tem = responseArray.split(","); var tem1 = tem[0]; var tem2 = tem[1]; document.getElementById("user").innerHTML += tem1; var n = 9; var winTip = new Ext.Window({ resizable:false, layout: 'fit', shadow:false, width: 240, title: '温馨提示<font size="2" color="#FFFFFF">(点击查看详情)</font>', height: 160, hideBorders:true, //bodyStyle:'padding-top:25px; padding-left:10px;', //modal:true, pageX:1500, pageY:800, constrain:true, closeAction: 'hide', html:'<div style=" padding-left:25px; height:120px; background: url(/dyzc/resources/images/tipBk.gif) no-repeat center scroll !important; line-height:100px;"><a id="renwu" href="#">欢迎:<font color="#537DB0">'+tem1+'</font>,你有<font color="red">'+tem2+'</font>条待办任务!</a></div>' }) winTip.show(); Ext.get('renwu').on({ 'click':function(t){ winTip.hide(); Ext.getCmp('content').update('<iframe src="/dyzc/task/tasklist.html" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>'); }, //'mouseover':function(t){Ext.get(t.target.id).addClass('tipClass')}, //'mouseout':function(t){Ext.get(t.target.id).removeClass('tipClass')}, scope:this }); } }); var content = Ext.getCmp('content'); //导航菜单 iconMap ={ '我的体系文件':'nav002Header', '我的任务':'nav003Header', '我的流程':'nav004Header', '表单设计':'nav005Header', '流程设计':'nav006Header', '对标管理':'nav007Header', '短信管理':'nav008Header', '即时通讯工具下载':'nav009Header', '系统管理':'nav010Header', '信件管理':'nav011Header', '公文收发管理':'nav012Header', '收文管理':'nav013Header' }; iconMapS ={ '我的体系文件':'nav002Header_2', '我的任务':'nav003Header_2', '我的流程':'nav004Header_2', '表单设计':'nav005Header_2', '流程设计':'nav006Header_2', '对标管理':'nav007Header_2', '短信管理':'nav008Header_2', '即时通讯工具下载':'nav009Header_2', '系统管理':'nav010Header_2', '信件管理':'nav011Header_2', '公文收发管理':'nav012Header_2', '收文管理':'nav013Header_2' } Ext.Ajax.request({url : 'getmenu.action', // 请求地址 // 成功时回调 success : function(response, options) { var responseArray = response.responseText; var menuJson=Ext.decode(responseArray); document.getElementById('mymenu').appendChild(myMenu(menuJson)); } }); function myMenu(o) {
var menu = document.createElement('ul'); if (o.length) { for (var i = 0; i < o.length; i++) { menu.appendChild(createLi(o[i])); } } else { menu.appendChild(createLi(o)); } return menu; } function createLi(o) { var li = document.createElement('li'); var linkObj = document.createElement('a'); linkObj.href = '#'; if(o.url){ linkObj.onclick = function(){ content.update('<iframe src="'+o.url+'" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>'); }; } linkObj.innerHTML = ''+(o.text || '')+''; if(iconMap[o.text]){ linkObj.className = iconMap[o.text]; }else{ linkObj.className = "arrow"; } li.appendChild(linkObj); if (o.items) { var childMenu = myMenu(o.items); childMenu.style.display = 'none'; //初始化时导航未展开 li.appendChild(childMenu); linkObj.onclick = function() { linkObj.className = (linkObj.className == iconMapS[o.text])?iconMap[o.text]:iconMapS[o.text]; var dis = childMenu.style.display; childMenu.style.display = (dis == null || dis == "block" || dis == '') ? "none": "block"; } }; return li; } }); getmenu.action 方法:
public void getmenulist()
{ try{ Map menulistmap = ActionContext.getContext().getSession(); List<MenuInfo> list=(List)(menulistmap.get("menuList")); List<MenuInfo> list1=new ArrayList<MenuInfo>(); //List<MenuInfo> list2=null; StringBuffer jsonstr=new StringBuffer(); jsonstr.append("["); int len=0; len=jsonstr.length(); if(list!=null) { for(int i=0;i<list.size();i++) { if(list.get(i).getHmid()==0) list1.add(list.get(i)); } for(int i=0;i<list1.size();i++) { jsonstr.append("{text:\""); jsonstr.append(list1.get(i).getName()); jsonstr.append("\",url:\""); jsonstr.append(list1.get(i).getUrl()); jsonstr.append("\",items:["); len=jsonstr.length(); for(int j=0;j<list.size();j++) { if(list.get(j).getHmid()==list1.get(i).getMid()) { jsonstr.append("{text:\""); jsonstr.append(list.get(j).getName()); jsonstr.append("\",url:\""); jsonstr.append(list.get(j).getUrl()); jsonstr.append("\"},"); } } if(len!=jsonstr.length()) { jsonstr.delete(jsonstr.length()-1, jsonstr.length()); } jsonstr.append("]},"); } } if(len!=jsonstr.length()) { jsonstr.delete(jsonstr.length()-1, jsonstr.length()); } jsonstr.append("]"); this.outString(jsonstr.toString()); }catch(Exception ex){ ex.printStackTrace(); } } |
|