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

Merge branch 'feature/Selector.add_after_selectItem' into 'wrdp'

Merge of feature/Selector.add_after_selectItem 人员选择增加afterSelectSingleItem事件 to wrdp

See merge request o2oa/o2oa!2538
蔡祥熠 5 лет назад
Родитель
Сommit
fee5e883b3

+ 4 - 0
o2web/source/x_component_Selector/Identity.js

@@ -1637,6 +1637,8 @@ MWF.xApplication.Selector.Identity.Include = new Class({
                 this.selector.items.push(item);
                 if( category && category.subItems ){
                     category.subItems.push( item );
+                }else if(this.selector.subItems){
+                    this.selector.subItems.push( item )
                 }
             }
         }.bind(this));
@@ -1657,6 +1659,8 @@ MWF.xApplication.Selector.Identity.Include = new Class({
                 this.selector.items.push(item);
                 if( category && category.subItems ){
                     category.subItems.push( item );
+                }else if(this.selector.subItems){
+                    this.selector.subItems.push( item )
                 }
             }
         }.bind(this));

+ 7 - 0
o2web/source/x_component_Selector/Person.js

@@ -1457,15 +1457,19 @@ MWF.xApplication.Selector.Person = new Class({
         }
     },
     _selectSingleItem : function(){
+        var _self = this;
         var checkItem = function () {
             if(this.items.length === 1 || this.subItems.length === 1 ){
                 if( this.items.length === 1 && this.subItems.length === 0 ){
                     if( !this.items[0].isSelected )this.items[0].clickItem();
+                    this.fireEvent("afterSelectSingleItem",[this, this.items[0]])
                 }else if( this.items.length === 0 && this.subItems.length === 1 ){
                     if( !this.items[0].isSelected )this.subItems[0].clickItem();
+                    this.fireEvent("afterSelectSingleItem",[this, this.items[0]])
                 }else if( this.items.length === 1 && this.subItems.length === 1 ){
                     if( this.items[0] === this.subItems[0] ){
                         if( !this.items[0].isSelected )this.items[0].clickItem();
+                        this.fireEvent("afterSelectSingleItem",[this, this.items[0]])
                     }
                 }
             }
@@ -1475,11 +1479,13 @@ MWF.xApplication.Selector.Person = new Class({
             if( !category.subCategorys || category.subCategorys.length === 0 ){
                 if( category.subItems && category.subItems.length === 1 ){
                     if( !category.subItems[0].isSelected )category.subItems[0].clickItem();
+                    _self.fireEvent("afterSelectSingleItem",[_self, category.subItems[0]])
                 }
             }else if(category.subCategorys.length === 1){
                 if( category.subItems && category.subItems.length > 0 ){
                 }else if( !category.subCategorys[0]._hasChild || !category.subCategorys[0]._hasChild() ){ //category.subCategorys[0].isItem &&
                     if( !category.subItems[0].isSelected )category.subItems[0].clickItem();
+                    _self.fireEvent("afterSelectSingleItem",[_self, category.subItems[0]])
                 }else{
                     checkCategory( category.subCategorys[0] )
                 }
@@ -1498,6 +1504,7 @@ MWF.xApplication.Selector.Person = new Class({
                 if( list.length === 0 ){
                     if( category.subItems && category.subItems.length === 1 ){
                         if( !category.subItems[0].isSelected )category.subItems[0].clickItem();
+                        _self.fireEvent("afterSelectSingleItem",[_self, category.subItems[0]])
                     }
                 }
             }