IdentityWidthDutyCategoryByUnit.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. MWF.xApplication.Selector = MWF.xApplication.Selector || {};
  2. MWF.xDesktop.requireApp("Selector", "IdentityWidthDuty", null, false);
  3. MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({
  4. Extends: MWF.xApplication.Selector.IdentityWidthDuty,
  5. options: {
  6. "style": "default",
  7. "count": 0,
  8. "title": MWF.xApplication.Selector.LP.selectIdentity,
  9. "dutys": [],
  10. "units": [],
  11. "values": [],
  12. "zIndex": 1000,
  13. "expand": false,
  14. "noUnit" : false,
  15. "include" : [], //增加的可选项
  16. "resultType" : "", //可以设置成个人,那么结果返回个人
  17. "expandSubEnable": true,
  18. "selectAllEnable" : true, //分类是否允许全选下一层
  19. "exclude" : [],
  20. "dutyUnitLevelBy" : "duty", //组织层级是按身份所在群组还是职务,
  21. "selectType" : "identity"
  22. },
  23. _init : function(){
  24. this.selectType = "identity";
  25. this.className = "IdentityWidthDutyCategoryByUnit";
  26. },
  27. loadSelectItems: function(addToNext){
  28. //根据组织分类展现职务
  29. if( this.options.resultType === "person" ){
  30. if( this.titleTextNode ){
  31. this.titleTextNode.set("text", MWF.xApplication.Selector.LP.selectPerson );
  32. }else{
  33. this.options.title = MWF.xApplication.Selector.LP.selectPerson;
  34. }
  35. }
  36. if( this.options.disabled ){
  37. this.afterLoadSelectItem();
  38. return;
  39. }
  40. if (this.options.dutys.length){
  41. this.loadInclude( function () {
  42. this.includeLoaded = true;
  43. if( this.dutyLoaded ){
  44. this.afterLoadSelectItem();
  45. }
  46. }.bind(this));
  47. if( this.options.units.length ){
  48. var units = [];
  49. for( var i=0 ;i<this.options.units.length; i++ ){
  50. var unit = this.options.units[i];
  51. if( typeOf( unit ) === "string" ){
  52. units.push( unit )
  53. }else{
  54. units.push( unit.distinguishedName || unit.unique || unit.id || unit.levelName )
  55. }
  56. }
  57. this.unitStringList = units;
  58. var getAllIdentity = function( unitList ){
  59. o2.Actions.load("x_organization_assemble_express").UnitDutyAction.listIdentityWithUnitWithNameObject({
  60. nameList : this.options.dutys,
  61. unitList : unitList
  62. }, function( json ){
  63. this._loadSelectItems( json.data )
  64. }.bind(this))
  65. }.bind(this);
  66. if( this.options.expandSubEnable ){
  67. o2.Actions.load("x_organization_assemble_express").UnitAction.listWithUnitSubNested({
  68. unitList : units
  69. }, function( json ){
  70. getAllIdentity( units.combine( json.data ? json.data.unitList : [] ));
  71. }.bind(this))
  72. }else{
  73. getAllIdentity( units );
  74. }
  75. }else{
  76. var identityList = [];
  77. var count = 0;
  78. this.options.dutys.each( function( d ){
  79. this.orgAction.listIdentityWithDuty(function(json){
  80. count++;
  81. identityList = identityList.combine( json.data );
  82. if( this.options.dutys.length === count )this._loadSelectItems( identityList );
  83. }.bind(this), function(){
  84. count++;
  85. if( this.options.dutys.length === count )this._loadSelectItems( identityList );
  86. }.bind(this), d );
  87. }.bind(this));
  88. }
  89. //this.options.dutys.each(function(duty){
  90. // var data = {"name": duty, "id":duty};
  91. // var category = this._newItemCategory("ItemCategory",data, this, this.itemAreaNode);
  92. // this.subCategorys.push(category);
  93. //}.bind(this));
  94. }
  95. },
  96. _loadSelectItems : function( identityList ){
  97. //this.listAllIdentityInUnitObject( identityList );
  98. var unitTree = this.listNestedUnitByIdentity( identityList );
  99. this.uniqueIdentity( unitTree );
  100. if( this.options.dutyUnitLevelBy === "duty" ){
  101. this.level1Container = [];
  102. if( this.options.units && this.options.units.length ){
  103. var div = new Element( "div" ).inject(this.itemAreaNode);
  104. this.level1Container.push(div);
  105. }
  106. this._loadSelectItemsByDutyUnit(unitTree);
  107. }else{
  108. this._loadSelectItemsByIdentityUnit(unitTree);
  109. }
  110. this.dutyLoaded = true;
  111. if( this.includeLoaded ){
  112. this.afterLoadSelectItem();
  113. }
  114. },
  115. _loadSelectItemsByIdentityUnit : function( unitTree ){
  116. if( !unitTree.unitList )return;
  117. this.sortUnit( unitTree.unitList );
  118. for( var i=0; i< unitTree.unitList.length; i++ ){
  119. var unit = unitTree.unitList[i];
  120. // if( !this.isExcluded( unit ) ) {
  121. var category = this._newItemCategory("ItemCategory",unit, this, this.itemAreaNode);
  122. this.subCategorys.push(category);
  123. // }
  124. }
  125. },
  126. sortUnit : function( unitList ){
  127. if( this.options.dutyUnitLevelBy === "duty" ){
  128. if( this.options.units ){
  129. unitList.sort( function(a, b){
  130. var idxA = this.getIndexFromUnitOption( a );
  131. var idxB = this.getIndexFromUnitOption( b );
  132. idxA = idxA === -1 ? 9999999 + (a.orderNumber || 9999999) : idxA;
  133. idxB = idxB === -1 ? 9999999 + (b.orderNumber || 9999999) : idxB;
  134. return idxA - idxB;
  135. }.bind(this))
  136. }else{
  137. unitList.sort( function(a, b){
  138. return (a.orderNumber || 9999999) - (b.orderNumber || 9999999);
  139. }.bind(this))
  140. }
  141. }else{
  142. unitList.sort( function(a, b){
  143. return (a.orderNumber || 9999999) - (b.orderNumber || 9999999);
  144. }.bind(this))
  145. }
  146. },
  147. _loadSelectItemsByDutyUnit : function( unitTree ){
  148. if( !unitTree.unitList )return;
  149. // this.sortUnit( unitTree.unitList );
  150. for( var i=0; i< unitTree.unitList.length; i++ ){
  151. var unit = unitTree.unitList[i];
  152. if( this.isUnitContain( unit ) ){
  153. // if( !this.isExcluded( unit ) ) {
  154. var container = this.itemAreaNode;
  155. if( this.level1Container && this.level1Container.length ){
  156. var index = this.getIndexFromUnitOption( unit );
  157. if( index > -1 && (this.level1Container.length > index) && this.level1Container[i] )container = this.level1Container[i];
  158. }
  159. var category = this._newItemCategory("ItemCategory",unit, this, container );
  160. this.subCategorys.push(category);
  161. // }
  162. }else{
  163. this._loadSelectItemsByDutyUnit( unit );
  164. }
  165. }
  166. },
  167. getIndexFromUnitOption : function( unit ){
  168. if( !this.unitStringList || !this.unitStringList.length )return -1;
  169. var idx = -1;
  170. if(idx == -1 && unit.distinguishedName)idx = this.unitStringList.indexOf( unit.distinguishedName );
  171. if(idx == -1 && unit.id)idx = this.unitStringList.indexOf( unit.id );
  172. if(idx == -1 && unit.unique)idx = this.unitStringList.indexOf( unit.unique );
  173. if(idx == -1 && unit.levelName)idx = this.unitStringList.indexOf( unit.levelName );
  174. return idx
  175. },
  176. isUnitContain : function( d ){
  177. if( this.options.units.length === 0 )return true;
  178. if( !this.unitFlagMap ){
  179. this.unitFlagMap = {};
  180. this.options.units.each( function( e ){
  181. if( !e )return;
  182. this.unitFlagMap[ typeOf( e ) === "string" ? e : ( e.distinguishedName || e.id || e.unique || e.employee || e.levelName) ] = true;
  183. }.bind(this));
  184. }
  185. var map = this.unitFlagMap;
  186. return ( d.distinguishedName && map[ d.distinguishedName ] ) ||
  187. ( d.levelName && map[ d.levelName ] ) ||
  188. ( d.id && map[ d.id ] ) ||
  189. ( d.unique && map[ d.unique ] );
  190. },
  191. listAllIdentityInUnitObject : function(){
  192. var unitArray = [];
  193. for( var i=0; i<identityList.length; i++ ){
  194. unitArray.push( identityList[i].unit || identityList[i].unitLevelName );
  195. }
  196. o2.Actions.load("x_organization_assemble_express").UnitAction.listObject({
  197. unitList : unitArray
  198. }, function(json){
  199. this.allIdentityInUnitObject = {};
  200. json.data.each( function( u ){
  201. this.allIdentityInUnitObject[u.levelName] = u;
  202. }.bind(this));
  203. if(callback)callback();
  204. }.bind(this), null, false)
  205. },
  206. getUnitOrderNumber : function( unit ){
  207. return this.allIdentityInUnitObject[unit.levelName].orderNumber;
  208. },
  209. listAllUnitObject: function( identityList, callback ){
  210. var key = this.options.dutyUnitLevelBy === "duty" ? "matchUnitLevelName" : "unitLevelName";
  211. var unitArray = [];
  212. for( var i=0; i<identityList.length; i++ ){
  213. var levelNames = identityList[i][key];
  214. //if( !levelNames && key === "matchUnitLevelName" )levelNames = identityList[i].unitLevelName;
  215. var unitLevelNameList = levelNames.split("/");
  216. var nameList = [];
  217. for( var j=0; j<unitLevelNameList.length; j++ ){
  218. nameList.push( unitLevelNameList[j] );
  219. var name = nameList.join("/");
  220. if( !unitArray.contains( name ) ){
  221. unitArray.push( name );
  222. }
  223. }
  224. }
  225. o2.Actions.load("x_organization_assemble_express").UnitAction.listObject({
  226. unitList : unitArray
  227. }, function(json){
  228. this.allUnitObject = {};
  229. json.data.each( function( u ){
  230. this.allUnitObject[u.levelName] = u;
  231. }.bind(this));
  232. if(callback)callback();
  233. }.bind(this), null, false)
  234. },
  235. listNestedUnitByIdentity : function( identityList ){
  236. this.listAllUnitObject( identityList);
  237. return this._listNestedUnitByIdentity( identityList );
  238. },
  239. _listNestedUnitByIdentity : function( identityList ){
  240. debugger;
  241. //identityList = Array.unique(identityList);
  242. var key = this.options.dutyUnitLevelBy === "duty" ? "matchUnitLevelName" : "unitLevelName";
  243. //根据unitLevelName整合成组织树
  244. var unitTree = {};
  245. for( var i=0; i<identityList.length; i++ ){
  246. var flag = true;
  247. if( this.isExcluded( identityList[i] ) )continue;
  248. var levelNames = identityList[i][key];
  249. //if( !levelNames && key === "matchUnitLevelName" )levelNames = identityList[i].unitLevelName;
  250. var unitLevelNameList = levelNames.split("/");
  251. var nameList = [];
  252. var tree = unitTree;
  253. for( var j=0; j<unitLevelNameList.length; j++ ){
  254. nameList.push( unitLevelNameList[j] );
  255. var name = nameList.join("/");
  256. if( this.isExcluded( this.allUnitObject[name] || {} ) ){
  257. flag = false;
  258. break;
  259. }
  260. if( !tree.unitList )tree.unitList = [];
  261. var found = false;
  262. for( var k=0; k<tree.unitList.length; k++ ){
  263. if( tree.unitList[k].levelName == name ){
  264. tree = tree.unitList[k];
  265. found = true;
  266. break;
  267. }
  268. }
  269. if( !found ){
  270. // var obj = {};
  271. var obj = this.allUnitObject[name] || {};
  272. obj.matchLevelName = name;
  273. tree.unitList.push( obj );
  274. tree = obj;
  275. }
  276. // if( !tree.distinguishedName ){
  277. // tree = Object.merge( tree, this.allUnitObject[name] );
  278. // }
  279. if( !tree.identityList )tree.identityList = [];
  280. }
  281. if(flag)tree.identityList.push( identityList[i] );
  282. }
  283. return unitTree;
  284. },
  285. uniqueIdentity : function( tree ){
  286. var map = {};
  287. var isExist = function ( d ) {
  288. if(( d.distinguishedName && map[ d.distinguishedName ] ) ||
  289. ( d.levelName && map[ d.levelName ] ) ||
  290. ( d.id && map[ d.id ] ) ||
  291. ( d.unique && map[ d.unique ] )){
  292. return true;
  293. }else{
  294. map[ typeOf( d ) === "string" ? d : ( d.distinguishedName || d.id || d.unique || d.employee || d.levelName) ] = true;
  295. return false;
  296. }
  297. };
  298. var identityList = [];
  299. if( tree.identityList ){
  300. for( var i=0; i<tree.identityList.length; i++ ){
  301. if( !isExist( tree.identityList[i] ) )identityList.push( tree.identityList[i] );
  302. }
  303. }
  304. tree.identityList = identityList;
  305. if( this.options.isCheckStatus ){
  306. var names = (tree.matchLevelName || tree.levelName || "").split("/");
  307. var nameList = [];
  308. for( var i=0; i<names.length; i++ ){
  309. nameList.push( names[i] );
  310. var name = nameList.join("/");
  311. var obj = this.allUnitObject[name];
  312. if( obj ){
  313. obj.subNestedIdentityCount = ( obj.subNestedIdentityCount || 0 ) + identityList.length;
  314. }
  315. }
  316. }
  317. if( tree.unitList ){
  318. for( var i=0; i<tree.unitList.length; i++ ){
  319. this.uniqueIdentity( tree.unitList[i] );
  320. }
  321. }
  322. },
  323. //listNestedUnitByIdentity : function( identityList ){
  324. // debugger;
  325. // this.unitArray = [];
  326. // var key = this.options.dutyUnitLevelBy === "duty" ? "matchUnitLevelName" : "unitLevelName";
  327. // //根据unitLevelName整合成组织树
  328. // var unitTree = {};
  329. // for( var i=0; i<identityList.length; i++ ){
  330. // var levelNames = identityList[i][key];
  331. // //if( !levelNames && key === "matchUnitLevelName" )levelNames = identityList[i].unitLevelName;
  332. // var unitLevelNameList = levelNames.split("/");
  333. // var nameList = [];
  334. // var tree = unitTree;
  335. // for( var j=0; j<unitLevelNameList.length; j++ ){
  336. // nameList.push( unitLevelNameList[j] );
  337. // var name = nameList.join("/");
  338. // if( !tree[ name ] ){
  339. // tree[ name ] = {
  340. // name : unitLevelNameList[j],
  341. // levelName : name,
  342. // identityList : []
  343. // };
  344. // this.unitArray.push( name );
  345. // }
  346. // tree = tree[name];
  347. // }
  348. // tree.identityList.push( identityList[i] );
  349. // }
  350. // return unitTree;
  351. //},
  352. _scrollEvent: function(y){
  353. return true;
  354. },
  355. _getChildrenItemIds: function(){
  356. return null;
  357. },
  358. _newItemCategory: function(type, data, selector, item, level, category, delay){
  359. return new MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit[type](data, selector, item, level, category, delay)
  360. },
  361. _listItemByKey: function(callback, failure, key){
  362. if (this.options.units.length) key = {"key": key, "unitList": this.options.units};
  363. this.orgAction.listIdentityByKey(function(json){
  364. if (callback) callback.apply(this, [json]);
  365. }.bind(this), failure, key);
  366. },
  367. _getItem: function(callback, failure, id, async){
  368. if( typeOf(id) === "string" ){
  369. this.orgAction.getIdentity(function(json){
  370. if (callback) callback.apply(this, [json]);
  371. }.bind(this), failure, ((typeOf(id)==="string") ? id : id.distinguishedName), async);
  372. }else{
  373. if (callback) callback.apply(this, [id]);
  374. }
  375. //this.orgAction.getIdentity(function(json){
  376. // if (callback) callback.apply(this, [json]);
  377. //}.bind(this), failure, ((typeOf(id)==="string") ? id : id.distinguishedName), async);
  378. },
  379. _newItemSelected: function(data, selector, item, selectedNode){
  380. return new MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemSelected(data, selector, item, selectedNode)
  381. },
  382. _listItemByPinyin: function(callback, failure, key){
  383. if (this.options.units.length) key = {"key": key, "unitList": this.options.units};
  384. this.orgAction.listIdentityByPinyin(function(json){
  385. if (callback) callback.apply(this, [json]);
  386. }.bind(this), failure, key);
  387. },
  388. _newItem: function(data, selector, container, level, category, delay){
  389. return new MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.Item(data, selector, container, level, category, delay);
  390. },
  391. _newItemSearch: function(data, selector, container, level){
  392. return new MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.SearchItem(data, selector, container, level);
  393. }
  394. //_listItemNext: function(last, count, callback){
  395. // this.action.listRoleNext(last, count, function(json){
  396. // if (callback) callback.apply(this, [json]);
  397. // }.bind(this));
  398. //}
  399. });
  400. MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.Item = new Class({
  401. Extends: MWF.xApplication.Selector.IdentityWidthDuty.Item
  402. });
  403. MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.SearchItem = new Class({
  404. Extends: MWF.xApplication.Selector.IdentityWidthDuty.SearchItem
  405. });
  406. MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemSelected = new Class({
  407. Extends: MWF.xApplication.Selector.IdentityWidthDuty.ItemSelected
  408. });
  409. MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemCategory = new Class({
  410. Extends: MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory,
  411. _getShowName: function(){
  412. return this.data.name;
  413. },
  414. _addSelectedCount : function( count, nested ){
  415. debugger;
  416. var c = (this._getSelectedCount() || 0) + count;
  417. this.selectedCount = c;
  418. this.checkCountAndStatus(c);
  419. if( nested && this.category && this.category._addSelectedCount ){
  420. this.category._addSelectedCount(count, nested);
  421. }
  422. },
  423. // _getSelectedCount : function(){
  424. // var list = this.subItems.filter( function (item) { return item.isSelected; });
  425. // return list.length;
  426. // },
  427. _getTotalCount : function(){
  428. return this.data.subNestedIdentityCount;
  429. },
  430. _getSelectedCount : function(){
  431. debugger;
  432. if( typeOf( this.selectedCount ) === "number" ){
  433. return this.selectedCount;
  434. }else{
  435. return 0;
  436. }
  437. },
  438. _checkStatus : function(){
  439. },
  440. isExisted : function( d ){
  441. if( !d )return true;
  442. if( !this.createdItemObject )this.createdItemObject = {};
  443. var map = this.createdItemObject;
  444. if(( d.distinguishedName && map[ d.distinguishedName ] ) ||
  445. ( d.levelName && map[ d.levelName ] ) ||
  446. ( d.id && map[ d.id ] ) ||
  447. ( d.unique && map[ d.unique ] )){
  448. return true;
  449. }else{
  450. //if( typeOf( d ) === "string" ){
  451. // this.createdItemObject[ d ] = true;
  452. //}else{
  453. // if( d.distinguishedName )this.createdItemObject[ d.distinguishedName ] = true;
  454. // if( d.id )this.createdItemObject[ d.id ] = true;
  455. // if( d.unique )this.createdItemObject[ d.unique ] = true;
  456. // if( d.employee )this.createdItemObject[ d.employee ] = true;
  457. // if( d.levelName )this.createdItemObject[ d.levelName ] = true;
  458. //}
  459. this.createdItemObject[ typeOf( d ) === "string" ? d : ( d.distinguishedName || d.id || d.unique || d.employee || d.levelName) ] = true;
  460. return false;
  461. }
  462. },
  463. loadSub : function(callback){
  464. this._loadSub(function( firstLoad ){
  465. if( firstLoad && (this.selector.options.showSelectedCount || this.selector.options.isCheckStatus)){
  466. var count = 0;
  467. this.subCategorys.each( function (category) {
  468. var l = category.subItems.filter( function (item) { return item.isSelected; });
  469. count = count + l.length;
  470. });
  471. var list = this.subItems.filter( function (item) { return item.isSelected; });
  472. this.selectedCount = count+list.length;
  473. this.checkCountAndStatus(this.selectedCount);
  474. }
  475. if (callback) callback();
  476. }.bind(this))
  477. },
  478. _loadSub: function(callback){
  479. if (!this.loaded){
  480. if( this.data.identityList && this.data.identityList.length>0 ){
  481. this.data.identityList.sort( function(a, b){
  482. //this.selector.getUnitOrderNumber( a.unitLevelName )
  483. return (a.orderNumber || 9999999) - (b.orderNumber || 9999999);
  484. });
  485. this.data.identityList.each( function( identity ){
  486. // if( !this.selector.isExcluded( identity ) ) {
  487. // if( !this.isExisted( identity ) ){
  488. var item = this.selector._newItem(identity, this.selector, this.children, this.level + 1, this);
  489. this.selector.items.push(item);
  490. if(this.subItems)this.subItems.push( item );
  491. // }
  492. // }
  493. }.bind(this))
  494. }
  495. if( this.data.unitList && this.data.unitList.length ){
  496. this.data.unitList.sort( function(a, b){
  497. return (a.orderNumber || 9999999) - (b.orderNumber || 9999999);
  498. });
  499. this.data.unitList.each( function( subData ){
  500. // if( !this.selector.isExcluded( subData ) ) {
  501. var category = this.selector._newItemCategory("ItemCategory", subData, this.selector, this.children, this.level + 1, this);
  502. this.subCategorys.push( category );
  503. category.loadSub()
  504. // }
  505. }.bind(this));
  506. }
  507. this.loaded = true;
  508. if (callback) callback( true );
  509. }else{
  510. if (callback) callback( );
  511. }
  512. },
  513. loadCategoryChildren: function(callback){
  514. if (!this.categoryLoaded){
  515. this.loadSub();
  516. this.categoryLoaded = true;
  517. this.itemLoaded = true;
  518. if (callback) callback( );
  519. }else{
  520. if (callback) callback( );
  521. }
  522. },
  523. loadItemChildren: function(callback){
  524. if (!this.itemLoaded){
  525. if( this.data.identityList && this.data.identityList.length>0 ){
  526. this.data.identityList.sort( function(a, b){
  527. //this.selector.getUnitOrderNumber( a.unitLevelName )
  528. return (a.orderNumber || 9999999) - (b.orderNumber || 9999999);
  529. });
  530. this.data.identityList.each( function( identity ){
  531. // if( !this.selector.isExcluded( identity ) ) {
  532. // if( !this.isExisted( identity ) ){
  533. var item = this.selector._newItem(identity, this.selector, this.children, this.level + 1, this);
  534. this.selector.items.push(item);
  535. if(this.subItems)this.subItems.push( item );
  536. // }
  537. // }
  538. }.bind(this))
  539. }
  540. this.itemLoaded = true;
  541. if (callback) callback( );
  542. }else{
  543. if (callback) callback( );
  544. }
  545. },
  546. _hasChild: function(){
  547. return (this.data.unitList && this.data.unitList.length > 0) ||
  548. (this.data.identityList && this.data.identityList.length > 0);
  549. },
  550. _hasChildCategory : function(){
  551. return (this.data.unitList && this.data.unitList.length > 0);
  552. },
  553. _hasChildItem: function(){
  554. return this.data.identityList && this.data.identityList.length > 0;
  555. }
  556. });
  557. MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemUnitCategory = new Class({
  558. Extends: MWF.xApplication.Selector.IdentityWidthDuty.ItemUnitCategory
  559. });
  560. MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.ItemGroupCategory = new Class({
  561. Extends: MWF.xApplication.Selector.IdentityWidthDuty.ItemGroupCategory
  562. });
  563. MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.Filter = new Class({
  564. Extends: MWF.xApplication.Selector.IdentityWidthDuty.Filter
  565. });