Browse Source

导航openTab逻辑优化

zhuth 6 years ago
parent
commit
35e98a0a22

+ 1 - 1
frontend/saas-web/app/util/BaseUtil.js

@@ -24,8 +24,8 @@ Ext.define('saas.util.BaseUtil', {
                 mainTab.setActiveTab(mainTab.add(panel));
                 Ext.resumeLayouts(true);
             } else {
-                panel.viewConfig = config;
                 mainTab.setActiveTab(panel);
+                panel.fireEvent('activate', null, null, null, config);
             }
         },
 

+ 2 - 2
frontend/saas-web/app/view/core/tab/Controller.js

@@ -22,12 +22,12 @@ Ext.define('saas.view.core.tab.Controller', {
         }
     },
 
-    onTabActivate: function() {
+    onTabActivate: function(tab1, tab2, eOptes, config) {
         var component = this.getView();
         var tabView = component.down('container');
 
         if(tabView && typeof tabView.refresh == 'function') {
-            tabView.refresh();
+            tabView.refresh(tabView, config);
         }
 
         if(!component.resetCloseClick) {

+ 14 - 10
frontend/saas-web/app/view/document/kind/Kind.js

@@ -19,7 +19,7 @@ Ext.define('saas.view.document.kind.Kind', {
         reference: 'dataKind',
         value: 'customerkind',
         name : 'segmentedbutton',
-        bind:'{segmented}',
+        bind:'{kindType}',
         items: [{
             name:'customerkind',
             text: '客户',
@@ -121,16 +121,20 @@ Ext.define('saas.view.document.kind.Kind', {
             delUrl: '/api/document/fundinouttype/delete'
         }
     },
-    refresh:function(){
-        var me = this;
-        var grid = me.items.items[0];
-        var button = grid.ownerCt.dockedItems.items[0].down('[name='+grid.ownerCt.ownerCt.viewConfig+']');
-        
-        if(button&&button.xtype!="tbfill"){
-            button.click();
-            me.ownerCt.setTitle(button.typeText);
+    refresh:function(view, config){
+        var me = this,
+        viewModel = me.getViewModel(),
+        kindType,
+        typeText;
+
+        if(config) {
+            kindType = config.kindType;
+            typeText = config.kindText;
+
+            viewModel.set('kindType', kindType);
+            me.ownerCt.setTitle(typeText);
         }
-    }
+    },
 })
 
 

+ 1 - 0
frontend/saas-web/app/view/document/kind/KindModel.js

@@ -5,6 +5,7 @@ Ext.define('saas.view.document.kind.KindModel', {
     extend: 'Ext.app.ViewModel',
     alias: 'viewmodel.document-kind',
     data: {
+        kindType: 'customerkind',
         title: '客户类型'
     },
     stores: {

+ 2 - 2
frontend/saas-web/app/view/main/Navigation.js

@@ -108,11 +108,11 @@ Ext.define('saas.view.main.Navigation', {
                                 '<div class="menu-content">',
                                     '<tpl for="items">',
                                         '<div class="menuitem">',
-                                            '<div data-boundView="{id}" data-recordId="{id}" class="item-text" data-config="{config}" data-id="{id}" data-text="{text}" data-type="query" data-viewType="{viewType}">',
+                                            '<div class="item-text">',
                                                 '{text}',
                                             '</div>',
                                             '<tpl if="this.hasAddType(addType)">',
-                                                '<div class="item-icon" data-id="{id}" data-text="{text}" data-type="form" data-viewType="{addType}">新增</div>',
+                                                '<div class="item-icon">新增</div>',
                                             '</tpl>',
                                         '</div>',
                                     '</tpl>',

+ 16 - 4
frontend/saas-web/resources/json/navigation.json

@@ -310,7 +310,10 @@
         "id": "nav-document-2",
         "text": "辅助资料",
         "items": [{
-            "config":"vendorkind",
+            "config": {
+                "kindType": "vendorkind",
+                "kindText": "供应商类型"
+            },
             "id":"document-kind",
             "text": "供应商类型",
             "viewType": "document-kind",
@@ -321,7 +324,10 @@
             "viewType": "document-address-datalist",
             "leaf": true
         }, {
-            "config":"customerkind",
+            "config": {
+                "kindType": "customerkind",
+                "kindText": "客户类型"
+            },
             "id":"document-kind",
             "text": "客户类型",
             "viewType": "document-kind",
@@ -332,7 +338,10 @@
             "viewType": "document-productunit-datalist",
             "leaf": true
         }, {
-            "config":"productkind",
+            "config": {
+                "kindType": "productkind",
+                "kindText": "物料类型"
+            },
             "id":"document-kind",
             "text": "物料类型",
             "viewType": "document-kind",
@@ -343,7 +352,10 @@
             "viewType": "document-productbrand-datalist",
             "leaf": true
         }, {
-            "config":"inoutkind",
+            "config": {
+                "kindType": "inoutkind",
+                "kindText": "收支类别"
+            },
             "id":"document-kind",
             "text": "收支类别",
             "viewType": "document-kind",