Extjs 通用框架

<%@ page language="java" import="java.util.*, com.sxdf.rent.beans.*, java.sql.*" pageEncoding="UTF-8" %>

<%
User u = (User)session.getAttribute("user");

String items = "";

if(u.getRole().getId() == 1) {
    items = " item1, item2, item3";
    //items = " item1, item2, item3, item4, item5, item6, item7 ";
} else if(u.getRole().getId() == 2 ) {
    items = " item1, item5, item8 ";
} else if(u.getRole().getId() == 3 ) {
    items = " item1, item5, item8 ";
} else if(u.getRole().getId() == 4 ) {
    items = " item1, item3, item4, item5, item6, item7, item9 ";
} else if(u.getRole().getId() == 5 ) {
    items = " item1, item5, item7, item9  ";
} else if(u.getRole().getId() == 6 ) {
    items = " item1, item7 ";
}

%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>租赁系统</title>
        <link rel="stylesheet" type="text/css"
            href="ext/resources/css/ext-all.css" />
        <!-- GC -->
        <!-- LIBS -->
        <script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
        <!-- ENDLIBS -->
        <script type="text/javascript" src="ext/ext-all.js"></script>

        <script type="text/javascript" src="ext/ext-lang-zh_CN.js"></script>
        <style type="text/css">
html,body {
    font: normal 12px verdana;
    margin: 0;
    padding: 0;
    border: 0 none;
    overflow: hidden;
    height: 100%;
}

.empty .x-panel-body {
    padding-top: 0;
    text-align: center;
    font-style: italic;
    color: gray;
    font-size: 11px;
}

.x-btn button {
    font-size: 14px;
}

.x-panel-header {
    font-size: 14px;
}


.bgimage {
   background:url(/images/main.jpg ) no-repeat right bottom;
   position:absolute;
}
</style>
<script type="text/javascript">

    
    Ext.onReady( function() {
        //Ext.Msg.alert('ext','welcome you!');
        var addPanel = function(btn, event) {
            var n;
            n = tabPanel.getComponent(btn.id);
            var jsp = btn.id + ".jsp";
            
            //如果点击的是当前已经打开过的页面  那么活跃该页面
            if(n) {
                //仅针对页面需要需要重新刷新的情况
                tabPanel.remove(n);
               
                //针对页面不需要重新刷新的情况
                //tabPanel.setActiveTab(n);
                //return;
                
            }
            //如果不是该页面,就打开该页面
            n = tabPanel.add( {
                id : btn.id,
                title : btn.text,
                html : '<iframe width=100% height=100% src=' + jsp + ' />',
                
                //autoLoad : 'true',
                closable : 'true'
            });
            tabPanel.setActiveTab(n);
        };
        
        var item8 = new Ext.Panel( {
            id : '',
            title : '库房管理',
            //html : '&lt;empty panel&gt;',
            cls : 'empty',
            items : [
                new Ext.Button({
                    id : 'clinvio/inRent',
                    text : '设备入库',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),

                new Ext.Button({
                    id : 'clinvio/outReturn',
                    text : '归还出库',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'clinvio/outAllot',
                    text : '调拨出库',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'clinvio/outLost',
                    text : '丢失出库',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'showRent',
                    text : '在租设备',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                })
                ]
        });
        

        var item1 = new Ext.Panel( {
            id : 'items/item1',
            title : '个人管理',
            //html : '&lt;empty panel&gt;',
            cls : 'empty',
            items : [
                new Ext.Button({
                    id : 'userInfo',
                    text : '个人资料',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),

                new Ext.Button({
                    id : 'changeInfo',
                    text : '修改资料',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'changePassword',
                    text : '修改密码',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                })
                ]
        });

        var item2 = new Ext.Panel( {
            title : '用户管理',
            //html : '&lt;empty panel&gt;',
            cls : 'empty',
            items : [
                new Ext.Button({
                    id : 'allUsers',
                    text : '所有用户',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),

                new Ext.Button({
                    id : 'addUser',
                    text : '添加用户',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                })
                ]
        });
        
        var item3 = new Ext.Panel( {
            title : '项目管理',
            //html : '&lt;empty panel&gt;',
            cls : 'empty',
            items : [
                new Ext.Button({
                    id : 'allProject',
                    text : '所有项目',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }
                }),

                new Ext.Button({
                    id : 'addProject',
                    text : '添加项目',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }
                })
                ]
        });
        
        var item4 = new Ext.Panel( {
            title : '设备管理',
            //html : '&lt;empty panel&gt;',
            cls : 'empty',
            items : [
                new Ext.Button({
                    id : 'allDevices',
                    text : '所有设备',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'allType',
                    text : '设备类型',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'addDevice',
                    text : '添加设备',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                })
                ]
        });

        var item5 = new Ext.Panel( {
            title : '申请管理',
            //html : '&lt;empty panel&gt;',
            cls : 'empty',
            items : [
                new Ext.Button({
                    id : 'myApply',
                    text : '我的申请',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),

                new Ext.Button({
                    id : 'myVerdifyApply',
                    text : '我审批过的申请',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'myApplyQuery',
                    text : '待审批申请',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),

                new Ext.Button({
                    id : 'addApply',
                    text : '租用设备',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'addAllot',
                    text : '调拨设备',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                })
                
                ,new Ext.Button({
                id : 'stopApply',
                text : '报停设备',
                width : '100%',
                listeners : {
                    click : addPanel
                }
                })
                ]
        });
        
        var item6 = new Ext.Panel( {
            title : '库房管理',
            //html : '&lt;empty panel&gt;',
            cls : 'empty',
            items : [
                
                new Ext.Button({
                    id : 'invio/inNew',
                    text : '新品入库',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'invio/inReturn',
                    text : '归还入库',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),

                new Ext.Button({
                    id : 'invio/inMaintain',
                    text : '维修入库',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'invio/outRent',
                    text : '租赁出库',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'invio/outMaintain',
                    text : '维修出库',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),

                new Ext.Button({
                    id : 'invio/outScrap',
                    text : '报废出库',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                })
                ]
        });

        var item7 = new Ext.Panel( {
            id : 'items/item7',
            title : '查询模块',
            //html : '&lt;empty panel&gt;',
            cls : 'empty',
            listeners : {
                click : addPanel
            },
            items : [
                
                new Ext.Button({
                    id : 'recordQuery',
                    text : '租赁查询',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'accountQuery',
                    text : '台帐查询',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),

                new Ext.Button({
                    id : 'stopQuery',
                    text : '报停查询',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'invioQuery',
                    text : '出入库查询',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'periodQuery',
                    text : '期间费用查询',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                })
                ]
        });
        
        var item9 = new Ext.Panel( {
            id : 'items/item9',
            title : '系统功能',
            //html : '&lt;empty panel&gt;',
            cls : 'empty',
            listeners : {
                click : addPanel
            },
            items : [
                
                new Ext.Button({
                    id : 'export',
                    text : '资料导出',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                }),
                
                new Ext.Button({
                    id : 'invio/applyPrint',
                    text : '单据打印',
                    width : '100%',
                    listeners : {
                        click : addPanel
                    }

                })
                ]
        });
        
        var top = new Ext.Panel({
            region : 'north',
            margins : '5 0 5 5',
            //split : true,
            width : 210,
            height : 90,
            layout : 'accordion',
           // autoLoad : { url : 'top.jsp'},
            html : '<iframe src="top.jsp" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>'
                
            //autoLoad : '<iframe width=100% height=100% src=top.jsp />'
            
        });

        var left = new Ext.Panel( {
            region : 'west',
            margins : '5 0 5 5',
            split : true,
            width : 210,
            layout : 'accordion',
        
            items : [ <%= items %> ]
        });

        var tabPanel = new Ext.TabPanel( {
            id : 'tabP',
            region : 'center',
            enableTabScroll : true,
            deferredRender : false,
            activeTab : 0,
            animScroll : true,
            bodyCls: 'bgimage',
            items : [ {

                title : 'welcome',

                html: '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="welcome.jsp"> </iframe>',
                //autoLoad : 'welcome.jsp',
                closable : 'true'
            } ]
        });
        
        

        var viewport = new Ext.Viewport( {
            layout : 'border',
            bodyCls: 'bgimage',
            items : [ left, tabPanel, top ]
        });
    });
</script>
    </head>
    <body>
        
        <!-- EXAMPLES -->
    </body>
</html>

posted on 2012-11-10 15:49  hzm_frank  阅读(280)  评论(0编辑  收藏  举报

导航