|
|
@@ -8,25 +8,23 @@ Ext.define('saas.view.main.MainController', {
|
|
|
alias: 'controller.main',
|
|
|
|
|
|
onNavigationTreeSelectionChange: function (tree, node) {
|
|
|
- if (node) {
|
|
|
- this.setActiveTab(node.get('viewType'), node.get('text'));
|
|
|
+ if (node && node.get('viewType')) {
|
|
|
+ this.setActiveTab(node.get('id'), node.get('viewType'), node.get('text'));
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- setActiveTab: function(type, title) {
|
|
|
+ setActiveTab: function(id, type, title) {
|
|
|
var me = this,
|
|
|
refs = me.getReferences(),
|
|
|
mainTab = refs.mainTabPanel,
|
|
|
- existingItem = mainTab.child(type),
|
|
|
+ // existingItem = mainTab.child(type),
|
|
|
+ existingItem = mainTab.down('[id=' + id + ']'),
|
|
|
newView;
|
|
|
|
|
|
lastView = mainTab.getActiveTab();
|
|
|
|
|
|
if (!existingItem) {
|
|
|
- newView = Ext.create({
|
|
|
- xtype: type,
|
|
|
- title: title
|
|
|
- });
|
|
|
+ newView = me.createTab({ type: type, title: title, id: id });
|
|
|
}
|
|
|
|
|
|
if (!newView || !newView.isWindow) {
|
|
|
@@ -53,6 +51,44 @@ 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(),
|