|
|
@@ -9,22 +9,27 @@ Ext.define('saas.view.main.MainController', {
|
|
|
|
|
|
onNavigationTreeSelectionChange: function (tree, node) {
|
|
|
if (node && node.get('viewType')) {
|
|
|
- this.setActiveTab(node.get('id'), node.get('viewType'), node.get('text'));
|
|
|
+ this.setActiveTab(node.getData());
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- setActiveTab: function(id, type, title) {
|
|
|
+ setActiveTab: function(nodeData) {
|
|
|
var me = this,
|
|
|
refs = me.getReferences(),
|
|
|
mainTab = refs.mainTabPanel,
|
|
|
// existingItem = mainTab.child(type),
|
|
|
+ newView,
|
|
|
+ id = 'tab-' + nodeData.id,
|
|
|
+ title = nodeData.text;
|
|
|
existingItem = mainTab.down('[id=' + id + ']'),
|
|
|
- newView;
|
|
|
-
|
|
|
- lastView = mainTab.getActiveTab();
|
|
|
+ lastView = mainTab.getActiveTab();
|
|
|
|
|
|
if (!existingItem) {
|
|
|
- newView = me.createTab({ type: type, title: title, id: id });
|
|
|
+ newView = Ext.create('saas.view.core.tab.Panel', {
|
|
|
+ id: id,
|
|
|
+ title: title,
|
|
|
+ tabConfig: nodeData
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
if (!newView || !newView.isWindow) {
|
|
|
@@ -51,44 +56,6 @@ Ext.define('saas.view.main.MainController', {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- createTab: function(tabConfig) {
|
|
|
- var me = this,
|
|
|
- type = tabConfig.type;
|
|
|
-
|
|
|
- if(type == 'grid') {
|
|
|
- return me.createGrid(tabConfig);
|
|
|
- }else if(type == 'form') {
|
|
|
- return me.createForm(tabConfig);
|
|
|
- }else {
|
|
|
- var { id, title } = tabConfig;
|
|
|
- return Ext.create('Ext.panel.Panel', {
|
|
|
- id,
|
|
|
- title,
|
|
|
- html: '无效类型'
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- createGrid: function(tabConfig) {
|
|
|
- var me = this;
|
|
|
- var { id, title } = tabConfig;
|
|
|
- var grid = Ext.create('saas.view.core.grid.Panel', {
|
|
|
- id,
|
|
|
- title
|
|
|
- });
|
|
|
- return grid;
|
|
|
- },
|
|
|
-
|
|
|
- createForm: function(tabConfig) {
|
|
|
- var me = this;
|
|
|
- var { id, title } = tabConfig;
|
|
|
- var form = Ext.create('saas.view.core.form.Panel', {
|
|
|
- id,
|
|
|
- title
|
|
|
- });
|
|
|
- return form;
|
|
|
- },
|
|
|
-
|
|
|
onToggleNavigationSize: function () {
|
|
|
var me = this,
|
|
|
refs = me.getReferences(),
|