提交 858b047e 编写于 作者: U unknown

调整选人组件的回调

上级 27cf4a71
...@@ -447,10 +447,6 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({ ...@@ -447,10 +447,6 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({
if(this.subItems)this.subItems.push( item ); if(this.subItems)this.subItems.push( item );
object[ idSubData.id || idSubData.distinguishedName ] = true; object[ idSubData.id || idSubData.distinguishedName ] = true;
} }
if( !this.selector.options.expandSubEnable ){
this.loaded = true;
if (callback) callback();
}
}.bind(this)); }.bind(this));
}.bind(this)); }.bind(this));
...@@ -463,8 +459,11 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({ ...@@ -463,8 +459,11 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({
} }
}.bind(this)); }.bind(this));
this.loaded = true; this.loaded = true;
if (callback) callback(); if(callback)callback();
}.bind(this), null, this.data.distinguishedName); }.bind(this), null, this.data.distinguishedName);
}else{
this.loaded = true;
if(callback)callback();
} }
}else{ }else{
...@@ -475,10 +474,6 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({ ...@@ -475,10 +474,6 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({
this.selector.items.push(item); this.selector.items.push(item);
if(this.subItems)this.subItems.push( item ); if(this.subItems)this.subItems.push( item );
} }
if( !this.selector.options.expandSubEnable ){
this.loaded = true;
if (callback) callback();
}
}.bind(this)); }.bind(this));
if( this.selector.options.expandSubEnable ){ if( this.selector.options.expandSubEnable ){
...@@ -492,6 +487,9 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({ ...@@ -492,6 +487,9 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({
this.loaded = true; this.loaded = true;
if (callback) callback(); if (callback) callback();
}.bind(this), null, this.data.distinguishedName); }.bind(this), null, this.data.distinguishedName);
}else{
this.loaded = true;
if (callback) callback();
} }
}.bind(this), null, this.data.distinguishedName); }.bind(this), null, this.data.distinguishedName);
} }
...@@ -583,8 +581,8 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({ ...@@ -583,8 +581,8 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({
} }
this.itemLoaded = true; this.itemLoaded = true;
}.bind(this)); }.bind(this));
if (callback) callback();
}.bind(this)); }.bind(this));
if (callback) callback();
}else{ }else{
this.selector.orgAction.listIdentityWithUnit(function(idJson){ this.selector.orgAction.listIdentityWithUnit(function(idJson){
idJson.data.each(function(idSubData){ idJson.data.each(function(idSubData){
...@@ -968,8 +966,22 @@ MWF.xApplication.Selector.Identity.Include = new Class({ ...@@ -968,8 +966,22 @@ MWF.xApplication.Selector.Identity.Include = new Class({
this.itemAreaNode = $(itemAreaNode); this.itemAreaNode = $(itemAreaNode);
this.orgAction = MWF.Actions.get("x_organization_assemble_control"); this.orgAction = MWF.Actions.get("x_organization_assemble_control");
}, },
load : function(){ load : function( callback ){
if( !this.options.include || this.options.include.length === 0 )return; if( !this.options.include || this.options.include.length === 0 ){
this.fireEvent("afterLoad");
if(callback)callback();
return;
}
var count = 0;
var checkCallback = function () {
count++;
if( count === this.options.include.length ){
this.fireEvent("afterLoad");
if(callback)callback();
}
}.bind(this);
this.includeAreaNode = new Element( "div.includeAreaNode").inject( this.itemAreaNode, "top" ); this.includeAreaNode = new Element( "div.includeAreaNode").inject( this.itemAreaNode, "top" );
...@@ -996,34 +1008,41 @@ MWF.xApplication.Selector.Identity.Include = new Class({ ...@@ -996,34 +1008,41 @@ MWF.xApplication.Selector.Identity.Include = new Class({
if( flag === "u" ){ if( flag === "u" ){
this.orgAction.listUnitByKey(function(json){ this.orgAction.listUnitByKey(function(json){
this.loadUnitItem(json, container, null, null, flatCategoryContainer); this.loadUnitItem(json, container, null, null, flatCategoryContainer);
}.bind(this), null, d); checkCallback();
}.bind(this), checkCallback, d);
}else if( flag === "i" ) { }else if( flag === "i" ) {
this.orgAction.listIdentityByKey(function (json) { this.orgAction.listIdentityByKey(function (json) {
this.loadIdentityItem(json, container, null, null, true ) this.loadIdentityItem(json, container, null, null, true );
}.bind(this), null, d); checkCallback();
}.bind(this), checkCallback, d);
}else if( flag === "g" ){ }else if( flag === "g" ){
this.orgAction.listGroupByKey(function(json){ this.orgAction.listGroupByKey(function(json){
this.loadGroupItem( json , container, null, null, flatCategoryContainer) this.loadGroupItem( json , container, null, null, flatCategoryContainer);
}.bind(this), null, d); checkCallback();
}.bind(this), checkCallback, d);
}else if( flag === "p" ){ }else if( flag === "p" ){
if( this.options.resultType === "person" ){ if( this.options.resultType === "person" ){
this.orgAction.getPerson(function (json){ this.orgAction.getPerson(function (json){
this.loadPersonItem( json , container, null, null, true) this.loadPersonItem( json , container, null, null, true);
}.bind(this), null, d); checkCallback();
}.bind(this), checkCallback, d);
}else{ }else{
this.orgAction.listIdentityByPerson(function(json){ this.orgAction.listIdentityByPerson(function(json){
this.loadIdentityItem(json, container , null, null, true) this.loadIdentityItem(json, container , null, null, true);
}.bind(this), null, d); checkCallback();
}.bind(this), checkCallback, d);
} }
}else{ }else{
if( this.options.resultType === "person" ){ if( this.options.resultType === "person" ){
this.orgAction.listPersonByKey(function (json) { this.orgAction.listPersonByKey(function (json) {
this.loadPersonItem( json , container, null, null, true) this.loadPersonItem( json , container, null, null, true);
}.bind(this), null, d); checkCallback();
}.bind(this), checkCallback, d);
}else{ }else{
this.orgAction.listIdentityByKey(function(json){ this.orgAction.listIdentityByKey(function(json){
this.loadIdentityItem(json, container, null, null, true) this.loadIdentityItem(json, container, null, null, true);
}.bind(this), null, d); checkCallback();
}.bind(this), checkCallback, d);
} }
} }
}else{ }else{
...@@ -1032,34 +1051,41 @@ MWF.xApplication.Selector.Identity.Include = new Class({ ...@@ -1032,34 +1051,41 @@ MWF.xApplication.Selector.Identity.Include = new Class({
if( flag === "u" ) { if( flag === "u" ) {
this.orgAction.getUnit(function (json) { this.orgAction.getUnit(function (json) {
this.loadUnitItem(json, container, null, null, flatCategoryContainer); this.loadUnitItem(json, container, null, null, flatCategoryContainer);
}.bind(this), null, d.distinguishedName); checkCallback();
}.bind(this), checkCallback, d.distinguishedName);
}else if( flag === "i" ){ }else if( flag === "i" ){
this.orgAction.getIdentity(function (json) { this.orgAction.getIdentity(function (json) {
this.loadIdentityItem(json, container, null, null, true) this.loadIdentityItem(json, container, null, null, true);
}.bind(this), null, d.distinguishedName); checkCallback();
}.bind(this), checkCallback, d.distinguishedName);
}else if( flag === "g" ){ }else if( flag === "g" ){
this.orgAction.getGroup(function(json){ this.orgAction.getGroup(function(json){
this.loadGroupItem( json , container, null, null, flatCategoryContainer) this.loadGroupItem( json , container, null, null, flatCategoryContainer);
}.bind(this), null, d.distinguishedName, null, null, true); checkCallback();
}.bind(this), checkCallback, d.distinguishedName, null, null, true);
}else if( flag === "p" ){ }else if( flag === "p" ){
if( this.options.resultType === "person" ){ if( this.options.resultType === "person" ){
this.orgAction.getPerson(function (json) { this.orgAction.getPerson(function (json) {
this.loadPersonItem(json, container, null, null, true) this.loadPersonItem(json, container, null, null, true);
}.bind(this), null, d.distinguishedName); checkCallback();
}.bind(this), checkCallback, d.distinguishedName);
}else{ }else{
this.orgAction.listIdentityByPerson(function(json){ this.orgAction.listIdentityByPerson(function(json){
this.loadIdentityItem(json, container, null, null, true) this.loadIdentityItem(json, container, null, null, true);
}.bind(this), null, d.distinguishedName); checkCallback();
}.bind(this), checkCallback, d.distinguishedName);
} }
}else{ }else{
if( this.options.resultType === "person" ){ if( this.options.resultType === "person" ){
this.orgAction.getPerson(function (json) { this.orgAction.getPerson(function (json) {
this.loadPersonItem(json, container, null, null, true) this.loadPersonItem(json, container, null, null, true);
}.bind(this), null, d.distinguishedName); checkCallback();
}.bind(this), checkCallback, d.distinguishedName);
}else{ }else{
this.orgAction.getIdentity(function (json) { this.orgAction.getIdentity(function (json) {
this.loadIdentityItem(json, container, null, null, true) this.loadIdentityItem(json, container, null, null, true);
}.bind(this), null, d.distinguishedName); checkCallback();
}.bind(this), checkCallback, d.distinguishedName);
} }
} }
//var category = this._newItemCategory("ItemCategory", unit, this, this.itemAreaNode); //var category = this._newItemCategory("ItemCategory", unit, this, this.itemAreaNode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册