`

Extjs open

阅读更多
    Ext.require(['*']);

    Ext.onReady(function() {

        Ext.QuickTips.init();

        Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));

		//菜单模型
		var model = Ext.define("TreeModel", { // 定义树节点数据模型  
                extend : "Ext.data.Model",  
                fields : [
                		{name : "id",		type : "string"},  
                        {name : "text",		type : "string"},  
                        {name : "iconCls",	type : "string"},  
                        {name : "leaf",		type : "boolean"},  
                        {name : 'url',		type : "string"}
                ]  
        });
            
		//菜单数据源
		var treeStore = new Ext.data.TreeStore({
		        model: model,
		        root: {
		            text: 'Root',
		            expanded: true,
		            children: [{
		                text: '机构管理',
		                id:1,
		                url:path+'/backend/sysUnit/main',
		                canDropOnFirst: true,
		                canDropOnSecond: true,
		                leaf: true
		            }, {
		                text: '用户管理',
		                id:2,
		                url:path+'/backend/sysUser/main',
		                canDropOnFirst: true,
		                canDropOnSecond: false,
		                leaf: true
		            }, {
		                text: '权限管理',
		                id:3,
		                url:path+'/backend/sysAuthority/main',
		                canDropOnFirst: false,
		                canDropOnSecond: true,
		                leaf: true
		            }, {
		                text: '应用系统管理',
		                id:4,
		                url:path+'/backend/sysApp/main',
		                canDropOnFirst: false,
		                canDropOnSecond: false,
		                leaf: true
		            }, {
		                text: '资源管理',
		                id:5,
		                url:path+'/backend/sysResource/main',
		                canDropOnFirst: false,
		                canDropOnSecond: false,
		                leaf: true
		            }]
		        }
		});
		
		
		//菜单树
		var treePanel=Ext.create('Ext.tree.Panel', {
		        //title: 'treePanel',
        		store: treeStore,
        		rootVisible: false,
                useArrows: true,
		        height:'100%',
		        border: false,
		        listeners : {  
		            'itemclick' : function(view,record){  
		                if(record.data.leaf){
				            //e.stopEvent();
				            //alert(record.data.id);
				            var id=record.data.id;
				            var tab = centerPanel.getComponent(id);
				            if (!tab) {
				                var n = centerPanel.add({
				                            'id' : id,
				                            'title' : record.data.text,
				                            closable : true,
				                            //width:Ext.get("formPanel").getWidth()+17,
				                            //height:centerPanel.getHeight(),
				                           // html:'<iframe frameborder="0" width="100%" height="100%" src="chartsStyle'+typeId+'!main.do?itemId='+id+'"></iframe>',
				                            autoLoad : {
				                                url : record.data.url,
				                                scripts : true
				                            } // 通过autoLoad属性载入目标页,如果要用到脚本,必须加上scripts属性
				                        }).show();
				                        
				            }else{//若是存在  
          	                    	centerPanel.setActiveTab(tab);//Active  
       	                    } 
				        }else{  
		                    if(record.data.expanded){  
		                        view.collapse(record);  
		                    }else{  
		                        view.expand(record);  
		                    }  
		                }
		            } ,
		            'itemdblclick' : function(view, record, item, index, e, eOpts){  
		            	if(record.data.leaf){
		            		
				            var id=record.data.id;
				            var tab = centerPanel.getComponent(id);
				            if (tab) {
          	                    	centerPanel.remove(tab);
       	                    } 
       	                    
       	                    var n = centerPanel.add({
				                            'id' : id,
				                            'title' : record.data.text,
				                            closable : true,
				                            autoLoad : {
				                                url : record.data.url,
				                                scripts : true
				                            } // 通过autoLoad属性载入目标页,如果要用到脚本,必须加上scripts属性
	                        }).show();
	                        
				        }else{  
		                    if(record.data.expanded){  
		                        view.collapse(record);  
		                    }else{  
		                        view.expand(record);  
		                    }  
		                }
		            }
		        }
    	});
				//应用设置数据源
		var appTreeStore = new Ext.data.TreeStore({
	        model: model,
	        root: {
	            text: 'Root',
	            expanded: true,
	            children: [{
	                text: '绑定设备',
	                id:'/backend/bindingDevices',
	                url:path+'/backend/bindingDevices/main',
	                canDropOnFirst: true,
	                canDropOnSecond: true,
	                leaf: true
	            }, {
	                text: '报告类别管理',
	                id:'docType',
	                url:path+'/backend/docType/main',
	                canDropOnFirst: true,
	                canDropOnSecond: false,
	                leaf: true
	            }, {
	                text: '文档管理',
	                id:'/docManager',
	                url:path+'/backend/docManager/main',
	                canDropOnFirst: true,
	                canDropOnSecond: false,
	                leaf: true
	            }]
	        }
	});
		//应用管理菜单树
		var appTreePanel=Ext.create('Ext.tree.Panel', {
	        //title: 'treePanel',
    		store: appTreeStore,
    		rootVisible: false,
            useArrows: true,
	        height:'100%',
	        border: false,
	        listeners : {  
	            'itemclick' : function(view,record){  
	                if(record.data.leaf){
			            var id=record.data.id;
			            var tab = centerPanel.getComponent(id);
			            if (!tab) {
			                var n = centerPanel.add({
	                            'id' : id,
	                            'title' : record.data.text,
	                            closable : true,
	                            autoLoad : {
	                                url : record.data.url,
	                                scripts : true
	                            } 
	                        }).show();			                        
			            }else{//若是存在  
      	                    	centerPanel.setActiveTab(tab);//Active  
   	                    } 
			        }else{  
	                    if(record.data.expanded){  
	                        view.collapse(record);  
	                    }else{  
	                        view.expand(record);  
	                    }  
	                }
	            }  
	        }
	});

		//顶部面板
		var northPannel=Ext.create("Ext.panel.Panel", {
				height : 80,
				html :'<img style="padding-left:20px;padding-top:10px;"'+
				'src="'+path+'/images/sub_logo.png"></img>',
				region : 'north',
				split : true,
				bbar : [{
					iconCls : 'icon-user',
					text : sysLoginUser
				},'-',{
					text : Ext.Date.format(new Date(),'Y年m月d日')
				},'->',{
					text : '退出',
					iconCls : 'icon-logout',
					handler : function() {
			            window.location.href=path+"/logoutBackend.jsp"; 
					}
				}],
				bodyStyle : 'background-image: url('+path+'/images/admin/admin-header-bg.png)'
							
		});
		
		//中间内容面板
		var centerPanel=Ext.create('Ext.tab.Panel', {
				id:"centerPanel",
				name:"centerPanel",
                region: 'center',
                deferredRender: false,
                activeTab : 0,  
                enableTabScroll : true,  
                animScroll : true,  
                border : true,  
                autoScroll : true,  
                region : 'center',  
                split : true, 
                items: []
         });
		
		//左边菜单面板	
		var westPannel=Ext.create("Ext.panel.Panel", {	
				id:"westPannel",
				name:"westPannel",
				region: 'west',
                stateId: 'navigation-panel',
                title: '功能菜单',
                split: true,
                width: 200,
                minWidth: 175,
                maxWidth: 400,
                collapsible: true,
                animCollapse: true,
                margins: '0 0 0 5',
                layout: 'accordion',
                items: [{
                    title: '权限管理',
                    iconCls: 'icon-mainmenu',
                    items:[
                    	treePanel
                    ]
                },{
                	title: '应用设置',
                    iconCls: 'icon-operate',
                    items:[
                         appTreePanel
                    ]
                }]
		});

		//系统视图
        var viewport = Ext.create('Ext.Viewport', {
            id: 'viewport',
            layout: 'border',
            items: [
            	northPannel,
             	westPannel,
            	centerPanel
           	]
        });
        
    });
分享到:
评论

相关推荐

    ExtJS 4.1 Open Source Version

    ExtJS 4从创建之初,就以最全面现代化为目标,它采用了改进的架构和加入了许多新的特性,从而使你可以创建可靠的下一代网络应用程序。框架的每个部分几乎都已升级和优化,已充分利用当今的现代浏览器,同时兼容之前...

    Extjs-ext-3.1.1

    Ext is licensed under the terms of the Open Source GPL 3.0 license. http://www.gnu.org/licenses/gpl.html There are several FLOSS exceptions available for use with this release for open source ...

    ExtJs资料

    项目中用到了extjs,为了方便自学整理了一些extjs的资料,大家互相学习啊。 --open source,free software

    ExtJS(ajax框架) 4.2.1

    Commercial and Open Source licenses available 更新说明 核心改进:检视框架的架构和重塑其基础。这些变化不单提供了产品性能,还提高了其健壮性。 测试框架:在所有支持的浏览器上对框架进行了持续全面的测试...

    ExtJS .net分页例子

    ExtJS .net分页例子SqlConnection con = new SqlConnection(); con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;//ConnectionString ...

    Extjs+lazarus:CRUD网页的快速实现

    搞定后,版主又要我进行了“ open a new issue in the bugtracker and add a diff with the changes ”。本着互助、共享的原则,整个东西放到lazarus中文社区论坛,欢迎大家不断改善源码,提高性能,并且将改善后的...

    前台用extjs后台用java.如何导出excel报表

    前台new Ext.Button({ text:'导出EXCEL', handler:function(){ var appWindow = window.open("getExecl.do"); //调action得到数据生成execl格式的数据,response发往前台 appWindow.focus(); }})后台: filename是...

    learn extjs

    He strives to use open source libraries as they are often the launching pad for the most creative technological advances. After stumbling upon a young user interface library called YUI-ext several ...

    Ext js5 MVVM登录实例代码

    我使用的命令如下:sencha -sdk E:\openSrc\ext-5.0.0 generate app oaSystem E:\workspaces\myeclipse2014\csdn 如果不太清楚sencha cmd的命令参数,建议先阅读 ...

    Extjs ajax同步请求时post方式参数发送方式

    conn.open(“POST”, ‘http://localhost:8080/struts2study/TreeDDGet?node=-1’,false); // 这里的conn对象其实就是 xmlHttpRequest 对象。 conn.setRequestHeader(“Content-Type”,”application/x-...

    ext-7.0.0.156.zip

    截止2019.09.05,Sencha 还没有提供与 Sencha ...本 SDK 是我从 Open Source (Open Tooling) 版的 ExtJS npm 包中提取整合出来的。 已经测试过,可以由此 SDK 创建项目。 注意:此 SDK 里面没有官方 Examples 的代码。

    ExtAspNet_v2.1.5_dll

    Note: ExtAspNet bases on Open Source Projects like ExtJS, HtmlAgilityPack, Nii.JSON, YUICompressor. Open Source Project: http://extaspnet.codeplex.com/ Technical Support: http://sanshi.cnblogs.com/ ...

    基于SSM的java web项目框架

    框架为springMVC,采用spring4.1.2版本,后台java采用1.8(1.7也暂未发现严重缺陷),前端extjs版本使用5.1,tomcat采用7.0.79, 使用apache-maven 3.5.0管理jar包,数据库为mysql数据库,该模型采用使用单个jsp,点击...

    uniSF Component V1.1.1050 Unigui

    UniSFComobobox / UniSFComboMultiple presents an error in the uniGUI version with extjs 6.5, which occurs when using form.show or showmodal and the user closes the form with the list open, the uniGUI ...

    jQuery.AsyncBox v1.4.5 API.chm

    - 主要模拟常用的 alert、confirm、prompt、open 和扩展了一些对话框。 - 支持静止定位、无限极模态与非模态组合、引用 URL、同域 Iframe 数据互通、位置重设、页面跟随、动态效果、自定义内容、普通拖动、克隆拖动...

    使用EXT实现无刷新动态调用股票信息

    最近开始对ExtJS感兴趣了,今天正好有空,花了点时间,写了个基于Ext的例子。

    5款Ajax 文件上传控件

    SwfUploadPanel是一个结合SwfUpload v2.0.2与ExtJS 2.0.x开发的多文件上传面板(panel)。 3. Yahoo! UI Library: Uploader (演示地址) YUI Uploader Control结合Flash开发的文件上传控件。支持在同一个”Open File”...

    java源码平台-java-platform:此工程不更新了,请移步到最新的工程https://github.com/xiangxik/cas

    open source technology, build the modular extension of Java framework, and can choose to use extjs6, easyUI, bootstrap with the public function of the backstage management. 静态模块化java开发平台 基于...

    Feng Office 2.5

    Feng Office 2.5 更新日志: 错误修正:提交回车键通用搜索表单不会在谷歌Chrome浏览器工作 ...ExtJs、Reece Calendar、Swift Mailer、Open Flash Chart、Slimey、FCKEditor、JSSoundKit、PEAR。

Global site tag (gtag.js) - Google Analytics