Prechádzať zdrojové kódy

Merge branch 'fix/Selector.indetity_execption' into 'wrdp'

Merge of fix/Selector.indetity_execption 选择身份可能重复加载的问题 to wrdp

See merge request o2oa/o2oa!2380
蔡祥熠 5 rokov pred
rodič
commit
bb985e10a0

+ 19 - 11
o2web/source/x_component_Selector/Identity.js

@@ -968,16 +968,8 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({
             //     }
             // }else{
 
-                this.selector.orgAction.listIdentityWithUnit(function(idJson){
-                    idJson.data.each(function(idSubData){
-                        if( !this.selector.isExcluded( idSubData ) ) {
-                            var item = this.selector._newItem(idSubData, this.selector, this.children, this.level + 1, this);
-                            this.selector.items.push(item);
-                            if(this.subItems)this.subItems.push( item );
-                        }
-                    }.bind(this));
-
-                    if( this.selector.options.expandSubEnable ){
+                var loadSubUnit = function () {
+                    if( this.selector.options.expandSubEnable && !this.categoryLoaded ){
                         this.selector.orgAction.listSubUnitDirect(function(json){
                             json.data.each(function(subData){
                                 if( !this.selector.isExcluded( subData ) ) {
@@ -992,7 +984,23 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({
                         this.loaded = true;
                         if (callback) callback( true );
                     }
-                }.bind(this), null, this.data.distinguishedName);
+                }.bind(this);
+
+                if( !this.itemLoaded ){
+                    this.selector.orgAction.listIdentityWithUnit(function(idJson){
+                        idJson.data.each(function(idSubData){
+                            if( !this.selector.isExcluded( idSubData ) ) {
+                                var item = this.selector._newItem(idSubData, this.selector, this.children, this.level + 1, this);
+                                this.selector.items.push(item);
+                                if(this.subItems)this.subItems.push( item );
+                            }
+                        }.bind(this));
+                        loadSubUnit();
+                    }.bind(this), null, this.data.distinguishedName);
+                }else{
+                    loadSubUnit();
+                }
+
             // }
         }else{
             if (callback) callback( );

+ 16 - 13
o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js

@@ -568,19 +568,22 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemCategory = new Cla
                 this.itemLoaded = true;
             }
 
-            if (this.data.unitList && this.data.unitList.length) {
-                this.data.unitList.sort(function (a, b) {
-                    if( a.orderNumber === 0 )a.orderNumber = -1;
-                    if( b.orderNumber === 0 )b.orderNumber = -1;
-                    return (a.orderNumber || 9999999) - (b.orderNumber || 9999999);
-                });
-                this.data.unitList.each(function (subData) {
-                    // if( !this.selector.isExcluded( subData ) ) {
-                    var category = this.selector._newItemCategory("ItemCategory", subData, this.selector, this.children, this.level + 1, this);
-                    this.subCategorys.push(category);
-                    category.loadSub()
-                    // }
-                }.bind(this));
+            if( !this.categoryLoaded ){
+                if (this.data.unitList && this.data.unitList.length) {
+                    this.data.unitList.sort(function (a, b) {
+                        if( a.orderNumber === 0 )a.orderNumber = -1;
+                        if( b.orderNumber === 0 )b.orderNumber = -1;
+                        return (a.orderNumber || 9999999) - (b.orderNumber || 9999999);
+                    });
+                    this.data.unitList.each(function (subData) {
+                        // if( !this.selector.isExcluded( subData ) ) {
+                        var category = this.selector._newItemCategory("ItemCategory", subData, this.selector, this.children, this.level + 1, this);
+                        this.subCategorys.push(category);
+                        category.loadSub()
+                        // }
+                    }.bind(this));
+                }
+                this.categoryLoaded = true;
             }
 
             this.loaded = true;