From 332a5cd1552ec4ee4ee63747967a26370ac4b27b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Jul 2020 19:06:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=80=89=E4=BA=BA=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- o2web/source/x_component_Selector/Identity.js | 47 ++++++++----------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/o2web/source/x_component_Selector/Identity.js b/o2web/source/x_component_Selector/Identity.js index 5097ec54ac..48ee74527a 100644 --- a/o2web/source/x_component_Selector/Identity.js +++ b/o2web/source/x_component_Selector/Identity.js @@ -19,6 +19,7 @@ MWF.xApplication.Selector.Identity = new Class({ "selectAllEnable" : true //分类是否允许全选下一层 }, loadSelectItems: function(addToNext){ + var afterLoadSelectItemFun = this.afterLoadSelectItem.bind(this); if( this.options.resultType === "person" ){ if( this.titleTextNode ){ this.titleTextNode.set("text", MWF.xApplication.Selector.LP.selectPerson ); @@ -27,33 +28,24 @@ MWF.xApplication.Selector.Identity = new Class({ } } if(this.options.noUnit){ - this.loadInclude(); + this.loadInclude(afterLoadSelectItemFun); }else if (this.options.units.length){ - // var units = []; - // this.options.units.each(function(u){ - // if (typeOf(u)==="string"){ - // units.push(u); - // }else{ - // units.push(u.distinguishedName) - // } - // }); - // this.org2Action.listUnit({"unitList":units}, function(json){ - // json.data.each(function(d){ - // var category = this._newItemCategory("ItemUnitCategory", d, this, this.itemAreaNode); - // this.subCategorys.push( category ); - // }.bind(this)); - // }.bind(this)); + var unitLoaded = 0; + var loadUnitSuccess = function () { + unitLoaded++; + if( unitLoaded === this.options.units.length ){ + this.loadInclude( afterLoadSelectItemFun ); + } + }.bind(this); + var loadUnitFailure = loadUnitSuccess; this.options.units.each(function(unit){ if (typeOf(unit)==="string"){ - - this.orgAction.getUnit(unit, function(json){ if (json.data){ - var category = this._newItemCategory("ItemUnitCategory", json.data, this, this.itemAreaNode); this.subCategorys.push( category ); } - this.loadInclude(); + loadUnitSuccess(); }.bind(this), function(){ this.orgAction.listUnitByKey(function(json){ if (json.data.length){ @@ -62,8 +54,8 @@ MWF.xApplication.Selector.Identity = new Class({ this.subCategorys.push( category ); }.bind(this)) } - this.loadInclude(); - }.bind(this), null, unit); + loadUnitSuccess(); + }.bind(this), loadUnitFailure, unit); }.bind(this)); }else{ this.orgAction.getUnit(function(json){ @@ -71,8 +63,8 @@ MWF.xApplication.Selector.Identity = new Class({ var category = this._newItemCategory("ItemUnitCategory", json.data, this, this.itemAreaNode); this.subCategorys.push( category ); } - this.loadInclude(); - }.bind(this), null, unit.distinguishedName); + loadUnitSuccess(); + }.bind(this), loadUnitFailure, unit.distinguishedName); //var category = this._newItemCategory("ItemCategory", unit, this, this.itemAreaNode); } @@ -85,17 +77,18 @@ MWF.xApplication.Selector.Identity = new Class({ this.subCategorys.push( category ); } }.bind(this)); - this.loadInclude(); - }.bind(this)); + loadUnitSuccess(); + }.bind(this), loadUnitFailure); } }, - loadInclude: function() { + loadInclude: function(afterLoadFun) { if (!this.includeObject){ this.includeObject = new MWF.xApplication.Selector.Identity.Include(this, this.itemAreaNode, { "include": this.options.include, //增加的可选项 "resultType": this.options.resultType, //可以设置成个人,那么结果返回个人 - "expandSubEnable": this.options.expandSubEnable //是否允许展开下一层 + "expandSubEnable": this.options.expandSubEnable, //是否允许展开下一层 + "onAfterLoad" : afterLoadFun }); } this.includeObject.load(); -- GitLab