unknown 5 жил өмнө
parent
commit
1eba06ecac

+ 4 - 1
o2web/source/x_component_Selector/IdentityWidthDuty.js

@@ -252,7 +252,7 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({
         this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/"+style+"/icon/companyicon.png)");
         this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/"+style+"/icon/companyicon.png)");
     },
     },
     _addSelectedCount : function(){
     _addSelectedCount : function(){
-        this.selectedCountNode.set("text", this._getSelectedCount());
+        this.selectedCountNode.set("text", this._getSelectedCount() || "");
     },
     },
     _getSelectedCount : function(){
     _getSelectedCount : function(){
         var list = this.subItems.filter( function (item) { return item.isSelected; });
         var list = this.subItems.filter( function (item) { return item.isSelected; });
@@ -266,6 +266,9 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({
     },
     },
     loadSub : function(callback){
     loadSub : function(callback){
         this._loadSub( function() {
         this._loadSub( function() {
+            if( this.selector.options.showSelectedCount ){
+                this.selectedCountNode.set("text", this._getSelectedCount() || "" )
+            }
             if( this.selector.options.isCheckStatus ){
             if( this.selector.options.isCheckStatus ){
 
 
             }
             }

+ 34 - 2
o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js

@@ -422,11 +422,38 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemCategory = new Cla
     _getShowName: function(){
     _getShowName: function(){
         return this.data.name;
         return this.data.name;
     },
     },
-    _getSelectedCount : function(){
+    _addSelectedCount : function( count, nested ){
+        debugger;
+        var c;
+        if( typeOf( this.selectedCount ) === "number" ){
+            c = this.selectedCount + count;
+        }else{
+            c = this._getSelectedCount(nested, true);
+        }
+        this.selectedCount = c;
+        this.selectedCountNode.set("text", c || "");
+        if( nested && this.category && this.category._addSelectedCount ){
+            this.category._addSelectedCount(count, nested);
+        }
+    },
+    // _getSelectedCount : function(){
+    //     var list = this.subItems.filter( function (item) { return item.isSelected; });
+    //     return list.length;
+    // },
+    _getSelectedCount : function(nested, cache){
+        debugger;
         if( typeOf( this.selectedCount ) === "number" ){
         if( typeOf( this.selectedCount ) === "number" ){
             return this.selectedCount;
             return this.selectedCount;
         }else{
         }else{
-            return 0
+            var count = 0;
+            if( nested ){
+                this.subCategorys.each( function (category) {
+                    count = count + category._getSelectedCount( nested, cache );
+                });
+            }
+            var list = this.subItems.filter( function (item) { return item.isSelected; });
+            if( cache ) this.selectedCount = count+list.length;
+            return count+list.length;
         }
         }
     },
     },
     _getNestItemCount : function(){
     _getNestItemCount : function(){
@@ -490,6 +517,11 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemCategory = new Cla
             }
             }
 
 
             this.loaded = true;
             this.loaded = true;
+
+            if( this.selector.options.showSelectedCount ){
+                this.selectedCountNode.set("text", this._getSelectedCount( true, true ) || "" )
+            }
+
             if (callback) callback( );
             if (callback) callback( );
         }else{
         }else{
             if (callback) callback( );
             if (callback) callback( );

+ 4 - 7
o2web/source/x_component_Selector/Person.js

@@ -2448,12 +2448,9 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
         this.textNode.setStyle("margin-left", ""+m+"px");
         this.textNode.setStyle("margin-left", ""+m+"px");
 
 
         if( this.selector.options.showSelectedCount && this.selector.selectType == "identity" && this._getSelectedCount ){
         if( this.selector.options.showSelectedCount && this.selector.selectType == "identity" && this._getSelectedCount ){
-            var selectedCount = this._getSelectedCount();
-            if( selectedCount > 0 ){
-                this.selectedCountNode = new Element("span", {
-                    "text": this._getSelectedCount()
-                }).inject(this.textNode);
-            }
+            this.selectedCountNode = new Element("span", {
+                "text": this._getSelectedCount() || ""
+            }).inject(this.textNode);
         }
         }
 
 
         this.children = new Element("div.children", {
         this.children = new Element("div.children", {
@@ -2510,7 +2507,7 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
         debugger;
         debugger;
         var c = ( this._getSelectedCount() || 0 ) + count;
         var c = ( this._getSelectedCount() || 0 ) + count;
         this.selectedCount = c;
         this.selectedCount = c;
-        this.selectedCountNode.set("text", c);
+        this.selectedCountNode.set("text", c || "");
         if( nested && this.category && this.category._addSelectedCount ){
         if( nested && this.category && this.category._addSelectedCount ){
             this.category._addSelectedCount(count, nested);
             this.category._addSelectedCount(count, nested);
         }
         }