From 1a20fc1b3333fe3d4ba9952344ecbdb865419fd4 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 Oct 2020 00:28:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=80=89=E6=8B=A9=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=9A=90=E8=97=8F=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IdentityWidthDutyCategoryByUnit.js | 458 +++++++++--------- 1 file changed, 231 insertions(+), 227 deletions(-) diff --git a/o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js b/o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js index 5afac020d0..526f06727f 100644 --- a/o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js +++ b/o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js @@ -11,83 +11,83 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({ "values": [], "zIndex": 1000, "expand": false, - "noUnit" : false, - "include" : [], //增加的可选项 - "resultType" : "", //可以设置成个人,那么结果返回个人 + "noUnit": false, + "include": [], //增加的可选项 + "resultType": "", //可以设置成个人,那么结果返回个人 "expandSubEnable": true, - "selectAllEnable" : true, //分类是否允许全选下一层 - "exclude" : [], - "dutyUnitLevelBy" : "duty", //组织层级是按身份所在群组还是职务, - "selectType" : "identity" + "selectAllEnable": true, //分类是否允许全选下一层 + "exclude": [], + "dutyUnitLevelBy": "duty", //组织层级是按身份所在群组还是职务, + "selectType": "identity" }, - _init : function(){ + _init: function () { this.selectType = "identity"; this.className = "IdentityWidthDutyCategoryByUnit"; }, - loadSelectItems: function(addToNext){ + loadSelectItems: function (addToNext) { //根据组织分类展现职务 - if( this.options.resultType === "person" ){ - if( this.titleTextNode ){ - this.titleTextNode.set("text", MWF.xApplication.Selector.LP.selectPerson ); - }else{ + 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.disabled ){ + if (this.options.disabled) { this.afterLoadSelectItem(); return; } - if (this.options.dutys.length){ - this.loadInclude( function () { + if (this.options.dutys.length) { + this.loadInclude(function () { this.includeLoaded = true; - if( this.dutyLoaded ){ + if (this.dutyLoaded) { this.afterLoadSelectItem(); } }.bind(this)); - if( this.options.units.length ){ + if (this.options.units.length) { var units = []; - for( var i=0 ;i -1 && (this.level1Container.length > index) && this.level1Container[i] )container = this.level1Container[i]; - } - var category = this._newItemCategory("ItemCategory",unit, this, container ); - this.subCategorys.push(category); + 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); // } - }else{ - this._loadSelectItemsByDutyUnit( unit ); + } else { + this._loadSelectItemsByDutyUnit(unit); } } }, - getIndexFromUnitOption : function( unit ){ - if( !this.unitStringList || !this.unitStringList.length )return -1; + getIndexFromUnitOption: function (unit) { + if (!this.unitStringList || !this.unitStringList.length) return -1; var idx = -1; - if(idx == -1 && unit.distinguishedName)idx = this.unitStringList.indexOf( unit.distinguishedName ); - if(idx == -1 && unit.id)idx = this.unitStringList.indexOf( unit.id ); - if(idx == -1 && unit.unique)idx = this.unitStringList.indexOf( unit.unique ); - if(idx == -1 && unit.levelName)idx = this.unitStringList.indexOf( unit.levelName ); + if (idx == -1 && unit.distinguishedName) idx = this.unitStringList.indexOf(unit.distinguishedName); + if (idx == -1 && unit.id) idx = this.unitStringList.indexOf(unit.id); + if (idx == -1 && unit.unique) idx = this.unitStringList.indexOf(unit.unique); + if (idx == -1 && unit.levelName) idx = this.unitStringList.indexOf(unit.levelName); return idx }, - isUnitContain : function( d ){ - if( this.options.units.length === 0 )return true; - if( !this.unitFlagMap ){ + isUnitContain: function (d) { + if (this.options.units.length === 0) return true; + if (!this.unitFlagMap) { this.unitFlagMap = {}; - this.options.units.each( function( e ){ - if( !e )return; - this.unitFlagMap[ typeOf( e ) === "string" ? e : ( e.distinguishedName || e.id || e.unique || e.employee || e.levelName) ] = true; + this.options.units.each(function (e) { + if (!e) return; + this.unitFlagMap[typeOf(e) === "string" ? e : (e.distinguishedName || e.id || e.unique || e.employee || e.levelName)] = true; }.bind(this)); } var map = this.unitFlagMap; - return ( d.distinguishedName && map[ d.distinguishedName ] ) || - ( d.levelName && map[ d.levelName ] ) || - ( d.id && map[ d.id ] ) || - ( d.unique && map[ d.unique ] ); + return (d.distinguishedName && map[d.distinguishedName]) || + (d.levelName && map[d.levelName]) || + (d.id && map[d.id]) || + (d.unique && map[d.unique]); }, - listAllIdentityInUnitObject : function(){ + listAllIdentityInUnitObject: function () { var unitArray = []; - for( var i=0; i0 ){ - this.data.identityList.sort( function(a, b){ + _loadSub: function (callback) { + if (!this.loaded) { + 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 ){ + 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 ); - // } + 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( this.data.unitList && this.data.unitList.length ){ - this.data.unitList.sort( function(a, b){ + 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 ){ + 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() + 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( true ); - }else{ - if (callback) callback( ); + if (callback) callback(true); + } else { + if (callback) callback(); } }, - loadCategoryChildren: function(callback){ - if (!this.categoryLoaded){ + loadCategoryChildren: function (callback) { + if (!this.categoryLoaded) { this.loadSub(); this.categoryLoaded = true; this.itemLoaded = true; - if (callback) callback( ); - }else{ - if (callback) callback( ); + 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){ + 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 ){ + 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 ); - // } + 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( ); + if (callback) callback(); + } else { + if (callback) callback(); } }, - _hasChild: function(){ + _hasChild: function () { return (this.data.unitList && this.data.unitList.length > 0) || (this.data.identityList && this.data.identityList.length > 0); }, - _hasChildCategory : function(){ + _hasChildCategory: function () { return (this.data.unitList && this.data.unitList.length > 0); }, - _hasChildItem: function(){ + _hasChildItem: function () { return this.data.identityList && this.data.identityList.length > 0; } -- GitLab