Browse Source

Merge branch 'fix/CMS.add_column_refresh' into 'release'

Merge of fix/[内容管理]修复新增或删除栏目的时候,分类栏没有刷新的问题 to release

See merge request o2oa/o2oa!341
蔡祥熠 5 years ago
parent
commit
f1dc75d76a

+ 43 - 15
o2web/source/x_component_cms_Column/Main.js

@@ -37,9 +37,14 @@ MWF.xApplication.cms.Column.Main = new Class({
             "styles": this.css.container
             "styles": this.css.container
         }).inject(this.content);
         }).inject(this.content);
     },
     },
-    reload: function(){
-        this.columnContentAreaNode.empty();
-        this.createColumnNodes();
+    reload: function(appType, callback){
+        if( appType ){
+            this.reloadTop(appType, callback);
+        }else{
+            this.reloadTop();
+            this.columnContentAreaNode.empty();
+            this.createColumnNodes(callback);
+        }
     },
     },
     loadApplicationContent: function () {
     loadApplicationContent: function () {
         //this.columnAreaNode = new Element("div", {
         //this.columnAreaNode = new Element("div", {
@@ -63,10 +68,19 @@ MWF.xApplication.cms.Column.Main = new Class({
             this.setContentSize();
             this.setContentSize();
         }.bind(this));
         }.bind(this));
     },
     },
-    loadTopNode: function(){
-        this.columnToolbarAreaNode = new Element("div.columnToolbarAreaNode", {
-            "styles": this.css.columnToolbarAreaNode
-        }).inject(this.node);
+    reloadTop : function( appType, callback, noRefreshContent ){
+        this.columnToolbarAreaNode.empty();
+        if( !appType )appType = this.currentAppType;
+        this.currentAppType = null;
+        this.currentAppTypeNode = null;
+        this.loadTopNode( appType, callback, noRefreshContent );
+    },
+    loadTopNode: function( appType, callback, noRefreshContent ){
+        if( !this.columnToolbarAreaNode ){
+            this.columnToolbarAreaNode = new Element("div.columnToolbarAreaNode", {
+                "styles": this.css.columnToolbarAreaNode
+            }).inject(this.node);
+        }
 
 
         this.columnAllTypeNode =  new Element("div.columnTop_All",{
         this.columnAllTypeNode =  new Element("div.columnTop_All",{
             "styles" : this.css.columnTop_All,
             "styles" : this.css.columnTop_All,
@@ -83,6 +97,10 @@ MWF.xApplication.cms.Column.Main = new Class({
                 this.setCurrentAppType( "all", this.columnAllTypeNode );
                 this.setCurrentAppType( "all", this.columnAllTypeNode );
             }.bind(this)
             }.bind(this)
         });
         });
+        if( appType && appType === "all" ){
+            this.setCurrentAppType( "all", this.columnAllTypeNode, callback, noRefreshContent );
+        }
+
 
 
         if (MWF.AC.isCMSManager()) {
         if (MWF.AC.isCMSManager()) {
             this.createColumnNode = new Element("div.createColumnNode", {
             this.createColumnNode = new Element("div.createColumnNode", {
@@ -106,7 +124,7 @@ MWF.xApplication.cms.Column.Main = new Class({
             "styles": this.css.columnTop_category
             "styles": this.css.columnTop_category
         }).inject(this.columnToolbarAreaNode);
         }).inject(this.columnToolbarAreaNode);
 
 
-        this.loadAppType();
+        this.loadAppType( appType, callback, noRefreshContent );
 
 
 
 
         //this.columnToolbarTextNode = new Element("div.columnToolbarTextNode", {
         //this.columnToolbarTextNode = new Element("div.columnToolbarTextNode", {
@@ -114,11 +132,12 @@ MWF.xApplication.cms.Column.Main = new Class({
         //    "text": this.lp.column.title
         //    "text": this.lp.column.title
         //}).inject(this.columnToolbarAreaNode);
         //}).inject(this.columnToolbarAreaNode);
     },
     },
-    loadAppType : function(){
+    loadAppType : function( appType, callback, noRefreshContent ){
         var _self = this;
         var _self = this;
+        debugger;
         this.restActions.listAllAppTypeByManager( function( json ){
         this.restActions.listAllAppTypeByManager( function( json ){
             (json.data || []).each( function( typeObject ){
             (json.data || []).each( function( typeObject ){
-                new Element( "div.columnTop_category", {
+                var cNode = new Element( "div.columnTop_category", {
                     "styles" : this.css.columnTop_categoryItem,
                     "styles" : this.css.columnTop_categoryItem,
                     "text" : typeObject.appType + "(" + typeObject.count + ")",
                     "text" : typeObject.appType + "(" + typeObject.count + ")",
                     "events" : {
                     "events" : {
@@ -133,6 +152,9 @@ MWF.xApplication.cms.Column.Main = new Class({
                         }.bind( typeObject.appType )
                         }.bind( typeObject.appType )
                     }
                     }
                 }).inject( this.columnTypeListContaienr )
                 }).inject( this.columnTypeListContaienr )
+                if( appType && appType === typeObject.appType ){
+                    _self.setCurrentAppType( this, cNode, callback, noRefreshContent );
+                }
             }.bind(this))
             }.bind(this))
             if (this.columnTypeListContaienr.getScrollSize().y>this.columnTypeListContaienr.getSize().y) this.createTypeExpandButton();
             if (this.columnTypeListContaienr.getScrollSize().y>this.columnTypeListContaienr.getSize().y) this.createTypeExpandButton();
         }.bind(this))
         }.bind(this))
@@ -160,7 +182,7 @@ MWF.xApplication.cms.Column.Main = new Class({
         }
         }
         e.stopPropagation();
         e.stopPropagation();
     },
     },
-    setCurrentAppType : function( appType, target ){
+    setCurrentAppType : function( appType, target, callback, noRefreshContent ){
         if( this.currentAppType ){
         if( this.currentAppType ){
             if( this.currentAppType === "all" ){
             if( this.currentAppType === "all" ){
                 this.currentAppTypeNode.setStyles( this.css.columnTop_All );
                 this.currentAppTypeNode.setStyles( this.css.columnTop_All );
@@ -180,7 +202,9 @@ MWF.xApplication.cms.Column.Main = new Class({
         this.currentAppType = appType;
         this.currentAppType = appType;
         this.currentAppTypeNode = target;
         this.currentAppTypeNode = target;
 
 
-        this.createColumnNodes();
+        if(!noRefreshContent){
+            this.createColumnNodes( callback );
+        }
     },
     },
     setContentSize: function(){
     setContentSize: function(){
         var nodeSize = this.node.getSize();
         var nodeSize = this.node.getSize();
@@ -291,15 +315,17 @@ MWF.xApplication.cms.Column.Main = new Class({
     //hasPermision: function (appId) {
     //hasPermision: function (appId) {
     //    return this.isAdmin || this.availableApp.contains(appId);
     //    return this.isAdmin || this.availableApp.contains(appId);
     //},
     //},
-    createColumnNodes: function () {
+    createColumnNodes: function ( callback ) {
         this.columnContentAreaNode.empty();
         this.columnContentAreaNode.empty();
         if( this.currentAppType === "all" ){
         if( this.currentAppType === "all" ){
             this.restActions.listAppByManager(function (json){
             this.restActions.listAppByManager(function (json){
-                this._createColumnNodes( json )
+                this._createColumnNodes( json );
+                if(callback)callback();
             }.bind(this));
             }.bind(this));
         }else{
         }else{
             this.restActions.listWhatICanManageWithAppType(this.currentAppType, function (json){
             this.restActions.listWhatICanManageWithAppType(this.currentAppType, function (json){
-                this._createColumnNodes( json )
+                this._createColumnNodes( json );
+                if(callback)callback();
             }.bind(this))
             }.bind(this))
         }
         }
 
 
@@ -700,6 +726,7 @@ MWF.xApplication.cms.Column.Column = new Class({
     },
     },
     _deleteElement: function (id, success, failure) {
     _deleteElement: function (id, success, failure) {
         this.app.restActions.removeColumn( id || this.data.id, function () {
         this.app.restActions.removeColumn( id || this.data.id, function () {
+            this.app.reloadTop(null, null, true);
             this.destroy();
             this.destroy();
             if (success) success();
             if (success) success();
         }.bind(this), function( error ){
         }.bind(this), function( error ){
@@ -912,6 +939,7 @@ MWF.xApplication.cms.Column.PopupForm = new Class({
                         var column = new MWF.xApplication.cms.Column.Column(this.app, json.data, {"where": "top"});
                         var column = new MWF.xApplication.cms.Column.Column(this.app, json.data, {"where": "top"});
                         column.load();
                         column.load();
                         this.app.columns.push(column);
                         this.app.columns.push(column);
+                        this.app.reloadTop(null, null, true);
                     }else{
                     }else{
                         this.app.reload();
                         this.app.reload();
                     }
                     }

+ 13 - 10
o2web/source/x_component_cms_ColumnManager/CategoryExplorer.js

@@ -2519,18 +2519,21 @@ MWF.xApplication.cms.ColumnManager.CategoryExplorer.CategoryProperty = new Class
             "value" : "",
             "value" : "",
             "text" : this.lp.selectProcessApp
             "text" : this.lp.selectProcessApp
         }).inject( this.processAppSelect );
         }).inject( this.processAppSelect );
-        new Element( "option" , {
-            "value" : "",
-            "text" : this.lp.noProcess
-        }).inject( this.processAppSelect );
         MWF.Actions.get("x_processplatform_assemble_designer").listApplication( null, function( json ){
         MWF.Actions.get("x_processplatform_assemble_designer").listApplication( null, function( json ){
-            json.data.each( function( d ){
-                var opt = new Element( "option" , {
-                    "value" : d.id,
-                    "text" : d.name
+            if( json.data.length === 0 ){
+                new Element( "option" , {
+                    "value" : "",
+                    "text" : this.lp.noProcess
                 }).inject( this.processAppSelect );
                 }).inject( this.processAppSelect );
-                if( d.id == appId )opt.selected = true;
-            }.bind(this))
+            }else{
+                json.data.each( function( d ){
+                    var opt = new Element( "option" , {
+                        "value" : d.id,
+                        "text" : d.name
+                    }).inject( this.processAppSelect );
+                    if( d.id == appId )opt.selected = true;
+                }.bind(this))
+            }
         }.bind(this));
         }.bind(this));
         this.processAppSelect.addEvent( "change" , function( ev ){
         this.processAppSelect.addEvent( "change" , function( ev ){
             var app = this.getSelectProcessApp();
             var app = this.getSelectProcessApp();