|
|
@@ -9,27 +9,23 @@ Ext.define('saas.view.main.MainController', {
|
|
|
|
|
|
onNavigationTreeSelectionChange: function (tree, node) {
|
|
|
if (node && node.get('viewType')) {
|
|
|
- this.setActiveTab(node.getData());
|
|
|
+ this.setActiveTab(node.get('id'), node.get('viewType'), node.get('text'));
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- setActiveTab: function(nodeData) {
|
|
|
+ setActiveTab: function(id, type, title) {
|
|
|
+ debugger
|
|
|
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 + ']'),
|
|
|
- lastView = mainTab.getActiveTab();
|
|
|
+ newView;
|
|
|
+
|
|
|
+ lastView = mainTab.getActiveTab();
|
|
|
|
|
|
if (!existingItem) {
|
|
|
- newView = Ext.create('saas.view.core.tab.Panel', {
|
|
|
- id: id,
|
|
|
- title: title,
|
|
|
- tabConfig: nodeData
|
|
|
- });
|
|
|
+ newView = me.createTab({ type: type, title: title, id: id });
|
|
|
}
|
|
|
|
|
|
if (!newView || !newView.isWindow) {
|
|
|
@@ -56,6 +52,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.purchase.list.GridPanel', {
|
|
|
+ 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(),
|