Ext.BLANK_IMAGE_URL = '../../Truck/Scripts/extjs/resources/images/default/s.gif'; var panelEdit = null; Ext.onReady(function() { Ext.QuickTips.init(); Ext.form.Field.prototype.msgTarget = 'side'; //托运单编辑界面 panelEdit = new window.DsTruck.WlBsCardEdit({ title: '托运单信息维护', region: 'center', layout: 'border' }); //按钮面板 var btnPanel = new Ext.Panel({ collapsible: true, region: 'west', width: 100, frame: true, layout: 'accordion', title: '详细信息', margins: '5 0 5 5', split: true, lbar: [ { text: '托单信息', textAlign: 'left', handler: function(button, event) { tabs.setActiveTab(0); } }, '-', { text: '派车单信息', textAlign: 'left', handler: function(button, event) { var refbillno = panelEdit.GetBillNo(); if (refbillno == '*') { //Ext.Msg.alert('提示', "请先保存托单信息!"); Ext.Msg.show({ title: '提示', msg: "请先保存托单信息后,才能编辑派车单信息", icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } tabs.setActiveTab(1); }, scope: this } ] }); //派车单界面 var pcIndex = new window.DsTruck.WlPcIndex({ region: 'center', layout: 'border' }); var pcEdit = new window.DsTruck.WlPcEdit({ region: 'center', layout: 'border' }); var pcTabs = Ext.create('Ext.tab.Panel', { region: 'center', // a center region is ALWAYS required for border layout deferredRender: false, activeTab: 0, // first tab initially active items: [ { title: '查询', layout: 'fit', items: [pcIndex] }, { title: '编辑', layout: 'fit', items: [pcEdit], itemId: 'pcedit' } ] }); pcIndex.TabPanel = pcTabs; pcEdit.ParentPanel = pcIndex; var pcPanel = new Ext.Panel({ title: '派车单信息维护', region: 'center', layout: 'border', items: [pcTabs] }); //主体界面的tab var tabs = Ext.create('Ext.tab.Panel', { region: 'center', // a center region is ALWAYS required for border layout deferredRender: false, activeTab: 0//, // first tab initially active //items: [panelEdit, pcPanel] }); tabs.getTabBar().setVisible(false); var tabMainBs = tabs.add({ layout: 'fit', deferredRender: false, items: [panelEdit] }).show(); var tabMainPc = tabs.add({ layout: 'fit', deferredRender: false, items: [pcPanel] }); tabs.setActiveTab(tabMainBs); var view = new Ext.Viewport({ layout: 'border', renderTo: 'viewport', border: false, items: [ btnPanel, tabs // tabs ] }); var hasQryPc = false; tabs.on('beforetabchange', changehandler, this); function changehandler(tabpanel, newtab, oldtab) { if (newtab == tabMainPc) { if (hasQryPc==false) { var refbillno = panelEdit.GetBillNo(); if (refbillno != '*') { pcIndex.QryDataList(refbillno); } hasQryPc = true; } } } pcTabs.on('beforetabchange', changehandlerPc, this); function changehandlerPc(tabpanel, newtab, oldtab) { if (newtab == tabpanel.child('#pcedit')) { pcEdit.InitData(); } } });