123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- Ext.define('erp.view.common.main.TabPanel',{
- extend: 'Ext.tab.Panel',
- alias: 'widget.erpTabPanel',
- id: 'content-panel',
- region: 'center',
- defaults: {
- autoScroll:true,
- cls: 'my-panel'
- },
- activeTab: 0,
- border: false,
- animScroll:true, //使用动画滚动效果
- layoutOnTabChange : true, //随着布局变化
- resizeTabs:true, // turn on tab resizing
- enableTabScroll : true, //tab标签超宽时自动出现滚动效果
- deferredRender : false,
- items: [{
- xtype: 'panel',
- id: 'HomePage',
- title: $I18N.common.main.homePageTitle,
- bodyPadding: '0 0 2 0',
- iconCls : 'x-tree-icon-tab-main',
- closable: false,
- firstGrid:null,
- html : '<iframe id="iframe_homePage" src="' + basePath + 'jsps/common/desktop.jsp" height="100%" width="100%" frameborder="0" style="border-width: 0px;"></iframe>'
- }] ,
- plain: true,
- plugins:[Ext.create('Ext.ux.TabCloseMenu', {
- closeTabText: $I18N.common.main.closeTabText,
- closeOthersTabsText: $I18N.common.main.closeOtherText,
- closeAllTabsText: $I18N.common.main.closeAllText,
- extraItemsTail: ['-', {
- text: $I18N.common.main.closeable,
- checked: true,
- hideOnClick: true,
- handler: function (item) {
- currentItem.tab.setClosable(item.checked);
- }
- }],
- listeners: {
- aftermenu: function () {
- currentItem = null;
- },
- beforemenu: function (menu, item) {
- var menuitem = menu.child('*[text=' + $I18N.common.main.closeable + ']');
- currentItem = item;
- menuitem.setChecked(item.closable);
- }
- }
- }),
- new Ext.ux.TabScrollerMenu({
- pageSize: 10,
- maxText : 15
- })
- ],
- initComponent : function(){
- this.callParent(arguments);
- },
- listeners: {
- add: function(t, p) {
- t.lastActiveTab = t.activeTab;
- p.on('activate', function(){
- if(p.body) {
- var iframe = p.getEl().down('iframe').dom;
- var win = iframe.contentWindow;
- if(win == null || win.Ext === undefined) {
- return;
- }
- if(contains(iframe.src, 'common/datalist.jsp', false)) {//列表
- var grid = win.Ext.getCmp("grid");
- if(grid){
- grid.lastSelected = grid.selModel.getSelection();//记录当前选中的record
- grid.getColumnsAndStore();
- }
- } else if(contains(iframe.src, 'common/editDatalist.jsp', false)) {//列表
- var grid = win.Ext.getCmp("grid");
- if(grid){
- grid.lastSelected = grid.selModel.getSelection();//记录当前选中的record
- grid.getColumnsAndStore();
- }
- } else if(contains(iframe.src, 'common/batchDeal.jsp', false)) {//批量处理
- var form = win.Ext.getCmp("dealform");
- if(form){
- form.onQuery(true);
- }
- } else if(contains(iframe.src, 'common/query.jsp', false)) {//查询
- var form = win.Ext.getCmp("queryform");
- if(form){
- form.onQuery();
- }
- } else if(contains(iframe.src, 'common/jprocessDeal.jsp', false)) {//流程界面
- var iframe = win.Ext.get('iframe_maindetail');
- if(iframe){
-
- }
- } else {
- var form = win.Ext.getCmp("form");
- if(form) {
- var uu = form.uulistener, //active时刷新Header的uu连接
- tp = t.ownerCt.down('erpHeader');
- if(uu && uu.length > 0) {
- tp.refreshUU(p, form, uu);
- }
- }
- }
- }
- });
- },
- beforeremove: function(t, p) {
- if(p.body) {
- var iframe = p.getEl().down('iframe').dom;
- var win = iframe.contentWindow;
- if(win == null || win.Ext === undefined) {
- return;
- }
- var form = win.Ext.getCmp("form");
- if(form) {
- var uu = form.uulistener, //remove前清除Header的uu连接
- tp = t.ownerCt.down('erpHeader');
- if(uu && uu.length > 0) {
- tp.removeUU(p);
- }
- }
- }
- if (t.lastActiveTab && t.lastActiveTab.id != p.id) {
- Ext.defer(function(){
- t.setActiveTab(t.lastActiveTab);
- }, 100);
- }
- }
- }
- });
|