Browse Source

修复选择身份、按职务列式身份的时候分类顺序不是传入顺序的问题

unknown 5 years ago
parent
commit
67a34de7dd

+ 14 - 10
o2web/source/x_component_Selector/Identity.js

@@ -1,7 +1,7 @@
 MWF.xApplication.Selector = MWF.xApplication.Selector || {};
 MWF.xApplication.Selector = MWF.xApplication.Selector || {};
 MWF.xDesktop.requireApp("Selector", "Person", null, false);
 MWF.xDesktop.requireApp("Selector", "Person", null, false);
 MWF.xApplication.Selector.Identity = new Class({
 MWF.xApplication.Selector.Identity = new Class({
-	Extends: MWF.xApplication.Selector.Person,
+    Extends: MWF.xApplication.Selector.Person,
     options: {
     options: {
         "style": "default",
         "style": "default",
         "count": 0,
         "count": 0,
@@ -19,9 +19,9 @@ MWF.xApplication.Selector.Identity = new Class({
         "selectAllEnable" : true //分类是否允许全选下一层
         "selectAllEnable" : true //分类是否允许全选下一层
     },
     },
     loadSelectItems: function(addToNext){
     loadSelectItems: function(addToNext){
-	    debugger;
+        debugger;
 
 
-	    var afterLoadSelectItemFun = this.afterLoadSelectItem.bind(this);
+        var afterLoadSelectItemFun = this.afterLoadSelectItem.bind(this);
         if( this.options.resultType === "person" ){
         if( this.options.resultType === "person" ){
             if( this.titleTextNode ){
             if( this.titleTextNode ){
                 this.titleTextNode.set("text", MWF.xApplication.Selector.LP.selectPerson );
                 this.titleTextNode.set("text", MWF.xApplication.Selector.LP.selectPerson );
@@ -52,11 +52,15 @@ MWF.xApplication.Selector.Identity = new Class({
                 }
                 }
             }.bind(this));
             }.bind(this));
 
 
+
             this.options.units.each(function(unit){
             this.options.units.each(function(unit){
+
+                var container = new Element("div").inject( this.itemAreaNode );
+
                 if (typeOf(unit)==="string"){
                 if (typeOf(unit)==="string"){
                     this.orgAction.getUnit(unit, function(json){
                     this.orgAction.getUnit(unit, function(json){
                         if (json.data){
                         if (json.data){
-                            var category = this._newItemCategory("ItemUnitCategory", json.data, this, this.itemAreaNode);
+                            var category = this._newItemCategory("ItemUnitCategory", json.data, this, container);
                             this.subCategorys.push( category );
                             this.subCategorys.push( category );
                         }
                         }
                         loadUnitSuccess();
                         loadUnitSuccess();
@@ -64,7 +68,7 @@ MWF.xApplication.Selector.Identity = new Class({
                         this.orgAction.listUnitByKey(function(json){
                         this.orgAction.listUnitByKey(function(json){
                             if (json.data.length){
                             if (json.data.length){
                                 json.data.each(function(data){
                                 json.data.each(function(data){
-                                    var category = this._newItemCategory("ItemUnitCategory", data, this, this.itemAreaNode);
+                                    var category = this._newItemCategory("ItemUnitCategory", data, this, container);
                                     this.subCategorys.push( category );
                                     this.subCategorys.push( category );
                                 }.bind(this))
                                 }.bind(this))
                             }
                             }
@@ -74,7 +78,7 @@ MWF.xApplication.Selector.Identity = new Class({
                 }else{
                 }else{
                     this.orgAction.getUnit(function(json){
                     this.orgAction.getUnit(function(json){
                         if (json.data){
                         if (json.data){
-                            var category = this._newItemCategory("ItemUnitCategory", json.data, this, this.itemAreaNode);
+                            var category = this._newItemCategory("ItemUnitCategory", json.data, this, container);
                             this.subCategorys.push( category );
                             this.subCategorys.push( category );
                         }
                         }
                         loadUnitSuccess();
                         loadUnitSuccess();
@@ -101,7 +105,7 @@ MWF.xApplication.Selector.Identity = new Class({
 
 
                 // this.unitLoaded = true;
                 // this.unitLoaded = true;
                 // if( this.includeLoaded ){
                 // if( this.includeLoaded ){
-                    afterLoadSelectItemFun();
+                afterLoadSelectItemFun();
                 // }
                 // }
 
 
             }.bind(this));
             }.bind(this));
@@ -238,7 +242,7 @@ MWF.xApplication.Selector.Identity = new Class({
 
 
 
 
 MWF.xApplication.Selector.Identity.Item = new Class({
 MWF.xApplication.Selector.Identity.Item = new Class({
-	Extends: MWF.xApplication.Selector.Person.Item,
+    Extends: MWF.xApplication.Selector.Person.Item,
     _getShowName: function(){
     _getShowName: function(){
         return this.data.name;
         return this.data.name;
     },
     },
@@ -325,7 +329,7 @@ MWF.xApplication.Selector.Identity.SearchItem = new Class({
 });
 });
 
 
 MWF.xApplication.Selector.Identity.ItemSelected = new Class({
 MWF.xApplication.Selector.Identity.ItemSelected = new Class({
-	Extends: MWF.xApplication.Selector.Person.ItemSelected,
+    Extends: MWF.xApplication.Selector.Person.ItemSelected,
     getData: function(callback){
     getData: function(callback){
         if( this.selector.options.resultType === "person" ){
         if( this.selector.options.resultType === "person" ){
             var isPerson = false;
             var isPerson = false;
@@ -893,7 +897,7 @@ MWF.xApplication.Selector.Identity.ItemGroupCategory = new Class({
                     //根据身份id批量获取身份对象
                     //根据身份id批量获取身份对象
                     o2.Actions.load("x_organization_assemble_express").IdentityAction.listObject({
                     o2.Actions.load("x_organization_assemble_express").IdentityAction.listObject({
                         identityList : this.data.identityList
                         identityList : this.data.identityList
-                }, function (json) {
+                    }, function (json) {
                         this.selector.includeObject.loadIdentityItem( json, identityContainer, this.level + 1, this);
                         this.selector.includeObject.loadIdentityItem( json, identityContainer, this.level + 1, this);
                         checkCallback("identity", this.data.identityList.length )
                         checkCallback("identity", this.data.identityList.length )
                     }.bind(this), function () {
                     }.bind(this), function () {

+ 15 - 5
o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js

@@ -1,7 +1,7 @@
 MWF.xApplication.Selector = MWF.xApplication.Selector || {};
 MWF.xApplication.Selector = MWF.xApplication.Selector || {};
 MWF.xDesktop.requireApp("Selector", "IdentityWidthDuty", null, false);
 MWF.xDesktop.requireApp("Selector", "IdentityWidthDuty", null, false);
 MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({
 MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({
-	Extends: MWF.xApplication.Selector.IdentityWidthDuty,
+    Extends: MWF.xApplication.Selector.IdentityWidthDuty,
     options: {
     options: {
         "style": "default",
         "style": "default",
         "count": 0,
         "count": 0,
@@ -92,6 +92,11 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({
         //this.listAllIdentityInUnitObject( identityList );
         //this.listAllIdentityInUnitObject( identityList );
         var unitTree = this.listNestedUnitByIdentity( identityList );
         var unitTree = this.listNestedUnitByIdentity( identityList );
         if( this.options.dutyUnitLevelBy === "duty" ){
         if( this.options.dutyUnitLevelBy === "duty" ){
+            this.level1Container = [];
+            if( this.options.units && this.options.units.length ){
+                var div = new Element( "div" ).inject(this.itemAreaNode);
+                this.level1Container.push(div);
+            }
             this._loadSelectItemsByDutyUnit(unitTree);
             this._loadSelectItemsByDutyUnit(unitTree);
         }else{
         }else{
             this._loadSelectItemsByIdentityUnit(unitTree);
             this._loadSelectItemsByIdentityUnit(unitTree);
@@ -136,12 +141,17 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({
     },
     },
     _loadSelectItemsByDutyUnit : function( unitTree ){
     _loadSelectItemsByDutyUnit : function( unitTree ){
         if( !unitTree.unitList )return;
         if( !unitTree.unitList )return;
-        this.sortUnit( unitTree.unitList );
+        // this.sortUnit( unitTree.unitList );
         for( var i=0; i< unitTree.unitList.length; i++ ){
         for( var i=0; i< unitTree.unitList.length; i++ ){
             var unit = unitTree.unitList[i];
             var unit = unitTree.unitList[i];
             if( this.isUnitContain( unit ) ){
             if( this.isUnitContain( unit ) ){
                 if( !this.isExcluded( unit ) ) {
                 if( !this.isExcluded( unit ) ) {
-                    var category = this._newItemCategory("ItemCategory",unit, this, this.itemAreaNode);
+                    var container = this.itemAreaNode;
+                    if( this.level1Container && this.level1Container.length ){
+                        var index = this.getIndexFromUnitOption( unit );
+                        if( index > -1 && (this.level1Container.length > index) && this.level1Container[i] )container = this.level1Container[i];
+                    }
+                    var category = this._newItemCategory("ItemCategory",unit, this, container );
                     this.subCategorys.push(category);
                     this.subCategorys.push(category);
                 }
                 }
             }else{
             }else{
@@ -333,14 +343,14 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({
     //}
     //}
 });
 });
 MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.Item = new Class({
 MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.Item = new Class({
-	Extends: MWF.xApplication.Selector.IdentityWidthDuty.Item
+    Extends: MWF.xApplication.Selector.IdentityWidthDuty.Item
 });
 });
 MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.SearchItem = new Class({
 MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.SearchItem = new Class({
     Extends: MWF.xApplication.Selector.IdentityWidthDuty.SearchItem
     Extends: MWF.xApplication.Selector.IdentityWidthDuty.SearchItem
 });
 });
 
 
 MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemSelected = new Class({
 MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemSelected = new Class({
-	Extends: MWF.xApplication.Selector.IdentityWidthDuty.ItemSelected
+    Extends: MWF.xApplication.Selector.IdentityWidthDuty.ItemSelected
 });
 });
 
 
 MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemCategory = new Class({
 MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemCategory = new Class({