Просмотр исходного кода

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

Merge of fix/【人员选择】修复人员选择双击可能重复加载的问题to wrdp

See merge request o2oa/o2oa!1443

(cherry picked from commit cdb5af1a4cf3ad09fe151570b0ab2764c210a325)

78ac135e 修复人员选择双击分类可能出现重复加载的情况
蔡祥熠 5 лет назад
Родитель
Сommit
6b63d7c128

+ 3 - 1
o2web/source/x_component_Selector/Identity.js

@@ -495,9 +495,11 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({
         }
     },
     clickItem: function( callback ){
-        if (this._hasChild()){
+        if (this._hasChild() && !this.loading){
             var firstLoaded = !this.loaded;
+            this.loading = true;
             this.loadSub(function(){
+                this.loading = false;
                 if( firstLoaded ){
                     if( !this.selector.isFlatCategory ){
                         this.children.setStyles({"display": "block", "height": "auto"});

+ 5 - 5
o2web/source/x_component_Selector/IdentityWidthDuty.js

@@ -193,8 +193,8 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({
         this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/"+style+"/icon/companyicon.png)");
     },
     loadSub: function(callback){
-        if (!this.loaded  && !this.loading){
-            this.loading = true;
+        if (!this.loaded  && !this.loadingsub){
+            this.loadingsub = true;
             if (this.selector.options.units.length){
                 var action = MWF.Actions.get("x_organization_assemble_express");
                 var data = {"name":this.data.name, "unit":""};
@@ -234,7 +234,7 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({
                         if (i>=count){
                             if (!this.loaded) {
                                 this.loaded = true;
-                                this.loading = false;
+                                this.loadingsub = false;
                                 this.itemLoaded = true;
                                 if (callback) callback();
                             }
@@ -259,7 +259,7 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({
                             if (i>=count){
                                 if (!this.loaded) {
                                     this.loaded = true;
-                                    this.loading = false;
+                                    this.loadingsub = false;
                                     this.itemLoaded = true;
                                     if (callback) callback();
                                 }
@@ -279,7 +279,7 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({
                         }
                     }.bind(this));
                     this.loaded = true;
-                    this.loading = false;
+                    this.loadingsub = false;
                     if (callback) callback();
                 }.bind(this), null, this.data.name);
             }

+ 6 - 2
o2web/source/x_component_Selector/Unit.js

@@ -510,7 +510,8 @@ MWF.xApplication.Selector.Unit.Item = new Class({
         }
     },
     loadSubItems: function( callback ){
-        if (!this.loaded){
+        if (!this.loaded && !this.loading){
+            this.loading = true;
             if (!this.children){
                 this.children = new Element("div", {
                     "styles": this.selector.css.selectorItemCategoryChildrenNode
@@ -529,6 +530,7 @@ MWF.xApplication.Selector.Unit.Item = new Class({
                     }
                 }.bind(this));
                 this.loaded = true;
+                this.loading = false;
                 if(callback)callback();
             }.bind(this), null, this.data.distinguishedName);
         }else{
@@ -734,7 +736,8 @@ MWF.xApplication.Selector.Unit.SearchItem = new Class({
     },
     loadSubItems: function( callback ){
         //只是为了在isFlatCategory模式下,加载全称用的,否则用继承的就可以
-        if (!this.loaded){
+        if (!this.loaded && !this.loading){
+            this.loading = true;
             if (!this.children){
                 this.children = new Element("div", {
                     "styles": this.selector.css.selectorItemCategoryChildrenNode
@@ -760,6 +763,7 @@ MWF.xApplication.Selector.Unit.SearchItem = new Class({
                     }
                 }.bind(this));
                 this.loaded = true;
+                this.loading = false;
                 if(callback)callback();
             }.bind(this), null, this.data.distinguishedName);
         }else{

+ 3 - 1
o2web/source/x_component_Selector/UnitWithType.js

@@ -183,7 +183,8 @@ MWF.xApplication.Selector.UnitWithType.Item = new Class({
         }
     },
     loadSubItems: function(callback){
-        if (!this.loaded){
+        if (!this.loaded && !this.loading){
+            this.loading = true;
             if (!this.children){
                 this.children = new Element("div", {
                     "styles": this.selector.css.selectorItemCategoryChildrenNode
@@ -207,6 +208,7 @@ MWF.xApplication.Selector.UnitWithType.Item = new Class({
                 if(callback)callback()
             }.bind(this));
             this.loaded = true;
+            this.loading = false;
         }else{
             this.children.setStyle("display", "block");
         }