IdentityWidthDutyCategoryByUnit.js 25 KB

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