MWF.xApplication.Selector = MWF.xApplication.Selector || {}; MWF.xDesktop.requireApp("Selector", "IdentityWidthDuty", null, false); MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({ Extends: MWF.xApplication.Selector.IdentityWidthDuty, options: { "style": "default", "count": 0, "title": MWF.xApplication.Selector.LP.selectIdentity, "dutys": [], "units": [], "values": [], "zIndex": 1000, "expand": false, "noUnit" : false, "include" : [], //增加的可选项 "resultType" : "", //可以设置成个人,那么结果返回个人 "expandSubEnable": true, "selectAllEnable" : true, //分类是否允许全选下一层 "exclude" : [], "dutyUnitLevelBy" : "duty" //组织层级是按身份所在群组还是职务 }, loadSelectItems: function(addToNext){ //根据组织分类展现职务 if( this.options.resultType === "person" ){ if( this.titleTextNode ){ this.titleTextNode.set("text", MWF.xApplication.Selector.LP.selectPerson ); }else{ this.options.title = MWF.xApplication.Selector.LP.selectPerson; } } if (this.options.dutys.length){ this.loadInclude(); if( this.options.units.length ){ var units = []; for( var i=0 ;i0 ){ debugger; this.data.identityList.sort( function(a, b){ //this.selector.getUnitOrderNumber( a.unitLevelName ) return (a.orderNumber || 9999999) - (b.orderNumber || 9999999); }); this.data.identityList.each( function( identity ){ if( !this.selector.isExcluded( identity ) ) { if( !this.isExisted( identity ) ){ var item = this.selector._newItem(identity, this.selector, this.children, this.level + 1, this); this.selector.items.push(item); if(this.subItems)this.subItems.push( item ); } } }.bind(this)) } if( this.data.unitList && this.data.unitList.length ){ this.data.unitList.sort( function(a, b){ 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.loaded = true; if (callback) callback( ); }else{ if (callback) callback( ); } }, loadCategoryChildren: function(callback){ if (!this.categoryLoaded){ //if( this.data.unitList && this.data.unitList.length ){ // this.data.unitList.sort( function(a, b){ // 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.loadCategoryChildren() // } // }.bind(this)); //} this.loadSub(); this.categoryLoaded = true; this.itemLoaded = true; if (callback) callback( ); }else{ if (callback) callback( ); } }, loadItemChildren: function(callback){ if (!this.itemLoaded){ if( this.data.identityList && this.data.identityList.length>0 ){ this.data.identityList.sort( function(a, b){ //this.selector.getUnitOrderNumber( a.unitLevelName ) return (a.orderNumber || 9999999) - (b.orderNumber || 9999999); }); this.data.identityList.each( function( identity ){ if( !this.selector.isExcluded( identity ) ) { if( !this.isExisted( identity ) ){ var item = this.selector._newItem(identity, this.selector, this.children, this.level + 1, this); this.selector.items.push(item); if(this.subItems)this.subItems.push( item ); } } }.bind(this)) } this.itemLoaded = true; if (callback) callback( ); }else{ if (callback) callback( ); } }, _hasChild: function(){ return (this.data.unitList && this.data.unitList.length > 0) || (this.data.identityList && this.data.identityList.length > 0); }, _hasChildCategory : function(){ return (this.data.unitList && this.data.unitList.length > 0); }, _hasChildItem: function(){ return this.data.identityList && this.data.identityList.length > 0; } }); MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemUnitCategory = new Class({ Extends: MWF.xApplication.Selector.IdentityWidthDuty.ItemUnitCategory }); MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemGroupCategory = new Class({ Extends: MWF.xApplication.Selector.IdentityWidthDuty.ItemGroupCategory }); MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.Filter = new Class({ Extends: MWF.xApplication.Selector.IdentityWidthDuty.Filter });