提交 383788b4 编写于 作者: U unknown

选择人员的数据

上级 63bb813d
...@@ -252,7 +252,7 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({ ...@@ -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({ ...@@ -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 ){
} }
......
...@@ -422,11 +422,38 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemCategory = new Cla ...@@ -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 ...@@ -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( );
......
...@@ -2448,12 +2448,9 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({ ...@@ -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(); this.selectedCountNode = new Element("span", {
if( selectedCount > 0 ){ "text": this._getSelectedCount() || ""
this.selectedCountNode = new Element("span", { }).inject(this.textNode);
"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({ ...@@ -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);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册