فهرست منبع

修复selector搜索无下级分类组织时的问题

unknown 5 سال پیش
والد
کامیت
89b63e101b
2فایلهای تغییر یافته به همراه48 افزوده شده و 30 حذف شده
  1. 23 14
      o2web/source/x_component_Selector/Unit.js
  2. 25 16
      o2web/source/x_component_Selector/UnitWithType.js

+ 23 - 14
o2web/source/x_component_Selector/Unit.js

@@ -161,21 +161,30 @@ MWF.xApplication.Selector.Unit = new Class({
     },
 
     _listItemByKey: function(callback, failure, key){
-        if (this.options.units.length){
-            var units = [];
-            this.options.units.each(function(u){
-                if (typeOf(u)==="string"){
-                    units.push(u);
-                }
-                if (typeOf(u)==="object"){
-                    units.push(u.distinguishedName);
-                }
-            });
-            key = {"key": key, "unitList": units};
+        if( this.options.expandSubEnable ){
+            if (this.options.units.length){
+                var units = [];
+                this.options.units.each(function(u){
+                    if (typeOf(u)==="string"){
+                        units.push(u);
+                    }
+                    if (typeOf(u)==="object"){
+                        units.push(u.distinguishedName);
+                    }
+                });
+                key = {"key": key, "unitList": units};
+            }
+            this.orgAction.listUnitByKey(function(json){
+                if (callback) callback.apply(this, [json]);
+            }.bind(this), failure, key);
+        }else{
+            if (key){
+                this.initSearchArea(true);
+                this.searchInItems(key);
+            }else{
+                this.initSearchArea(false);
+            }
         }
-        this.orgAction.listUnitByKey(function(json){
-            if (callback) callback.apply(this, [json]);
-        }.bind(this), failure, key);
     },
     _getItem: function(callback, failure, id, async){
         this.orgAction.getUnit(function(json){

+ 25 - 16
o2web/source/x_component_Selector/UnitWithType.js

@@ -73,23 +73,32 @@ MWF.xApplication.Selector.UnitWithType = new Class({
     },
 
     _listItemByKey: function(callback, failure, key){
-        key = {"key": key};
-        if (this.options.units.length){
-            var units = [];
-            this.options.units.each(function(u){
-                if (typeOf(u)==="string"){
-                    units.push(u);
-                }
-                if (typeOf(u)==="object"){
-                    units.push(u.distinguishedName);
-                }
-            });
-            key.unitList = units;
+        if( this.options.expandSubEnable ){
+            key = {"key": key};
+            if (this.options.units.length){
+                var units = [];
+                this.options.units.each(function(u){
+                    if (typeOf(u)==="string"){
+                        units.push(u);
+                    }
+                    if (typeOf(u)==="object"){
+                        units.push(u.distinguishedName);
+                    }
+                });
+                key.unitList = units;
+            }
+            if (this.options.unitType) key.type = this.options.unitType;
+            this.orgAction.listUnitByKey(function(json){
+                if (callback) callback.apply(this, [json]);
+            }.bind(this), failure, key);
+        }else{
+            if (key){
+                this.initSearchArea(true);
+                this.searchInItems(key);
+            }else{
+                this.initSearchArea(false);
+            }
         }
-        if (this.options.unitType) key.type = this.options.unitType;
-        this.orgAction.listUnitByKey(function(json){
-            if (callback) callback.apply(this, [json]);
-        }.bind(this), failure, key);
     },
     _getItem: function(callback, failure, id, async){
         this.orgAction.getUnit(function(json){